Explode cmd
#4

pawn Код:
CMD:explode(playerid,params[])
{
    if(PlayerInfo[playerid][Admin] >= 1 || IsPlayerAdmin(playerid))
    {
        if(isnull(params)) return SendClientMessage(playerid, RED, "/explode [target]");
        else
        {
            if(!IsPlayerConnected(strval(params)) || strval(params) == INVALID_PLAYER_ID) return SendClientMessage(playerid, RED, "Target ID is not valid.");
            new Float:X, Float:Y, Float:Z, Float:ohp, Float:oar, Float:nhp, Float:nar;
            GetPlayerPos(strval(params), X, Y, Z);
            GetPlayerHealth(strval(params), ohp);
            GetPlayerArmour(strval(params), oar);
            CreateExplosion(X, Y, Z, 7, 500);
            SendClientMessage(playerid, -1, "Target has been exploded. Checking results...");
            GetPlayerHealth(strval(params), nhp);
            GetPlayerArmour(strval(params), nar);
            if(floatcmp(ohp, nhp) == 0) SendClientMessage(playerid, -1, "Target's armour did not change.");
            if(floatcmp(nar, oar) == -1) SendClientMessage(playerid, -1, "Target's armour changed.");
            if(floatcmp(ohp, nhp)== 0)  SendClientMessage(playerid, -1, "Target's health did not change.");
            if(floatcmp(nhp, ohp) == -1) SendClientMessage(playerid, -1, "Target's health changed.");
            new stra[110];
            format(stra,sizeof(stra), "(ADMIN) %s(%d) (level: %d) has exploded %s(%d). (/explode)", PlayerName(playerid), playerid, PlayerInfo[playerid][Admin], PlayerName(strval(params)), strval(params));
            SendAdminMessage(stra, 1);
            stra = "\0";
        }
    }
    else return SendClientMessage(playerid, RED, "Access Denied. Admin level 1 is required to use this command.");
    return 1;
}
I used:

https://sampwiki.blast.hk/wiki/Floatcmp

Think it might be that.
Reply


Messages In This Thread
Explode cmd - by LocMax - 05.04.2014, 07:16
Re: Explode cmd - by Dokins - 05.04.2014, 07:50
Re: Explode cmd - by LocMax - 05.04.2014, 07:54
Re: Explode cmd - by Dokins - 05.04.2014, 08:52
Re: Explode cmd - by LocMax - 05.04.2014, 08:56
Re: Explode cmd - by Dokins - 05.04.2014, 09:06
Re: Explode cmd - by LocMax - 05.04.2014, 09:19
Re: Explode cmd - by Dokins - 05.04.2014, 09:22
Re: Explode cmd - by PrivatioBoni - 05.04.2014, 09:34

Forum Jump:


Users browsing this thread: 3 Guest(s)