05.03.2017, 09:38
I'm trying stop players from killing civilians (No wanted levels) for no reason, I got to this point but i cant fix this.
ERRORS:
Script:
Thank You!
ERRORS:
Код:
C:\Users\dank\Desktop\samp03\gamemodes\CCNR.pwn(754) : warning 217: loose indentation C:\Users\dank\Desktop\samp03\gamemodes\CCNR.pwn(754) : warning 213: tag mismatch C:\Users\dank\Desktop\samp03\gamemodes\CCNR.pwn(761) : warning 217: loose indentation C:\Users\dank\Desktop\samp03\gamemodes\CCNR.pwn(762) : warning 225: unreachable code C:\Users\dank\Desktop\samp03\gamemodes\CCNR.pwn(2308) : error 033: array must be indexed (variable "Player")
Код:
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);
}
if ( Shooter != INVALID_PLAYER_ID )
{
if ( GetPlayerWantedLevel(Target) == 0) // check if the victim is from the same team as the shooter.
{
new Float:hp;
GetPlayerHealth(Target, hp);
SetPlayerHealth(Target, hp + HealthLost);
SetPlayerHealth( Shooter, 0 );
SendClientMessage( Shooter, COLOR_RED, "DONT KILL CIVILIANS!" );
GivePlayerMoney( Shooter, - 5000 );
}
}
return 1;
}



