OnPlayerShootPlayer - Problem
#1

Heey, i have a problem with OPSP

Код:
public OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost)
{
	new Float:Health;
	GetPlayerHealth(Target,Health);
    
	if(GetPlayerTeam(Shooter) == TEAM_RED && GetPlayerTeam(Target) == TEAM_BLUE && GetPlayerWeapon(Shooter) == 0 || 1 || 2 || 3 || 4 || 5 || 6 || 7 || 8 || 9 || 10 || 11 || 12 || 13 || 14 || 15 || 16 || 17 || 18 || 19 || 20 || 21 || 22 || 23 || 24 || 25 || 26 || 27 || 28 || 29 || 30 || 31 || 32 || 33 || 34 ) HealthLost = Health-110;
	SetPlayerHealth(Target, HealthLost);
	if(GetPlayerTeam(Shooter) == TEAM_BLUE && GetPlayerTeam(Target) == TEAM_RED && GetPlayerWeapon(Shooter) == 0 || 1 || 2 || 3 || 4 || 5 || 6 || 7 || 8 || 9 || 10 || 11 || 12 || 13 || 14 || 15 || 16 || 17 || 18 || 19 || 20 || 21 || 22 || 23 || 24 || 25 || 26 || 27 || 28 || 29 || 30 || 31 || 32 || 33 || 34 ) HealthLost = Health-110;
	SetPlayerHealth(Target, HealthLost);

	return 1;
}
I have a Anti Spawnkill protection (after spawn he have 4 seconds 99999 health)
but if i shoot on this under this 4 seconds, he lose his health why?

Who can help me?
Reply
#2

Make a variable... like
pawn Код:
new spawnkill[MAX_PLAERS];

public OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost)
{
    new Float:Health;
    GetPlayerHealth(Target,Health);
        if(spawnkill[playerid] == 1)
{
    if(GetPlayerTeam(Shooter) == TEAM_RED && GetPlayerTeam(Target) == TEAM_BLUE &&              GetPlayerWeapon(Shooter) == 0 || 1 || 2 || 3 || 4 || 5 || 6 || 7 || 8 || 9 || 10 || 11 || 12 || 13 || 14 || 15 || 16 || 17 || 18 || 19 || 20 || 21 || 22 || 23 || 24 || 25 || 26 || 27 || 28 || 29 || 30 || 31 || 32 || 33 || 34 ) HealthLost = Health-110;
    SetPlayerHealth(Target, HealthLost);
    if(GetPlayerTeam(Shooter) == TEAM_BLUE && GetPlayerTeam(Target) == TEAM_RED && GetPlayerWeapon(Shooter) == 0 || 1 || 2 || 3 || 4 || 5 || 6 || 7 || 8 || 9 || 10 || 11 || 12 || 13 || 14 || 15 || 16 || 17 || 18 || 19 || 20 || 21 || 22 || 23 || 24 || 25 || 26 || 27 || 28 || 29 || 30 || 31 || 32 || 33 || 34 ) HealthLost = Health-110;
    SetPlayerHealth(Target, HealthLost);

    return 1;
}
then under OnPllayerSpawn put
pawn Код:
spawnkill[playerid] = 0;
then under the spawnkill call back... put spawnkill[playerid] = 1;
Reply
#3

Код:
E:\GTA San Andreas\Samp Server\gamemodes\DM.pwn(109) : error 017: undefined symbol "MAX_PLAERS"
E:\GTA San Andreas\Samp Server\gamemodes\DM.pwn(109) : error 009: invalid array size (negative, zero or out of bounds)
E:\GTA San Andreas\Samp Server\gamemodes\DM.pwn(316) : error 017: undefined symbol "playerid"
[code] 109 = new spawnkill[MAX_PLAERS];
316 = if(spawnkill[playerid] == 1)
Reply
#4

Add me one msn bombados8839@hotmail.co.uk

Also, change MAX_PLAERS to MAX_PLAYERS and that will get rid of ur errors.
Reply
#5

Can you test it pls? ^^

95.119.189.162:7777

MAX:PLAYERS fixxed.
Код:
public OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost)
{
	new Float:Health;
	GetPlayerHealth(Target,Health);
	
	if(spawnkill[Shooter] == 1)
	{
    if(GetPlayerTeam(Shooter) == TEAM_RED && GetPlayerTeam(Target) == TEAM_BLUE && GetPlayerWeapon(Shooter) == 0 || 1 || 2 || 3 || 4 || 5 || 6 || 7 || 8 || 9 || 10 || 11 || 12 || 13 || 14 || 15 || 16 || 17 || 18 || 19 || 20 || 21 || 22 || 23 || 24 || 25 || 26 || 27 || 28 || 29 || 30 || 31 || 32 || 33 || 34 ) HealthLost = Health-110;
	SetPlayerHealth(Target, HealthLost);
    if(GetPlayerTeam(Shooter) == TEAM_BLUE && GetPlayerTeam(Target) == TEAM_RED && GetPlayerWeapon(Shooter) == 0 || 1 || 2 || 3 || 4 || 5 || 6 || 7 || 8 || 9 || 10 || 11 || 12 || 13 || 14 || 15 || 16 || 17 || 18 || 19 || 20 || 21 || 22 || 23 || 24 || 25 || 26 || 27 || 28 || 29 || 30 || 31 || 32 || 33 || 34 ) HealthLost = Health-110;
	SetPlayerHealth(Target, HealthLost);
	}
	return 1;
}
Reply
#6

