14.02.2012, 19:21
Hi all!
I made this explode CMD, wanted to ask, with which function should I reduce the player's health for 25?
'Cause the explosion itself won't cause any damage, so how can I set the player's health for 25 lower? I already thought about "SetPlayerHealth", but this wouldn't work, right?
I made this explode CMD, wanted to ask, with which function should I reduce the player's health for 25?
'Cause the explosion itself won't cause any damage, so how can I set the player's health for 25 lower? I already thought about "SetPlayerHealth", but this wouldn't work, right?
PHP код:
CMD:explode(playerid,params[])
{
if(PlayerInfo[playerid][pAdmin] >= 5)
{
new Target;
if(sscanf(params, "u", Target)) SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /explode [playerid]");
if(!IsPlayerConnected(Target))
return SendClientMessage(playerid, COLOR_GREY, "ERROR:Player is not connected!");
if(!sscanf(params, "u", Target))
{
//if(Target == playerid) return SendClientMessage(playerid, COLOR_RED, "SERVER: Cant perform this command on yourself!" );
if(Target == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_RED,"ERROR: Wrong player ID");
//if(PlayerAcc[Target][AdminLevel] >= PlayerAcc[playerid][AdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cant perform this on Admins that are equal or higher than your level!");
new Float:X;
new Float:Y;
new Float:Z;
GetPlayerPos(Target,X,Y,Z);
CreateExplosion(X,Y,Z,1,10);
new tname[MAX_PLAYER_NAME];
GetPlayerName(Target,tname,sizeof(tname));
new pname[MAX_PLAYER_NAME];
GetPlayerName(Target,pname,sizeof(pname));
new pstring[256];
new tstring[256];
new astring[256];
format(pstring,sizeof(pstring),"You have exploded player %s(%d)",tname,Target);
format(tstring,sizeof(tstring),"Administrator %s has exploded you!",pname);
format(astring,sizeof(astring),"Administrator %s has exploded %s!",pname,tname);
SendClientMessage(playerid,COLOR_LIGHTBLUE,pstring);
SendClientMessage(playerid,TEAM_GROVE_COLOR,tstring);
SendClientMessageToAll(COLOR_GOLD,astring);
}
}
else return SendClientMessage(playerid,COLOR_RED,"ERROR: You must be level 5 to use this command!");
return 1;
}