Actual /god
#1

How can I make a player actually have godmode? Not like setting their health to 99999 cause that can eventually go down
Reply
#2

There isn't any other way of doing it. If you set health to infinity, doubt it can go down.
Reply
#3

hm

this ?

pawn Код:
COMMAND:godmode(playerid, params[])
{
 #define INFINITY   (Float:0x7F800000)
 SendClientMessage(playerid,  0xFFFFFFFF,"Godmode has been actived.");
 SetPlayerHealth (playerid,INFINITY);
 return 1;
}
Reply
#4

pawn Код:
new GodModeOn[MAX_PLAYERS+1];
Assuming you use the default SA-MP commands processor:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/god", cmdtext, true, 10) == 0)
    {
        if (GodModeOn[playerid] == 0)
                {
                 GodModeOn[playerid] = 1;
                 SendClientMessage(playerid, -1, "God Mode is turned ON");
                 }
                 else
                 {
                 GodModeOn[playerid] = 0;
                 SetPlayerHealth(playerid, 100);
                 SendClientMessage(playerid, -1, "God Mode is turned OFF");
                 }            
        return 1;
    }
    return 0;
}
pawn Код:
public OnPlayerUpdate(playerid)
{
        if (IsPlayerConnected(playerid) == 1 && GodModeOn[playerid] == 1 && GetPlayerHealth(playerid) < 99999)
        {
        SetPlayerHealth(playerid, 99999);
        }
    return 1;
}
pawn Код:
public OnPlayerDisconnect(playerid)
{
      GodModeOn[playerid] = 0;
      return 1;
}
This is one of the many ways to do it.
Reply
#5

Don't use the above method.
Use this which is pure god no matter what the player do, You still alive.

pawn Код:
#define INFINITY   (Float:0x7F800000)
Then SetPlayerHealth, the health value is INFINITY

Note: Yes this code is the same with Namer, But i'm lazy to check for pure god script in my script so i copy his code since that's the code i'm using in JakAdmin's /god.
Reply
#6

Quote:
Originally Posted by ProjectMan
Посмотреть сообщение
pawn Код:
new GodModeOn[MAX_PLAYERS+1];
Assuming you use the default SA-MP commands processor:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/god", cmdtext, true, 10) == 0)
    {
        if (GodModeOn[playerid] == 0)
                {
                 GodModeOn[playerid] = 1;
                 SendClientMessage(playerid, -1, "God Mode is turned ON");
                 }
                 else
                 {
                 GodModeOn[playerid] = 0;
                 SetPlayerHealth(playerid, 100);
                 SendClientMessage(playerid, -1, "God Mode is turned OFF");
                 }            
        return 1;
    }
    return 0;
}
pawn Код:
public OnPlayerUpdate(playerid)
{
        if (IsPlayerConnected(playerid) == 1 && GodModeOn[playerid] == 1 && GetPlayerHealth(playerid) < 99999)
        {
        SetPlayerHealth(playerid, 99999);
        }
    return 1;
}
pawn Код:
public OnPlayerDisconnect(playerid)
{
      GodModeOn[playerid] = 0;
      return 1;
}
This is one of the many ways to do it.
And the worse one because of using OnPlayerUpdate. You can set players health every 5 minutes according if he is receiving damage. In some milliseconds, it's impossible to get off the 9999999 health.
Reply
#7

Quote:
Originally Posted by _Jake_
Посмотреть сообщение
Don't use the above method.
Use this which is pure god no matter what the player do, You still alive.

pawn Код:
#define INFINITY   (Float:0x7F800000)
Then SetPlayerHealth, the health value is INFINITY

Note: Yes this code is the same with Namer, But i'm lazy to check for pure god script in my script so i copy his code since that's the code i'm using in JakAdmin's /god.
I died after a 1000 meter drop
Reply
#8

Quote:
Originally Posted by MrCathal09
Посмотреть сообщение
I died after a 1000 meter drop
I used it without the float tag before:
pawn Код:
0x7F800000
And when I fell from 10000 meters or feet (whatever it is), I did not die. Infinite float is what you need for godmode, no matter if it flashes!
Reply
#9

Quote:
Originally Posted by _Jake_
Посмотреть сообщение
Don't use the above method.
Use this which is pure god no matter what the player do, You still alive.

pawn Код:
#define INFINITY   (Float:0x7F800000)
Then SetPlayerHealth, the health value is INFINITY

Note: Yes this code is the same with Namer, But i'm lazy to check for pure god script in my script so i copy his code since that's the code i'm using in JakAdmin's /god.
OnPlayerUpdate is meant to be used.
Reply
#10

Quote:
Originally Posted by ProjectMan
Посмотреть сообщение
OnPlayerUpdate is meant to be used.
Sure it is, but not for complex actions. Also, SetPlayerHealth forces the player to send an update, which will result in more frequent player updates.
Just use SetPlayerHealth(playerid, 999999999.0); (Or INFINITY as stated above) ONCE and I will bet 10$ that you will not die from anything (shots, falling, explosions, etc...).
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)