How can i make a /god command for players?
#8

For one /god command:

pawn Код:
new bool:GodModeActive[MAX_PLAYERS];

public OnPlayerSpawn(playerid)
{
    if(GodModeActive[playerid] ? SetPlayerHealth(playerid, (Float:0x7F800000)) : SetPlayerHealth(playerid, 100.0)) {}
    return 1;
}

CMD:god(playerid, params[])
{
    //if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "You are not an admin."); //Change this to your admin variable.
    //Uncomment the line above if you want to restrict this command to admins only.
    if(GodModeActive[playerid])
    {
        GodModeActive[playerid] = false;
        SendClientMessage(playerid, -1, "God mode disabled.");
        SetPlayerHealth(playerid, 100.0);
    }
    else if(!GodModeActive[playerid])
    {
        GodModeActive[playerid] = true;
        SendClientMessage(playerid, -1, "God mode activated.");
        SetPlayerHealth(playerid,(Float:0x7F800000));
    }
    return 1;
}
Reply


Messages In This Thread
How can i make a /god command for players? - by Mckarlis - 06.03.2014, 21:50
Re: How can i make a /god command for players? - by Abagail - 06.03.2014, 21:56
Re: How can i make a /god command for players? - by XK - 06.03.2014, 21:59
Re: How can i make a /god command for players? - by Mckarlis - 06.03.2014, 22:05
Re: How can i make a /god command for players? - by XK - 06.03.2014, 22:07
Re: How can i make a /god command for players? - by XK - 06.03.2014, 22:10
Re: How can i make a /god command for players? - by Mckarlis - 06.03.2014, 22:10
Re: How can i make a /god command for players? - by Threshold - 07.03.2014, 01:19

Forum Jump:


Users browsing this thread: 1 Guest(s)