Injury System like LS:RP
#1

How can i make if hitid( player shooted) is in car and i want to him get in injured system.
If he is on foot it's working but if it's on car it don't
Here is script


Код:
if(hittype == BULLET_HIT_TYPE_PLAYER)
	{
		if(health < 50 && GetPVarInt(hitid, "Dead") == 0)
		{
			SetPlayerHealth(hitid, 50);
			SetTimerEx("Wounded", 0, 0, "ii", playerid, hitid);
		}
	}
    if(GetPVarInt(hitid, "Dead") == 6)
	{
		DestroyDynamic3DTextLabel(PlayerInfo[hitid][pInjuriesText]);
		GetPlayerPos(hitid, x, y, z);
		PlayerInfo[hitid][pInjuriesText] = CreateDynamic3DTextLabel("(( THIS PLAYER IS NOW DEAD ))", COLOR_ERROR, x, y, z, 25.0, hitid, INVALID_VEHICLE_ID, 1, GetPlayerVirtualWorld(hitid), GetPlayerInterior(hitid), -1, 20.0);
		SendClientMessage(hitid, 0xFFFF00AA, "-> You're now dead. You need to wait 60 seconds and then you'll get the ability to /respawnme.");
		SetPVarInt(hitid, "Dead", 7);
		return 0;
	}

forward Wounded(playerid, hitid);
public Wounded(playerid, hitid)
{
	new Float:x, Float:y, Float:z, stringdamage[128], damagetext[128];
	GetPlayerPos(hitid,x,y,z);
	SetPVarInt(hitid, "Dead", 6);
	ApplyAnimationEx(hitid, "WUZI", "CS_Dead_Guy", 4.0, 0, 1, 1, 1, 0);
	ResetPlayerWeaponsEx(hitid);
	GameTextForPlayer(hitid, "~b~BRUTTALY WOUNDED", 5000, 3);
	GetPlayerPos(hitid, x, y, z);
	
	format(stringdamage, sizeof(stringdamage), "(( Has been injured %d times, \n/damages %d for more information.\n ))", CountDamages(hitid), hitid);
	PlayerInfo[hitid][pInjuriesText] = CreateDynamic3DTextLabel(stringdamage, COLOR_ERROR, x, y, z, 25.0, hitid, INVALID_VEHICLE_ID, 1, GetPlayerVirtualWorld(hitid), GetPlayerInterior(hitid), -1, 20.0);
	
	SendClientMessage(hitid, COLOR_ERROR, "You were brutally wounded, now if a medic or anyone else doesn't save you, you will die.");
	SendClientMessage(hitid, COLOR_ERROR, "To accept death type /acceptdeath.");
	format(damagetext, sizeof(damagetext), "(( Has been injured %d times, /damages %d for more information. ))", CountDamages(hitid), hitid);
	SendClientMessage(hitid, COLOR_ERROR, damagetext);
	return 1;
}
Reply
#2

PLEASE, Hire a scripter and stop "How can I", "How to make that", "How to bla bla bla"!!

Whatever, You should use something like if the player is in a car eject him..
Reply
#3

I just want to finish this system!
Reply
#4

Is it because the testlos is fucked up?
Reply
#5

Your system is flawed. I imagine it doesn't work either with melee weapons OR fists?

Unless you've got it setup under take/give dmg for other weapons.

Anyway, just use OnPlayerTakeDamage. There's no plausible way of doing it with OnPlayerWeaponShot FOR players in a vehicle.

PHP код:
public OnPlayerTakeDamage(playerid, .. )
{
     if(
IsPlayerInAnyVehicle(playerid)){
         if(
health 50 && GetPVarInt(hitid"Dead") == 0)
           {
             
SetPlayerHealth(hitid50);
            
SetTimerEx("Wounded"00"ii"playeridhitid);
           }
     }
}
return 
true;

BULLET_HIT_TYPE_PLAYER doesn't work if a player is inside a vehicle.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)