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

i have made this now:
first of all add this near the other enums and news:
pawn Код:
new Godmode[MAX_PLAYERS];
Under OnPlayerConnect
pawn Код:
Godmode[playerid] = 0;
and the command:
if you want the command only for admins:
pawn Код:
CMD:god(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 1 && IsPlayerConnected(playerid))
    {
        if(Godmode[playerid] == 0)
        {
            Godmode[playerid] = 1;
            SetPlayerHealth(playerid, 99999);
            SetPlayerArmour(playerid, 99999);
            SendClientMessage(playerid, -1, "You have enabled the god mode");
        }
        if(Godmode[playerid] == 1)
        {
            Godmode[playerid] = 0;
            SetPlayerHealth(playerid, 100);
            SetPlayerArmour(playerid, 0);
            SendClientMessage(playerid, -1, "You have disabled the god mode");
        }
    }
    else
    {
        SendClientMessage(playerid, -1, "You are not an admin");
    }
    return 1;
}
and for all of the players:
pawn Код:
CMD:god(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        if(Godmode[playerid] == 0)
        {
            Godmode[playerid] = 1;
            SetPlayerHealth(playerid, 99999);
            SetPlayerArmour(playerid, 99999);
            SendClientMessage(playerid, -1, "You have enabled the god mode");
        }
        if(Godmode[playerid] == 1)
        {
            Godmode[playerid] = 0;
            SetPlayerHealth(playerid, 100);
            SetPlayerArmour(playerid, 0);
            SendClientMessage(playerid, -1, "You have disabled the god mode");
        }
    }
    else
    {
        SendClientMessage(playerid, -1, "You are not logged in");
    }
    return 1;
}
and under OnPlayerTakeDamage:
0.3z
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
        if(Godmode[playerid] == 1) return 0;
}
0.3x:
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
        if(Godmode[playerid] == 1) return 0;
}
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)