if(strcmp(cmd, "/tazer", true) ==0) { if(IsPlayerConnected(playerid)) { if(TazerReload[playerid] > 0) { SendClientMessage(playerid, COLOR_GREY, "Your tazer is not fully charged yet."); return 1; } if(IsALawEnforcer(playerid)) { if(IsPlayerInAnyVehicle(playerid)) { SendClientMessage(playerid, COLOR_GREY, " Cannot use this while being in the Car !"); return 1; } if(OnDuty[playerid] != 1) { SendClientMessage(playerid, COLOR_GREY, " You are not on Duty!"); return 1; } new suspect = GetClosestPlayer(playerid); if(IsPlayerConnected(suspect)) { if(PlayerCuffed[suspect] > 0) { SendClientMessage(playerid, COLOR_GREY, " Player already Cuffed !"); return 1; } if(GetDistanceBetweenPlayers(playerid,suspect) < 5) { if(IsALawEnforcer(suspect)) { SendClientMessage(playerid, COLOR_GREY, " Cannot Tazer Cops / FBI / National Guard !"); return 1; } if(IsPlayerNPC(suspect)) { SendClientMessage(playerid, COLOR_GREY, "This command is disabled for usage against a NPC."); return 1; } if(IsPlayerInAnyVehicle(suspect)) { SendClientMessage(playerid, COLOR_GREY, " Suspect is in a Car, get him out first !"); return 1; } GetPlayerName(suspect, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "* You were Tazed by %s for 12 seconds.", sendername); SendClientMessage(suspect, COLOR_LIGHTBLUE, string); format(string, sizeof(string), "* You Tazed %s for 12 seconds.", giveplayer); SendClientMessage(playerid, COLOR_LIGHTBLUE, string); if(PlayerInfo[suspect][pSex] == 1) format(string, sizeof(string), "* %s shoots with his Tazer at %s, and tazed him.", sendername ,giveplayer); if(PlayerInfo[suspect][pSex] == 2) format(string, sizeof(string), "* %s shoots with her Tazer at %s, and tazed him.", sendername ,giveplayer); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); GameTextForPlayer(suspect, "~r~Tazed", 2500, 3); TogglePlayerControllable(suspect, 0); PlayerCuffed[suspect] = 1; PlayerCuffedTime[suspect] = 12; TazerReload[playerid] = 1; GetPlayerPos(suspect, PlayerXbust[suspect], PlayerYbust[suspect], PlayerZbust[suspect]); LoopingAnim(suspect, "ROB_BANK","SHP_HandsUp_Scr", 4.0, 0, 1, 1, 1, 0); } else { SendClientMessage(playerid, COLOR_GREY, " No-one near you!"); return 1; } } } else { SendClientMessage(playerid, COLOR_GREY, " You are not a Cop / FBI / National Guard !"); } } return 1; }
You can't do this with a simple command, or regular players.
You will need to use OnPlayerKeyStateChange(...) if(newkeys & KEY_FIRE). etc. |
This forum requires that you wait 120 seconds between posts. Please try again in 19 seconds. |