SA-MP Forums Archive
god mode on /off - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: god mode on /off (/showthread.php?tid=46066)



god mode on /off - pepp1 - 05.08.2008

how can I do that (godemode on, godemode off?)
plz help


Re: god mode on /off - Puffmac - 05.08.2008

To make the health unlimited set it to some extremely high number, like 10000000000000.


Re: god mode on /off - Dragan - 05.08.2008

When you make command /godmodeon
Write down SetPlayerHealth(playerid,100000000.0);

When you make command /godemodeoff
Write down SwtPlayerHealth(playerid,100.0);


Re: god mode on /off - GTAgetaway - 16.01.2009

Quote:
Originally Posted by Dragan
When you make command /godmodeon
Write down SetPlayerHealth(playerid,100000000.0);

When you make command /godemodeoff
Write down SwtPlayerHealth(playerid,100.0);
Is it SwtPlayerHealth(playerid,100.0);


Re: god mode on /off - flames - 16.01.2009

on /godmodeon and getplayerhealth <=100 {

setplayerhealth to 10000
}

on /godmodeoff and getplayerhealth >100 {
setplayerhealth to 100
}


Re: god mode on /off - DMSOrg - 16.01.2009

flames forget the <100 this is an admin command so it dont really matter

here's the complete code for OnPlayerCommandText:
Код:
if(strcmp(cmdtext,"/godmodeon",true) == 0)
{
  SetPlayerHealth(playerid,100000.0);
}

if(strcmp(cmdtext,"/godmodeoff",true) == 0)
{
  SetPlayerHealth(playerid,100.0);
}



Re: god mode on /off - Mariooo - 17.07.2011

How to make it for admins only?


Re: god mode on /off - robintjeh - 17.07.2011

Easy. This only works for RCON admin.

pawn Код:
if(strcmp(cmdtext,"/godmodeon",true) == 0)
{
  if(!IsPlayerAdmin(playerid)) return 1;
  SetPlayerHealth(playerid,100000.0);
}

if(strcmp(cmdtext,"/godmodeoff",true) == 0)
{
  if(!IsPlayerAdmin(playerid)) return 1;
  SetPlayerHealth(playerid,100.0);
}



Re: god mode on /off - Wesley221 - 17.07.2011

pawn Код:
//Out of any callback, down the defines
new GodMode[MAX_PLAYERS] = 0;
new GMTimer;

//ZCMD command, outside any callback
COMMAND:godmode(playerid, cmdtext[])
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "Youre not admin!");
    if(GodMode[playerid] == 0)
    {
        GMTimer = SetTimerEx("GodMod", 1500, true, "i", playerid);
        SetPlayerHealth(playerid, 10000);
        SendClientMessage(playerid, -1, "God mode is now on");
        GodMode[playerid] = 1;
    }
    else
    {
        KillTimer(GMTimer);
        SetPlayerHealth(playerid, 100);
        SendClientMessage(playerid, -1, "God mode is now off");
        GodMode[playerid] = 0;
    }
    return 1;
}

//Forward and public, out of any callback aswell
forward GodMod(playerid);
public GodMod(playerid)
{
    SetPlayerHealth(playerid, 10000);
    return 1;
}
Try this one, also im not sure if it gives any errors


Re: god mode on /off - Kush - 17.07.2011

pawn Код:
CMD:gmodeon(playerid, params[]) //god mode on command
{
    if(IsPlayerAdmin(playerid))
    {
        SetPlayerHealth(playerid, 100000);
        SetPlayerArmour(playerid, 100000);
    }
    else
    {
        SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command!");
    }
    return 1;
}

CMD:gmodeoff(playerid, params[]) //god mode off command
{
    if(IsPlayerAdmin(playerid))
    {
        SetPlayerHealth(playerid, 100);
        SetPlayerArmour(playerid, 100);
    }
    else
    {
        SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command!");
    }
    return 1;
}
Simple enough.