[PROBLEM]How to stay invincible during vehicle explosions
#1

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.

Код 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;
}
And here is the command that enables/disables godmode:

Код 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;
	}
Any solutions?
Reply
#2

Quote:
Originally Posted by AnthonyTimmers
Посмотреть сообщение
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.

Код 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;
}
And here is the command that enables/disables godmode:

Код 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;
	}
Any solutions?
When enabling it do SetPlayerHealth(playerid, 100000);
Reply
#3

Tried it, it still kills me.
Reply
#4

Quote:
Originally Posted by AnthonyTimmers
Посмотреть сообщение
Tried it, it still kills me.
Well i think its can't be changed. It's an original GTA SA Bug. Or maybe it can be changed but idk. I'm sorry i can't help you.
Reply
#5

Or you can also add when /godmode if in a car. a godcar. so the car doesn't explodes at all?
Reply
#6

Tried

Код HTML:
public OnPlayerDeath(playerid, killerid, reason)
{
	if (GodMode[playerid] == 1)
	{
    	SetPlayerHealth(playerid, 0x7F800000);
	}
    else
    {
    	PlayerInfo[killerid][pKills]++;
    	PlayerInfo[playerid][pDeaths]++;
	}
    return 1;
}
Doesn't work either :<
And it's okay, thanks for trying though, haha
Reply
#7

Quote:
Originally Posted by AnthonyTimmers
Посмотреть сообщение
Tried

Код HTML:
public OnPlayerDeath(playerid, killerid, reason)
{
	if (GodMode[playerid] == 1)
	{
    	SetPlayerHealth(playerid, 0x7F800000);
	}
    else
    {
    	PlayerInfo[killerid][pKills]++;
    	PlayerInfo[playerid][pDeaths]++;
	}
    return 1;
}
Doesn't work either :<
And it's okay, thanks for trying though, haha
And do you mean near a car or when in a car?
Reply
#8

For vehicles you need to make a timer healing the vehicle at least each 4-5 seconds. Or set the vehicle's health to 10000000.0 if the player gets into a vehicle.
It's not possible to prevent the player from dying if the vehicle explodes, the plane explodes isntantly when crashing.
Reply
#9

Quote:
Originally Posted by NaS
Посмотреть сообщение
For vehicles you need to make a timer healing the vehicle at least each 4-5 seconds. Or set the vehicle's health to 10000000.0 if the player gets into a vehicle.
It's not possible to prevent the player from dying if the vehicle explodes, the plane explodes isntantly when crashing.
That's what i said xD
Reply
#10

Alright, I guess it's not possible then on SA-MP, it'll do, though.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)