That server doesn't exist ;// erm, you could add me on msn and we will try and figure something out ... bombados8839@hotmail.co.uk
Reply
#7

i dont have msn
Reply
#8

Okay then, I can't test it... but this should work fine...
Reply
#9

Dont Works.
Who can help me?
And who can make, if i have Armor, then is the DMG normal?

Код:
public OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost)
{
	new Float:Health;
	GetPlayerHealth(Target,Health);
	
	if(spawnkill[Shooter] == 0)
	{
    /*if(GetPlayerTeam(Shooter) == TEAM_RED && GetPlayerTeam(Target) == TEAM_BLUE && GetPlayerWeapon(Shooter) == 0 || 1 || 2 || 3 || 4 || 5 || 6 || 7 || 8 || 9 || 10 || 11 || 12 || 13 || 14 || 15 || 16 || 17 || 18 || 19 || 20 || 21 || 22 || 23 || 24 || 25 || 26 || 27 || 28 || 29 || 30 || 31 || 32 || 33 || 34 ) HealthLost = Health-0;
	SetPlayerHealth(Target, HealthLost);
	GetPlayerHealth(Target, Health);
    if(GetPlayerTeam(Shooter) == TEAM_BLUE && GetPlayerTeam(Target) == TEAM_RED && GetPlayerWeapon(Shooter) == 0 || 1 || 2 || 3 || 4 || 5 || 6 || 7 || 8 || 9 || 10 || 11 || 12 || 13 || 14 || 15 || 16 || 17 || 18 || 19 || 20 || 21 || 22 || 23 || 24 || 25 || 26 || 27 || 28 || 29 || 30 || 31 || 32 || 33 || 34 ) HealthLost = Health-0;
	SetPlayerHealth(Target, HealthLost);
	GetPlayerHealth(Target, Health);*/
	}
	if(spawnkill[Shooter] == 1)
	{
    if(GetPlayerTeam(Shooter) == TEAM_RED && GetPlayerTeam(Target) == TEAM_BLUE && GetPlayerWeapon(Shooter) == 0 || 1 || 2 || 3 || 4 || 5 || 6 || 7 || 8 || 9 || 10 || 11 || 12 || 13 || 14 || 15 || 16 || 17 || 18 || 19 || 20 || 21 || 22 || 23 || 24 || 25 || 26 || 27 || 28 || 29 || 30 || 31 || 32 || 33 || 34 ) HealthLost = Health-110;
	SetPlayerHealth(Target, HealthLost);
	GetPlayerHealth(Target, Health);
    if(GetPlayerTeam(Shooter) == TEAM_BLUE && GetPlayerTeam(Target) == TEAM_RED && GetPlayerWeapon(Shooter) == 0 || 1 || 2 || 3 || 4 || 5 || 6 || 7 || 8 || 9 || 10 || 11 || 12 || 13 || 14 || 15 || 16 || 17 || 18 || 19 || 20 || 21 || 22 || 23 || 24 || 25 || 26 || 27 || 28 || 29 || 30 || 31 || 32 || 33 || 34 ) HealthLost = Health-110;
	SetPlayerHealth(Target, HealthLost);
	GetPlayerHealth(Target, Health);
	}
	return 1;
}
Reply
#10

