07.07.2016, 14:00
(
Последний раз редактировалось 0B3Y; 07.07.2016 в 15:48.
)
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; }