zombie spawn protection
#1

i m new in samp and new in scripting..anyone can make this code for spawn kill zombies?
if a human shoots a zombie at spawn point he also gets the same damage as the zombie does, like a human shot a bullet of any gun in a zombie standing at spawn point he also gets the damage,
If bullet shot= Equal damage
and if zombie die = SetHumanHealth 0
see attached pic
Help= +1 rep For helper
Reply
#2

Hello sanamalik400,

I've got this code for you,

PHP код:
public OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost)
{
     if (
IsPlayerInRangeOfPoint(Target2.0the x pos of the player spawn pointsyz)) 
     { 
         new 
Float:health;
         
GetPlayerHealth(Shooter,health);
         
SetPlayerHealth(Shooterhealth-5); // It will decrease 5 hp at each shoot
    
return 1;

For the "OnPlayerShootPlayer", it has an include, you have to download it : https://sampforum.blast.hk/showthread.php?pid=937824#pid937824

- KillerDVX.
Reply
#3

if player assasin one shoot =1 kill then??
or i make damages for all classes??
Anyway thanks
Reply
#4

KillerDVX Your code not working :P
Reply
#5

no one helping
Reply
#6

Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
    if(issuerid != INVALID_PLAYER_ID) 
    {
      if(IsPlayerInRangeOfPoint(playerid, range, x, y, z)) 
     {
     SetPlayerHealth(playerid, GetPlayerHealth(playerid)+amount);
     SetPlayerHealth(issuerid, GetPlayerHealth(playerid)-amount);
    }
    }
    return 1;
}
Reply
#7

Quote:
Originally Posted by ax1
Посмотреть сообщение
Код:
     SetPlayerHealth(playerid, GetPlayerHealth(playerid)+amount);
     SetPlayerHealth(issuerid, GetPlayerHealth(playerid)-amount);
Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
    if(issuerid != INVALID_PLAYER_ID) 
    {
		if(IsPlayerInRangeOfPoint(playerid, range, x, y, z)) 
		{
			new Float:hp;
			GetPlayerHealth(playerid, hp);
			SetPlayerHealth(playerid, hp + amount);
			GetPlayerHealth(playerid, hp);
			SetPlayerHealth(issuerid, hp - amount);
		}
    }
    return 1;
}
The right syntax is GetPlayerHealth(playerid, &Float:health);
Reply
#8

Quote:
Originally Posted by X337
Посмотреть сообщение
Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
    if(issuerid != INVALID_PLAYER_ID) 
    {
		if(IsPlayerInRangeOfPoint(playerid, range, x, y, z)) 
		{
			new Float:hp;
			GetPlayerHealth(playerid, hp);
			SetPlayerHealth(playerid, hp + amount);
			GetPlayerHealth(playerid, hp);
			SetPlayerHealth(issuerid, hp - amount);
		}
    }
    return 1;
}
The right syntax is GetPlayerHealth(playerid, &Float:health);
My bad I didn't even compile my code
Reply
#9

Why it's not working ? are you getting errors ? if yes, please paste them here.
Reply
#10

Wait i compile
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)