Quote:
Originally Posted by [RLG]Zepp
Посмотреть сообщение
Dont Works.
Who can help me?
And who can make, if i have Armor, then is the DMG normal?

Код:
public OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost)
{
	new Float:Health;
	GetPlayerHealth(Target,Health);
	
	if(spawnkill[Shooter] == 0)
	{
    /*if(GetPlayerTeam(Shooter) == TEAM_RED && GetPlayerTeam(Target) == TEAM_BLUE && GetPlayerWeapon(Shooter) == 0 || 1 || 2 || 3 || 4 || 5 || 6 || 7 || 8 || 9 || 10 || 11 || 12 || 13 || 14 || 15 || 16 || 17 || 18 || 19 || 20 || 21 || 22 || 23 || 24 || 25 || 26 || 27 || 28 || 29 || 30 || 31 || 32 || 33 || 34 ) HealthLost = Health-0;
	SetPlayerHealth(Target, HealthLost);
	GetPlayerHealth(Target, Health);
    if(GetPlayerTeam(Shooter) == TEAM_BLUE && GetPlayerTeam(Target) == TEAM_RED && GetPlayerWeapon(Shooter) == 0 || 1 || 2 || 3 || 4 || 5 || 6 || 7 || 8 || 9 || 10 || 11 || 12 || 13 || 14 || 15 || 16 || 17 || 18 || 19 || 20 || 21 || 22 || 23 || 24 || 25 || 26 || 27 || 28 || 29 || 30 || 31 || 32 || 33 || 34 ) HealthLost = Health-0;
	SetPlayerHealth(Target, HealthLost);
	GetPlayerHealth(Target, Health);*/
	}
	if(spawnkill[Shooter] == 1)
	{
    if(GetPlayerTeam(Shooter) == TEAM_RED && GetPlayerTeam(Target) == TEAM_BLUE && GetPlayerWeapon(Shooter) == 0 || 1 || 2 || 3 || 4 || 5 || 6 || 7 || 8 || 9 || 10 || 11 || 12 || 13 || 14 || 15 || 16 || 17 || 18 || 19 || 20 || 21 || 22 || 23 || 24 || 25 || 26 || 27 || 28 || 29 || 30 || 31 || 32 || 33 || 34 ) HealthLost = Health-110;
	SetPlayerHealth(Target, HealthLost);
	GetPlayerHealth(Target, Health);
    if(GetPlayerTeam(Shooter) == TEAM_BLUE && GetPlayerTeam(Target) == TEAM_RED && GetPlayerWeapon(Shooter) == 0 || 1 || 2 || 3 || 4 || 5 || 6 || 7 || 8 || 9 || 10 || 11 || 12 || 13 || 14 || 15 || 16 || 17 || 18 || 19 || 20 || 21 || 22 || 23 || 24 || 25 || 26 || 27 || 28 || 29 || 30 || 31 || 32 || 33 || 34 ) HealthLost = Health-110;
	SetPlayerHealth(Target, HealthLost);
	GetPlayerHealth(Target, Health);
	}
	return 1;
}
the GetPlayerWeapon part is scripted VERY BAD.
pawn Код:
public OnPlayerSpawn(playerid)
{
    spawnkill[playerid]=1;
    SetTimerEx("RemoveSpawnKill",4000,0,"i",playerid);
}
forward RemoveSpawnKill(playerid);
public RemoveSpawnKill(playerid)
{
   spawnkill[playerid]=0;
}
public OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost)
{
    new Float:Health,Float:Armour;

    if(spawnkill[Target] == 1 && GetPlayerTeam(Shooter) != GetPlayerTeam(Target))
    {
            GetPlayerHealth(Target, Health);
            GetPlayerArmour(Target, Armour);
        SetPlayerHealth(Target, HealthLost+Health);
        SetPlayerArmour(Target,ArmourLost+Armour);
    }
    return 1;
}
Discussed a million times in the OPSP topic.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)