IsACop(playerid)
{
if(IsPlayerConnected(playerid))
{
new leader = PlayerInfo[playerid][pLeader];
new member = PlayerInfo[playerid][pMember];
if(member==1 || member==2 || member== 3 || member==5 || member==3 || member==6 || member==7 || member==11 || member==13)
{
return 1;
}
else if(leader==1 || leader==2 || leader == 3 || leader==5 || leader==3 || leader==6 || leader==7 || leader==11 || leader==13)
{
return 1;
}
}
return 0;
}
stock IsMember(playerid)
{
return CallRemoteFunction("IsACop", "i", playerid);
}
CheckPlayerSpeeding(playerid)
{
// Check if the player hasn't been caught speeding recently
if (APlayerData[playerid][PlayerCaughtSpeeding] == 0)
{
if (!IsMember(playerid))
{
// Loop through all speedcameras
for (new CamID; CamID < MAX_CAMERAS; CamID++)
{
// Check if this camera has been created
if (ACameras[CamID][CamSpeed] != 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] > ACameras[CamID][CamSpeed])
{
// Check if the player is near the camera
if (IsPlayerInRangeOfPoint(playerid, 20.0, ACameras[CamID][CamX], ACameras[CamID][CamY], ACameras[CamID][CamZ]))
{
APlayerData[playerid][PlayerCaughtSpeeding] = 20;
SendClientMessage(playerid, COLOR_LIGHTBLUE, "* Speed Cam has given you a ticket costing $2500, reason: High Speed");
GivePlayerCash(playerid, -2500);
}
}
}
}
}
}
}
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]--;
return 1;
}
|
if (!IsMember(playerid)) |
|
if(!IsACop(playerid) |
|
CallRemoteFunction will return always 1 if it execute success.
Just replace with |
stock IsACop(playerid)
{
return CallRemoteFunction("IsACop", "i", playerid);
}
CheckPlayerSpeeding(playerid)
{
// Check if the player hasn't been caught speeding recently
if (APlayerData[playerid][PlayerCaughtSpeeding] == 0)
{
if (!IsACop(playerid))
{
// Loop through all speedcameras
for (new CamID; CamID < MAX_CAMERAS; CamID++)
{
// Check if this camera has been created
if (ACameras[CamID][CamSpeed] != 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] > ACameras[CamID][CamSpeed])
{
// Check if the player is near the camera
if (IsPlayerInRangeOfPoint(playerid, 20.0, ACameras[CamID][CamX], ACameras[CamID][CamY], ACameras[CamID][CamZ]))
{
APlayerData[playerid][PlayerCaughtSpeeding] = 20;
SendClientMessage(playerid, COLOR_LIGHTBLUE, "* Speed Cam has given you a ticket costing $2500, reason: High Speed");
GivePlayerCash(playerid, -2500);
}
}
}
}
}
}
}
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]--;
return 1;
}
|
"CallRemoteFunction" and use "public" not "stock" (why were you using "stock" in the first place?)
|
public IsACop(playerid)
{
if(!IsPlayerConnected(playerid)) return 0;
switch(PlayerInfo[playerid][pLeader])
case 1 .. 3, 5 .. 7, 11, 13: return 1;
switch(PlayerInfo[playerid][pMember])
case 1 .. 3, 5 .. 7, 11, 13: return 1;
return 0;
}
CheckPlayerSpeeding(playerid)
{
// Check if the player hasn't been caught speeding recently
if(APlayerData[playerid][PlayerCaughtSpeeding]) return APlayerData[playerid][PlayerCaughtSpeeding]--;
if(IsACop(playerid)) return 1;
// Loop through all speedcameras
for(new CamID = 0; CamID < MAX_CAMERAS; CamID++)
{
// Check if this camera has been created
if(ACameras[CamID][CamSpeed] != 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] > ACameras[CamID][CamSpeed])
{
// Check if the player is near the camera
if(IsPlayerInRangeOfPoint(playerid, 20.0, ACameras[CamID][CamX], ACameras[CamID][CamY], ACameras[CamID][CamZ]))
{
APlayerData[playerid][PlayerCaughtSpeeding] = 20;
SendClientMessage(playerid, COLOR_LIGHTBLUE, "* Speed Cam has given you a ticket costing $2500, reason: High Speed");
GivePlayerCash(playerid, -2500);
break;
}
}
}
}
}
return 1;
}
|
pawn Код:
pawn Код:
|
D:\Alwil Software\Vas-Rps\gamemodes\VasRpV0.30Beta.pwn(6134) : error 001: expected token: "{", but found "case"
D:\Alwil Software\Vas-Rps\gamemodes\VasRpV0.30Beta.pwn(6135) : error 002: only a single statement (or expression) can follow each "case"
D:\Alwil Software\Vas-Rps\gamemodes\VasRpV0.30Beta.pwn(6135 -- 6136) : warning 215: expression has no effect
D:\Alwil Software\Vas-Rps\gamemodes\VasRpV0.30Beta.pwn(6136) : error 001: expected token: ";", but found "case"
D:\Alwil Software\Vas-Rps\gamemodes\VasRpV0.30Beta.pwn(6136) : error 014: invalid statement; not in switch
D:\Alwil Software\Vas-Rps\gamemodes\VasRpV0.30Beta.pwn(6136) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
5 Errors.
public IsACop(playerid)
{
if(!IsPlayerConnected(playerid)) return 0;
switch(PlayerInfo[playerid][pLeader])
{
case 1 .. 3, 5 .. 7, 11, 13: return 1;
}
switch(PlayerInfo[playerid][pMember])
{
case 1 .. 3, 5 .. 7, 11, 13: return 1;
}
return 0;
}
|
True... why did I do that :l
pawn Код:
|
|
That's not a reason to use "stock", in fact that's a very good reason NOT to use "stock"!
|
D:\Alwil Software\Vas-Rps\filterscripts\F_SpeedoMeter.pwn(28) : warning 235: public function lacks forward declaration (symbol "IsACop"
|
That's not a reason to use "stock", in fact that's a very good reason NOT to use "stock"!
|