SA-MP Forums Archive
God mode - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: God mode (/showthread.php?tid=355140)



God mode - grantism - 29.06.2012

How could i make a command like /god that when I activate it, i won't loose health? Sounds simple ish but not really sure.


Re: God mode - [A]ndrei - 29.06.2012

i dont know if you want it for admin or not but here

Код:
    if(strcmp(cmd, "/god", true) == 0)
    {
        GetPlayerName(playerid, AdminName, sizeof(playername));
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pAdmin] >= 1)
            {
                if(PlayerInfo[playerid][pAOnDuty] == 0)
                {
                    SetPlayerColor(playerid, COLOR_LIGHTBLUE);
                    PlayerInfo[playerid][pAOnDuty] = 1;
                    SendClientMessage(playerid, COLOR_GRAD2, "You are now on-duty as an admin, Please do your best!.");
                    SetPlayerHealth(playerid, 100);
                    SetPlayerArmour(playerid, 100);
                    format(string, sizeof(string), "%s is now on-duty as an admin.", AdminName);
                    SendClientMessageToAll(COLOR_YELLOW, string);
                    return 1;
                }
                else
                {
                    SetPlayerColor(playerid, COLOR_INVIS);
                    PlayerInfo[playerid][pAOnDuty] = 0;
                    SendClientMessage(playerid, COLOR_GRAD2, "You are not longer on-duty as admin, notice to /reports please!.");
                    SetPlayerHealth(playerid, 100);
                    SetPlayerArmour(playerid, 0);
                    format(string, sizeof(string), "%s is no longer on-duty as admin.", AdminName);
                    SendClientMessageToAll(COLOR_YELLOW, string);
                    return 1;
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   you are not authorized to use that command!");
            }
        }
        return 1;
    }
And put this one top
Код:
    new AdminName[MAX_PLAYER_NAME];



Re: God mode - grantism - 29.06.2012

That isn't what i wanted..


Re: God mode - [A]ndrei - 29.06.2012

O_o then give more deatails please.


Re: God mode - Chris1337 - 29.06.2012

Quote:
Originally Posted by grantism
Посмотреть сообщение
That isn't what i wanted..
I Hate this response .... so you ask for help without any suggestion and then you get mad..


Re: God mode - grantism - 29.06.2012

Quote:
Originally Posted by [A]ndrei
Посмотреть сообщение
O_o then give more deatails please.
I want a command that when you type /god you won't take damage.
Quote:
Originally Posted by axxelac
Посмотреть сообщение
I Hate this response .... so you ask for help without any suggestion and then you get mad..
If you read.. It says what i want, also, who said I was mad..


Re: God mode - kbalor - 29.06.2012

Quote:
Originally Posted by grantism
Посмотреть сообщение
I want a command that when you type /god you won't take damage.


If you read.. It says what i want, also, who said I was mad..
Here..

Код HTML:
CMD:god(playerid, params[])
{
    if(GodMode[playerid] == 0) //god mode not set, lets set it
    {
        SetPlayerHealth(playerid, INFINITY);    //set the health to infinity
        GodMode[playerid] = 1;    //set godmode to true
        SendClientMessage(playerid, 0xFF0000FF, "God mode Enabled");

    }
    else if(GodMode[playerid] == 1) //god mode set .. lets unset it
    {
        SetPlayerHealth(playerid, 100.0);    //set health to 100%
        GodMode[playerid] = 0;    //set godmode to false
        SendClientMessage(playerid, 0xFF0000FF, "God mode Disabled");
    }
    return 1;
}
If you type /god it will disabled the God mode.


Re: God mode - grantism - 29.06.2012

Cheers mate. + rep