Actual /god -
Sellize - 25.08.2013
How can I make a player actually have godmode? Not like setting their health to 99999 cause that can eventually go down
Re: Actual /god -
Cypress - 25.08.2013
There isn't any other way of doing it. If you set health to infinity, doubt it can go down.
Re: Actual /god -
JeaSon - 25.08.2013
hm
this ?
pawn Код:
COMMAND:godmode(playerid, params[])
{
#define INFINITY (Float:0x7F800000)
SendClientMessage(playerid, 0xFFFFFFFF,"Godmode has been actived.");
SetPlayerHealth (playerid,INFINITY);
return 1;
}
Re: Actual /god -
ProjectMan - 25.08.2013
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.
Re: Actual /god -
JaKe Elite - 25.08.2013
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.
Re: Actual /god -
Cypress - 25.08.2013
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.
Re: Actual /god -
MrCathal09 - 25.08.2013
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
Re: Actual /god -
Konstantinos - 25.08.2013
Quote:
Originally Posted by MrCathal09
I died after a 1000 meter drop
|
I used it without the float tag before:
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!
Re: Actual /god -
ProjectMan - 25.08.2013
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.
AW: Re: Actual /god -
NaS - 25.08.2013
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...).