SA-MP Forums Archive
Just a quick question. (+REP to 1st to answer) - 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: Just a quick question. (+REP to 1st to answer) (/showthread.php?tid=331852)



Just a quick question. (+REP to 1st to answer) - JonesyFoCoTDM - 06.04.2012

I'm looking to give myself god mode in my script, but can't find the code. Can anyone help me? Thanks in advance.


Re: Just a quick question. (+REP to 1st to answer) - FalconX - 06.04.2012

Quote:
Originally Posted by JonesyFoCoTDM
Посмотреть сообщение
I'm looking to give myself god mode in my script, but can't find the code. Can anyone help me? Thanks in advance.
You can easily set your health like this:-

pawn Код:
SetPlayerHealth(playerid, 999999); //this sets your health to 999999 i.e unlimited.
You can make a command and put the above function in it. For restoring the health you can always use the same function and use 100 instead of 999999.

Or if you are looking for something in your script, just use CTRL + F to find what ever you are looking for.

Hope this helps?

-FalconX


Re: Just a quick question. (+REP to 1st to answer) - JonesyFoCoTDM - 06.04.2012

Yeah, I thought of doing that myself. But I've been on other servers where they've had commands such as /god making them impossible to kill. Does "999999" do that then? Thanks for the quick response by the way.


Re: Just a quick question. (+REP to 1st to answer) - Dan. - 06.04.2012

If you cant find it, you may do it by yourself.
When you are using ZCMD, then you may add this to your gamemode:

pawn Код:
CMD:god(playerid, params[])
{
        SetPlayerHealth(playerid, 999999);
        SetPlayerArmour(playerid, 999999);
        SendClientMessage(playerid, C_GREEN, "You are now in godmode, good luck!");
        SetPlayerColor(playerid, C_BLACK);
        return 1;
}
It is actually quite hard, to kill someone with this health.



Re: Just a quick question. (+REP to 1st to answer) - FalconX - 06.04.2012

Quote:
Originally Posted by JonesyFoCoTDM
Посмотреть сообщение
Yeah, I thought of doing that myself. But I've been on other servers where they've had commands such as /god making them impossible to kill. Does "999999" do that then? Thanks for the quick response by the way.
Yes mate, "999999" makes your health unlimited which ultimately makes you GOD . If you are looking for someone to make a command then leave a reply I will help you.

EDIT:

I have edited Dan's command and added a thing which is useful.

pawn Код:
new IsEnabled[MAX_PLAYERS]; // on the beginning of your script

IsEnabled[playerid] = 0; // put this on OnPlayerConnect and OnPlayerDisconnect.

CMD:godmod(playerid, params[])
{
    if(IsEnabled[playerid] == 0)
    {
        SetPlayerHealth(playerid, 999999);
        SetPlayerArmour(playerid, 999999);
        SendClientMessage(playerid, -1, "You have enabled the GOD-MOD, type the command again to disable it.");
        IsEnabled[playerid] = 1;
    }
    else
    {
        SendClientMessage(playerid, -1, "You have disabled the GOD-MOD, type the command again to enable it.");
        IsEnabled[playerid] = 0;
        SetPlayerHealth(playerid, 100);
        SetPlayerArmour(playerid, 0);
    }
    return 1;
}
-FalconX


Re: Just a quick question. (+REP to 1st to answer) - JonesyFoCoTDM - 06.04.2012

I've made the command, thanks for the help guys, much appreciated.


Re: Just a quick question. (+REP to 1st to answer) - FalconX - 06.04.2012

Quote:
Originally Posted by JonesyFoCoTDM
Посмотреть сообщение
I've made the command, thanks for the help guys, much appreciated.
Anytime mate (:

-FalconX