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;
}
|
ALWAYS provide full info, or no one cant help you...
Give us codes around line "754", "762" and "2308". and write its lines numbers |
|
I don't care about the warnings, I can deal with them I just want to know what error 033: array must be indexed (variable "Player") means that's all, I'm not asking anyone to re-code a gamemode for me, just a diagnosis.
|
New team[MAX_PLAYERS];
team[Shooter] == Civilian // and etc.
team[Target] == team // etc


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;
}