08.07.2012, 13:49
Hey, I'm trying to create a script that when a player passes a police with his car, and going over 130. It gives an +1 star and the police and SRT are getting informed about it.
The script so far:
The errors:
As my opinion I scripted as it should be, but apparently not.
Someone can help me out?
Thanks in advance!
-Kevin
The script so far:
pawn Код:
forward LaserPolice();
public LaserPolice();
{
// local variables
new PolicePos[3];
for(new i; i < MAX_PLAYERS; i++)
for(new playerid; playerid < MAX_PLAYERS; playerid++)
{
GetPlayerPos(playerid, PolicePos[1], PolicePos[2], PolicePos[3]);
if(APlayerData[playerid][LoggedIn] == false) continue;
{
if((APlayerData[playerid][PlayerClass] == ClassPolice) || (APlayerData[playerid][PlayerClass] == ClassSRT))
{
if(IsPlayerInRangeOfPoint(i, 50.0, PolicePos[1], PolicePos[2], PolicePos[3]);
{
if ((APlayerData[i][PlayerClass] == ClassBusDriver) || (APlayerData[i][PlayerClass] == ClassTruckDriver) || (APlayerData[i][PlayerClass] == ClassPilot) || (APlayerData[i][PlayerClass] == ClassMafia) || (APlayerData[i][PlayerClass] == ClassCourier) || (APlayerData[i][PlayerClass] == ClassAssistance) ||(APlayerData[i][PlayerClass] == ClassRoadWorker))
{
CheckPoliceSpeeding(i);
}
else return 0;
}
else return 0;
}
else return 0;
}
}
return 1;
}
CheckPoliceSpeeding(playerid)
{
// Setup local variables
new Name[24], Msg[128];
// Check if the player hasn't been caught speeding recently
if (APlayerData[playerid][PlayerCaughtSpeeding] == 0)
{
// Check if the player is the driver of the vehicle
if (GetPlayerVehicleSeat(playerid) == 0)
{
// Check if the player's speed is greater than the speed allowed by this camera (no need to process a distance-check if not speeding)
if (APlayerData[playerid][PlayerSpeed] > 130)
{
// Prevent the player being caught multiple times by the same speed-camera
APlayerData[playerid][PlayerCaughtSpeeding] = 20;
// Increase the wanted-level of this player by 1 star
SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid) + 1);
// Let the player know he's been caught speeding
SendClientMessage(playerid, 0xFFFFFFFF, TXT_PlayerCaughtSpeeding);
// Get the name of the player
GetPlayerName(playerid, Name, sizeof(Name));
// Also inform all police players that this player is caught speeding
format(Msg, 128, "{00FF00}Player {FFFF00}%s{00FF00} is caught speeding, pursue and fine him", Name);
Police_SendMessage(Msg);
SRT_SendMessage(Msg);
}
}
}
else // If the player has been caught before, reduce the value until it's 0 again, then he can be caught again
APlayerData[playerid][PlayerCaughtSpeeding]--;
}
Код:
C:\Users\Barbara\Desktop\SAMP Kevin\hoi\gamemodes\PPC_Trucking.pwn(214) : error 055: start of function body without function header C:\Users\Barbara\Desktop\SAMP Kevin\hoi\gamemodes\PPC_Trucking.pwn(217) : error 010: invalid function or declaration C:\Users\Barbara\Desktop\SAMP Kevin\hoi\gamemodes\PPC_Trucking.pwn(218) : error 010: invalid function or declaration C:\Users\Barbara\Desktop\SAMP Kevin\hoi\gamemodes\PPC_Trucking.pwn(221) : error 010: invalid function or declaration C:\Users\Barbara\Desktop\SAMP Kevin\hoi\gamemodes\PPC_Trucking.pwn(223) : error 010: invalid function or declaration C:\Users\Barbara\Desktop\SAMP Kevin\hoi\gamemodes\PPC_Trucking.pwn(225) : error 010: invalid function or declaration C:\Users\Barbara\Desktop\SAMP Kevin\hoi\gamemodes\PPC_Trucking.pwn(227) : error 010: invalid function or declaration C:\Users\Barbara\Desktop\SAMP Kevin\hoi\gamemodes\PPC_Trucking.pwn(230) : error 054: unmatched closing brace ("}") C:\Users\Barbara\Desktop\SAMP Kevin\hoi\gamemodes\PPC_Trucking.pwn(231) : error 010: invalid function or declaration C:\Users\Barbara\Desktop\SAMP Kevin\hoi\gamemodes\PPC_Trucking.pwn(233) : error 010: invalid function or declaration C:\Users\Barbara\Desktop\SAMP Kevin\hoi\gamemodes\PPC_Trucking.pwn(235) : error 010: invalid function or declaration C:\Users\Barbara\Desktop\SAMP Kevin\hoi\gamemodes\PPC_Trucking.pwn(239) : error 010: invalid function or declaration C:\Users\Barbara\Desktop\SAMP Kevin\hoi\gamemodes\PPC_Trucking.pwn(242) : error 025: function heading differs from prototype
Someone can help me out?
Thanks in advance!
-Kevin