08.10.2012, 17:53
The codes of Skillet are pretty good but need modification:
It's better where I placed i != playerid, because in the codes of Skillet, the result will always be playerid if he has a lower id then the victim.
Код:
if(newkeys & KEY_FIRE) { if(GotTazer[playerid] == 1 && arrFaction[playerid][p_iMember] > 0) { new Float:x,Float:y,Float:z,giveplayerid,bool:result = false,i = -1; GetPlayerPos(playerid,x,y,z); while(i < MAX_PLAYERS) { i++; if(IsPlayerInRangeOfPoint(i,3.0,x,y,z) && i != playerid) //You were missing a closing ) { giveplayerid = i; result = true; break; } } if(result == true) { if(ProxDetectorS(3.0, playerid,giveplayerid)) { new string[128]; TogglePlayerControllable(giveplayerid, 0); format(string, sizeof(string), "*%s stuns %s with the tazer.", GetPlayerNameEx(playerid),GetPlayerNameEx(giveplayerid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE); result = false; return 1; } } else return SendClientMessage(playerid, COLOR_WHITE, "No one is near you!"); } }