Anti-RDM script OnPlayerShootPlayer
#6

I played around with the script and got it working, compiles perfectly with no warnings


It does what I want it to do so I am happy
Код:
public OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost)
{
	new team	= Player[Shooter][playerClass], 
		team2	= Player[Target][playerClass];
		
	new Float:health;
	GetPlayerHealth(Target, health);
	if(team == CIVILIAN && (team2 == ARMY || team2 == POLICE || team2 == FBI || team2 == CIA || team2 == SPY))
	{
		if(Player[Shooter][playerWanted] < 9)
		{
			setWanted(Shooter, 9);
		}
	}
	
	if((team == ARMY || team == POLICE || team == FBI || team == CIA || team == SPY) && team2 == CIVILIAN && Player[Target][playerWanted] == 0)
	{
		SetPlayerHealth(Target, floatadd(health, HealthLost));
		GameTextForPlayer(Shooter, "Don't attack innocent civilian.", 1000, 5);
	}

	new wantedlevel;
	wantedlevel = GetPlayerWantedLevel(Target);
    if (wantedlevel == 0) // Check if the player has a wanted level = to 0
    { 

        new Float:hp;
        GetPlayerHealth(Target,hp); // Get the health of the player that is being shot at.
        SetPlayerHealth(Target,hp + HealthLost); // Replace the health of the player being shot.
        SetPlayerWantedLevel(Shooter,9); // Set the wanted level of the shooter to 9 stars.
        SetPlayerHealth( Shooter,0); // Set the health of the shooter to 0 so the player being shot so target can defend himself if needed.
        SendClientMessage( Shooter, COLOR_RED,"DONT KILL CIVILIANS!"); 
        GivePlayerMoney( Shooter,-5000); // Take all the moneyz.
        GivePlayerMoney(Target,5000); // Give the money to the player being shot.
    } 
	return 1;
}
Reply


Messages In This Thread
Anti-RDM script OnPlayerShootPlayer - by Gnik - 05.03.2017, 09:38
Re: Anti-RDM script OnPlayerShootPlayer - by Yousha - 05.03.2017, 10:37
Re: Anti-RDM script OnPlayerShootPlayer - by Gnik - 05.03.2017, 11:58
Re: Anti-RDM script OnPlayerShootPlayer - by ShadowMortar - 05.03.2017, 14:48
Re: Anti-RDM script OnPlayerShootPlayer - by TopShooter2 - 05.03.2017, 15:13
Re: Anti-RDM script OnPlayerShootPlayer - by Gnik - 06.03.2017, 16:48

Forum Jump:


Users browsing this thread: 1 Guest(s)