10.08.2012, 20:30
i added the new cuff to my script. in the game when the cop/fbi do /cuff playerid. to the cop have the cuff on his right and and the other side of the cuff are not cuffed(if you know what i mean). to the player have the animation and he is freeze but the cuff on the cop like i said. whe the cop do /uncuff the cuff on his right hand disappeared but the animation not disappeared from the player but he is unfreeze. [sorry for my english]
the codes :
/cuff
/uncuff
the codes :
/cuff
Код:
if(strcmp(cmd, "/cuff", true) == 0 || strcmp(cmd, "/cu", true) == 0) { if(IsPlayerConnected(playerid)) { if(PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 2 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 3 || PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 6 || PlayerInfo[playerid][pMember] == 6 || PlayerInfo[playerid][pLeader] == 20 || PlayerInfo[playerid][pMember] == 20) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /cuff [Playerid/PartOfName]"); return 1; } giveplayerid = ReturnUser(tmp); if(IsPlayerConnected(giveplayerid)) { if(giveplayerid != INVALID_PLAYER_ID) { if(gTeam[giveplayerid] == 2 || IsACop(giveplayerid)) { SendClientMessage(playerid, COLOR_GREY, " You can't Cuff Cops !"); return 1; } if(PlayerCuffed[giveplayerid] > 0) { SendClientMessage(playerid, COLOR_GREY, " Player already Cuffed !"); return 1; } if (ProxDetectorS(8.0, playerid, giveplayerid)) { if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "You cannot Cuff yourself!"); return 1; } GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); //GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "* You were Cuffed by %s, till uncuff.", sendername); SendClientMessage(giveplayerid, COLOR_WHITE, string); format(string, sizeof(string), "* You Cuffed %s, till uncuff.", giveplayer); SendClientMessage(playerid, COLOR_WHITE, string); format(string, sizeof(string), "* %s Hand Cuffs %s, so he wont go anywhere.", sendername ,giveplayer); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); GameTextForPlayer(giveplayerid, "~r~Cuffed", 2500, 3); SetPlayerSpecialAction(giveplayerid, SPECIAL_ACTION_CUFFED); SetPlayerAttachedObject(playerid, 0, 19418, 6, -0.011000, 0.028000, -0.022000, -15.600012, -33.699977, -81.700035, 0.891999, 1.000000, 1.168000); TogglePlayerControllable(giveplayerid, 0); PlayerCuffed[giveplayerid] = 2; PlayerCuffedTime[giveplayerid] = 99999999999999; } else { SendClientMessage(playerid, COLOR_GREY, " That player is not near you !"); return 1; } } } else { SendClientMessage(playerid, COLOR_GREY, " That player is Offline !"); return 1; } } else { SendClientMessage(playerid, COLOR_GREY, " You are not a Cop / FBI !"); } } return 1; }
Код:
if(strcmp(cmd, "/uncuff", true) == 0) { if(IsPlayerConnected(playerid)) { if(PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 2 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 3 || PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 4 || PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pLeader] == 19 || PlayerInfo[playerid][pMember] == 19) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /uncuff [Playerid/PartOfName]"); return 1; } for(new i=0; i<MAX_PLAYER_ATTACHED_OBJECTS; i++) { if(IsPlayerAttachedObjectSlotUsed(playerid, i)) RemovePlayerAttachedObject(playerid, i); SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE); } giveplayerid = ReturnUser(tmp); if(IsPlayerConnected(giveplayerid)) { if(giveplayerid != INVALID_PLAYER_ID) { if (ProxDetectorS(8.0, playerid, giveplayerid)) { if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "You cannot Uncuff yourself!"); return 1; } if(PlayerCuffed[giveplayerid]) { GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); //GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "* You were Uncuffed by %s.", sendername); SendClientMessage(giveplayerid, COLOR_WHITE, string); format(string, sizeof(string), "* You Uncuffed %s.", giveplayer); SendClientMessage(playerid, COLOR_WHITE, string); GameTextForPlayer(giveplayerid, "~g~Uncuffed", 2500, 3); TogglePlayerControllable(giveplayerid, 1); PlayerCuffed[giveplayerid] = 0; } else { SendClientMessage(playerid, COLOR_GREY, " That player isn't Tied up !"); return 1; } } else { SendClientMessage(playerid, COLOR_GREY, " That player is not near you !"); return 1; } } } else { SendClientMessage(playerid, COLOR_GREY, " That player is Offline !"); return 1; } } else { SendClientMessage(playerid, COLOR_GREY, " You are not a Cop / FBI !"); } }//not connected return 1; }