if(newkeys & KEY_FIRE) { new string[128], giveplayerid; if(GotTazer[playerid] == 1 && arrFaction[playerid][p_iMember] > 0) { if(IsPlayerConnected(giveplayerid)) { if(ProxDetectorS(3.0, playerid,giveplayerid)) { if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_WHITE, "You cannot stun yourself, you must get closer to your victim!"); } 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); return 1; } } } } |
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid)
{
if(GotTazer[playerid] == 1 && arrFaction[playerid][p_iMember] > 0)
{
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);
}
return 1;
}
SetPlayerAttachedObject(playerid, 0, 18642, 6, 0.06, 0.01, 0.08, 180.0, 0.0, 0.0); |
if(giveplayerid == playerid)
{
SendClientMessage(playerid, COLOR_WHITE, "You cannot stun yourself, you must get closer to your victim!");
}
if(giveplayerid == playerid)
{
SendClientMessage(playerid, COLOR_WHITE, "You cannot stun yourself, you must get closer to your victim!");
return true;
}
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) { giveplayerid = i; result = true; } } if(result == true) { if(ProxDetectorS(3.0, playerid,giveplayerid)) { if(giveplayerid == playerid) return SendClientMessage(playerid, COLOR_WHITE, "You cannot stun yourself, you must get closer to your victim!"); 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; } } } }
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!"); } }
else return SendClientMessage(playerid, COLOR_WHITE, "No one is near you!");
Oh,didn't notice.
thanks for fixing me ... btw Код:
else return SendClientMessage(playerid, COLOR_WHITE, "No one is near you!"); |
No, this wont, because if it doesn't find anyone after its loop, it will return the message, it's not returning every time it doesn't find a player.
|