02.11.2014, 10:35
pawn Код:
CMD:nuke(playerid,params[])
{
new string[150];
if(InDMArena[playerid] == 1) return SCM(playerid, red, "[ERROR]"COL_WHITE" You cannot use this command while in the DM stadium.");
if(gTeam[playerid] != TEAM_TFH) return SCM(playerid, red, "[ERROR]"COL_WHITE" Only horsemen can nuke players.");
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER or GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
{
SendClientMessage(playerid,COLOR_ERROR,"[ERROR]"COL_WHITE" You cannot burn someone while in a vehicle. Exit the vehicle first.");
return 1;
}
if(HasNukedRecently[playerid] >= 1)
{
format(string, sizeof(string),"[ERROR]"COL_WHITE" Please wait "COL_RED"%d seconds"COL_WHITE" before burning someone again.",HasNukedRecently[playerid]);
SCM(playerid,red,string);
return 1;
}
if(pInfo[playerid][XP] < 2000)
{
return SCM(playerid,red,"[ERROR]"COL_WHITE" Insufficient XP (2000)");
}
foreach(Player, i)
{
if(GetDistanceBetweenPlayers(playerid,i) <= 4 and i != playerid)
{
new Float:ARMOUR, Float:HEALTH;
GetPlayerArmour(playerid, ARMOUR);
GetPlayerHealth(playerid, HEALTH);
HasNukedRecently[playerid] =500;
new xp = pInfo[playerid][XP];
pInfo[playerid][XP] =xp-2000;
new Float:x, Float:y, Float:z;
if(aDuty[i] == 0 and gTeam[i] != TEAM_TFH)
{
GetPlayerPos(i, x, y, z);
CreateExplosion(x, y , z + 2, 1, 10);
SetPlayerHealth(i, 0);
format(Jstring,sizeof(Jstring),"[NUKE]"COL_WHITE" Horseman %s[%d] has used his/her nuke abillity.",GetName(playerid),playerid);
SendClientMessageToAll(COLOR_TFH,Jstring);
format(Jstring, sizeof(Jstring),"[NUKED]"COL_WHITE" %s[%d] has been killed by horseman %s[%d]'s nuke abillity.", GetName(i), i, GetName(playerid), playerid);
SCMToAll(red, Jstring);
SetPlayerArmour(playerid, ARMOUR);
SetPlayerHealth(playerid, HEALTH);
}
return 1;
}
return SCM(playerid, red, "[ERROR]"COL_WHITE" No player is in range.");
}
return 1;
}
How can I fix this?
The main point of this CMD is when players are in range, they get killed with an explosion. But the player (who nuked others) won't. And also, aDuty (admins) and TFH team members should also not get killed.