13.02.2014, 15:48
Hey everyone,
I've currently got a godmode command which makes the player not die when falling or being shot, but it doesn't work when the player crashes his airplane, or if he stays inside a car that is exploding.
I'm currently both using OnPlayerTakeDamage AND OnPlayerUpdate to check if the player is getting damaged.
And here is the command that enables/disables godmode:
Any solutions?
I've currently got a godmode command which makes the player not die when falling or being shot, but it doesn't work when the player crashes his airplane, or if he stays inside a car that is exploding.
I'm currently both using OnPlayerTakeDamage AND OnPlayerUpdate to check if the player is getting damaged.
Код HTML:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
if (GodMode[playerid] == 1)
{
SetPlayerHealth(playerid, 0x7F800000);
}
return 1;
}
Код HTML:
public OnPlayerUpdate(playerid)
{
if (GodMode[playerid] == 1)
{
SetPlayerHealth(playerid, 0x7F800000);
}
return 1;
}
Код HTML:
if (strcmp("/godmode", cmdtext, true, 10) == 0)
{
SendClientMessage(playerid, 0xFF0000AA, "USAGE: Use /godmode [on/off].");
return 1;
}
if (strcmp("/godmode on", cmdtext, true, 11) == 0)
{
if (Administrator[playerid] == 1)
{
SetPlayerHealth(playerid, 0x7F800000);
GodMode[playerid] = 1;
SendClientMessage(playerid, COLOR_GREEN, "Godmode enabled, use /godmode off to disable it.");
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "You need to be an administrator to enable Godmode!");
}
return 1;
}
if (strcmp("/godmode off", cmdtext, true, 12) == 0)
{
if (Administrator[playerid] == 1)
{
SetPlayerHealth(playerid, 100);
GodMode[playerid] = 0;
SendClientMessage(playerid, COLOR_GREEN, "Godmode disabled, use /godmode on to enable it.");
}
return 1;
}

