PDA

View Full Version : CMD:shakehand help.


0B3Y
07/07/2016, 02:00 PM
When a player do /shakehand [id] [style] and the player who requested is accepting, the animation only applies on me in my screen, but on their screen they're doing the animations while im not. its like not synced. How can i make both of them applies the animations? Here's the codes.

foreach(Player, i) {
if(GetPVarInt(i, "shrequest") == playerid) {
new
Float: ppFloats[3];

GetPlayerPos(i, ppFloats[0], ppFloats[1], ppFloats[2]);

if(!IsPlayerInRangeOfPoint(playerid, 5, ppFloats[0], ppFloats[1], ppFloats[2])) {
Count++;
SendClientMessageEx(playerid, COLOR_WHITE, "You're too far away. You can't accept the handshake right now.");
}
else {
switch(GetPVarInt(i, "shstyle")) {
case 1:
{
Count++;
PlayerFacePlayer( playerid, i );
ApplyAnimation( playerid, "GANGS", "hndshkaa", 4.0, 1, 1, 1, 0, 1000 );
ApplyAnimation( i, "GANGS", "hndshkaa", 4.0, 1, 1, 1, 0, 1000 );
SetPVarInt(i, "shrequest", INVALID_PLAYER_ID);
format(string, sizeof(string), "* %s has shook hands with %s.", GetPlayerNameEx(i), GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
DeletePVar(i, "shstyle");
}
case 2:
{
Count++;
PlayerFacePlayer( playerid, i );
ApplyAnimation( playerid, "GANGS", "hndshkba", 4.0, 1, 1, 1, 0, 1000 );
ApplyAnimation( i, "GANGS", "hndshkba", 4.0, 1, 1, 1, 0, 1000 );
SetPVarInt(i, "shrequest", INVALID_PLAYER_ID);
format(string, sizeof(string), "* %s has shook hands with %s.", GetPlayerNameEx(i), GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
DeletePVar(i, "shstyle");
}
case 3:
{
Count++;
PlayerFacePlayer( playerid, i );
ApplyAnimation( playerid, "GANGS", "hndshkca", 4.0, 1, 1, 1, 0, 1000 );
ApplyAnimation( i, "GANGS", "hndshkca", 4.0, 1, 1, 1, 0, 1000 );
SetPVarInt(i, "shrequest", INVALID_PLAYER_ID);
format(string, sizeof(string), "* %s has shook hands with %s.", GetPlayerNameEx(i), GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
DeletePVar(i, "shstyle");
}
case 4:
{
Count++;
PlayerFacePlayer( playerid, i );
ApplyAnimation( playerid, "GANGS", "hndshkcb", 4.0, 1, 1, 1, 0, 1000 );
ApplyAnimation( i, "GANGS", "hndshkca", 4.0, 1, 1, 1, 0, 1000 );
SetPVarInt(i, "shrequest", INVALID_PLAYER_ID);
format(string, sizeof(string), "* %s has shook hands with %s.", GetPlayerNameEx(i), GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
DeletePVar(i, "shstyle");
}
case 5:
{
Count++;
PlayerFacePlayer( playerid, i );
ApplyAnimation( playerid, "GANGS", "hndshkda", 4.0, 1, 1, 1, 0, 1000 );
ApplyAnimation( i, "GANGS", "hndshkca", 4.0, 1, 1, 1, 0, 1000 );
SetPVarInt(i, "shrequest", INVALID_PLAYER_ID);
format(string, sizeof(string), "* %s has shook hands with %s.", GetPlayerNameEx(i), GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
DeletePVar(i, "shstyle");
}
case 6:
{
Count++;
PlayerFacePlayer( playerid, i );
ApplyAnimation( playerid, "GANGS","hndshkfa_swt", 4.0, 1, 1, 1, 0, 2600 );
ApplyAnimation( i, "GANGS","hndshkfa_swt", 4.0, 1, 1, 1, 0, 2600 );
SetPVarInt(i, "shrequest", INVALID_PLAYER_ID);
format(string, sizeof(string), "* %s has shook hands with %s.", GetPlayerNameEx(i), GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
DeletePVar(i, "shstyle");
}
case 7:
{
Count++;
PlayerFacePlayer( playerid, i );
ApplyAnimation( playerid, "GANGS", "prtial_hndshk_01", 4.0, 1, 1, 1, 0, 1250 );
ApplyAnimation( i, "GANGS", "prtial_hndshk_01", 4.0, 1, 1, 1, 0, 1250 );
SetPVarInt(i, "shrequest", INVALID_PLAYER_ID);
format(string, sizeof(string), "* %s has shook hands with %s.", GetPlayerNameEx(i), GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
DeletePVar(i, "shstyle");
}
case 8:
{
Count++;
PlayerFacePlayer( playerid, i );
ApplyAnimation( playerid, "GANGS", "prtial_hndshk_biz_01", 3.7, 1, 1, 1, 0, 2200 );
ApplyAnimation( i, "GANGS", "prtial_hndshk_biz_01", 3.5, 1, 1, 1, 0, 2200 );
SetPVarInt(i, "shrequest", INVALID_PLAYER_ID);
format(string, sizeof(string), "* %s has shook hands with %s.", GetPlayerNameEx(i), GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
DeletePVar(i, "shstyle");
}
}
}
}
}
if(Count == 0) return SendClientMessageEx(playerid, COLOR_WHITE, "You don't have any pending handshake requests.");
return 1;
}

CMD:shakehand(playerid, params[])
{
new string[128], giveplayerid, style;
if(sscanf(params, "id", giveplayerid, style)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /shakehand [playerid] [style (1-8)]");

if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid == playerid)
{
SendClientMessageEx(playerid, COLOR_GREY, "You can't shake your own hand.");
return 1;
}
if(style >= 1 && style < 9)
{
new Float: ppFloats[3];

GetPlayerPos(giveplayerid, ppFloats[0], ppFloats[1], ppFloats[2]);

if(!IsPlayerInRangeOfPoint(playerid, 5, ppFloats[0], ppFloats[1], ppFloats[2]))
{
SendClientMessageEx(playerid, COLOR_GREY, "You're too far away. You can't shake hands right now.");
return 1;
}

SetPVarInt(playerid, "shrequest", giveplayerid);
SetPVarInt(playerid, "shstyle", style);

format(string, sizeof(string), "You have requested to shake %s's hand, please wait for them to respond.", GetPlayerNameEx(giveplayerid));
SendClientMessageEx(playerid, COLOR_WHITE, string);

format(string, sizeof(string), "%s has requested to shake your hand, please click Accept to approve the hand shake.", GetPlayerNameEx(playerid));
ShowPlayerDialog(giveplayerid, DIALOG_ACCEPTDIALOG, DIALOG_STYLE_MSGBOX, "{FFFFFF}Handshake Offer", string, "Accept", "Reject");
PlayerInfo[giveplayerid][pAcceptID] =3;
}
else
{
SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /shakehand [playerid] [style (1-8)]");
}
}
else
{
SendClientMessageEx(playerid, COLOR_GREY, "Invalid player specified.");
}
return 1;
}

Dusan01
07/07/2016, 03:25 PM
at the end of ApplyAnimation, afther that time 1000, try adding afther that 2, that is parameter for forcesync

0B3Y
07/07/2016, 03:31 PM
What do you mean?

Dusan01
07/07/2016, 03:32 PM
Replace this: ApplyAnimation( playerid, "GANGS", "hndshkaa", 4.0, 1, 1, 1, 0, 1000 );
ApplyAnimation( i, "GANGS", "hndshkaa", 4.0, 1, 1, 1, 0, 1000 ); with: ApplyAnimation( playerid, "GANGS", "hndshkaa", 4.0, 1, 1, 1, 0, 1000, 2);
ApplyAnimation( i, "GANGS", "hndshkaa", 4.0, 1, 1, 1, 0, 1000, 2);

you now see a difference? its last parameter added of function ApplyAnimation

PrO.GameR
07/07/2016, 03:39 PM
This problem is most of the time caused because you didn't preload the animlibs, either apply the animations twice or preload the animlibs you wanna use
ApplyAnimation( playerid, "GANGS", "hndshkaa", 4.0, 1, 1, 1, 0, 1000 );
ApplyAnimation( playerid, "GANGS", "hndshkaa", 4.0, 1, 1, 1, 0, 1000 );
ApplyAnimation( i, "GANGS", "hndshkaa", 4.0, 1, 1, 1, 0, 1000 );
ApplyAnimation( i, "GANGS", "hndshkaa", 4.0, 1, 1, 1, 0, 1000 );
or
//Under onplayerconnect
ApplyAnimation( playerid, "GANGS", "null", 0.0, 0, 0, 0, 0, 0, 1);

0B3Y
07/07/2016, 04:40 PM
Tried all of them and still the same :(

0B3Y
08/07/2016, 03:35 AM
bump

0B3Y
17/07/2016, 03:06 AM
bump