SA-MP Forums Archive
CMD:shakehand help. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: CMD:shakehand help. (/showthread.php?tid=611509)



CMD:shakehand help. - 0B3Y - 07.07.2016

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_PURPLE,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_PURPLE,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_PURPLE,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_PURPLE,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_PURPLE,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_PURPLE,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_PURPLE,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_PURPLE,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;
}



Re: CMD:shakehand help. - Dusan01 - 07.07.2016

at the end of ApplyAnimation, afther that time 1000, try adding afther that 2, that is parameter for forcesync


Re: CMD:shakehand help. - 0B3Y - 07.07.2016

What do you mean?


Re: CMD:shakehand help. - Dusan01 - 07.07.2016

Replace this:
PHP код:
ApplyAnimationplayerid"GANGS""hndshkaa"4.011101000 );
ApplyAnimationi"GANGS""hndshkaa"4.011101000 ); 
with:
PHP код:
ApplyAnimationplayerid"GANGS""hndshkaa"4.0111010002);
ApplyAnimationi"GANGS""hndshkaa"4.0111010002); 
you now see a difference? its last parameter added of function ApplyAnimation


Re: CMD:shakehand help. - PrO.GameR - 07.07.2016

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
PHP код:
ApplyAnimationplayerid"GANGS""hndshkaa"4.011101000 );
ApplyAnimationplayerid"GANGS""hndshkaa"4.011101000 );
ApplyAnimationi"GANGS""hndshkaa"4.011101000 );
ApplyAnimationi"GANGS""hndshkaa"4.011101000 ); 
or
PHP код:
//Under onplayerconnect
ApplyAnimationplayerid"GANGS""null"0.0000001); 



Re: CMD:shakehand help. - 0B3Y - 07.07.2016

Tried all of them and still the same


Re: CMD:shakehand help. - 0B3Y - 08.07.2016

bump


Re: CMD:shakehand help. - 0B3Y - 17.07.2016

bump