SA-MP Forums Archive
Issue with 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: Issue with God Mode (/showthread.php?tid=386993)



Issue with God Mode - UnknownGamer - 22.10.2012

pawn Код:
CMD:zgod(playerid, params[])
{
    SetPlayerHealth(playerid, 99999);
    SetPlayerArmour(playerid, 99999);
    usergod = 1;
    GameTextForPlayer(playerid,"~w~GOD MODE: ~r~ON!",5000,5);
    return 1;
}
else if(usergod != 0)
{
    SetPlayerHealth(playerid, 100);
    SetPlayerArmour(playerid, 0);
    usergod = 0;
    GameTextForPlayer(playerid,"~w~GOD MODE: ~r~OFF!",5000,5);
    return 1;
}
C:\Users\matt\Desktop\NG; LS-RP\gamemodes\gbrp.pwn(47) : error 010: invalid function or declaration
C:\Users\matt\Desktop\NG; LS-RP\gamemodes\gbrp.pwn(53) : error 010: invalid function or declaration


Re: Issue with God Mode - gtakillerIV - 22.10.2012

This one should work:

PHP код:
CMD:zgod(playeridparams[])
{
    if(
usergod == 0)
    {
        
SetPlayerHealth(playerid99999);
        
SetPlayerArmour(playerid99999);
        
usergod 1;
        
GameTextForPlayer(playerid,"~w~GOD MODE: ~r~ON!",5000,5);
    }
    else if(
usergod == 1)
    {
        
SetPlayerHealth(playerid100);
        
SetPlayerArmour(playerid0);
        
usergod 0;
        
GameTextForPlayer(playerid,"~w~GOD MODE: ~r~OFF!",5000,5);
    }
    return 
1;

You should return 1 at the end of the code like I did.


Re: Issue with God Mode - SumX - 22.10.2012

Quote:
Originally Posted by gtakillerIV
Посмотреть сообщение
This one should work:

PHP код:
CMD:zgod(playeridparams[])
{
    if(
usergod == 0)
    {
        
SetPlayerHealth(playerid99999);
        
SetPlayerArmour(playerid99999);
        
usergod 1;
        
GameTextForPlayer(playerid,"~w~GOD MODE: ~r~ON!",5000,5);
    }
    else if(
usergod == 1)
    {
        
SetPlayerHealth(playerid100);
        
SetPlayerArmour(playerid0);
        
usergod 0;
        
GameTextForPlayer(playerid,"~w~GOD MODE: ~r~OFF!",5000,5);
    }
    return 
1;

You should return 1 at the end of the code like I did.
That's not godmode!
Try this:


PHP код:
#define INFINITY                (Float:0x7F800000)
CMD:zgod(playeridparams[])
{
    if(
usergod == 0)
    {
        
SetPlayerHealth(playeridINFINITY);
        
SetPlayerArmour(playeridINFINITY);
        
usergod 1;
        
GameTextForPlayer(playerid,"~w~GOD MODE: ~r~ON!",5000,5);
    }
    else if(
usergod == 1)
    {
        
SetPlayerHealth(playerid100);
        
SetPlayerArmour(playerid0);
        
usergod 0;
        
GameTextForPlayer(playerid,"~w~GOD MODE: ~r~OFF!",5000,5);
    }
    return 
1;




Re: Issue with God Mode - gtakillerIV - 22.10.2012

I edited his code since he wants the player's health to be set to 9999, and next time don't edit my code!