23.01.2014, 09:42
My speedcamera's are behaving weird. When i get caught speeding it always gives me two tickets. even though it should only give 1.
This is my code:
This is my code:
pawn Код:
CheckPlayerSpeeding(playerid)
{
new model;
model = GetVehicleModel(GetPlayerVehicleID(playerid));
if (APlayerData[playerid][PlayerCaughtSpeeding] == 0)
{
if(APlayerData[playerid][PlayerClass] != ClassPolice)
{
for (new CamID; CamID < MAX_CAMERAS; CamID++)
{
if (ACameras[CamID][CamSpeed] != 0)
{
if (GetPlayerVehicleSeat(playerid) == 0)
{
if (APlayerData[playerid][PlayerSpeed] > ACameras[CamID][CamSpeed])
{
if(model != 417 && model != 425 && model != 447 && model != 460 && model != 469 && model != 476 && model != 487 && model != 488 && model != 497 && model != 511 && model != 512 && model != 513 && model != 519 && model != 520 && model != 548 && model != 553 && model != 563 && model != 577 && model != 592 && model != 593)
{
if (IsPlayerInRangeOfPoint(playerid, 50.0, ACameras[CamID][CamX], ACameras[CamID][CamY], ACameras[CamID][CamZ]))
{
new overSpeeding = (APlayerData[playerid][PlayerSpeed] - ACameras[CamID][CamSpeed]);
new speed = random(4);
switch(speed)
{
case 0, 1, 2:
{
switch(overSpeeding)
{
case 0..1: APlayerData[playerid][Fines] += 100; //If players speed is 0-5 more than the speedlimit
case 2..3: APlayerData[playerid][Fines] += 130; //If players speed is 6-10 more than the speedlimit
case 4..5: APlayerData[playerid][Fines] += 160;
case 6: APlayerData[playerid][Fines] += 190;
case 7..8: APlayerData[playerid][Fines] += 220;
case 9..10: APlayerData[playerid][Fines] += 250;
case 11..12: APlayerData[playerid][Fines] += 280;
case 13..14: APlayerData[playerid][Fines] += 310;
case 15..16: APlayerData[playerid][Fines] += 340;
case 17..18: APlayerData[playerid][Fines] += 370;
case 19..20: APlayerData[playerid][Fines] += 400;
case 21..22: APlayerData[playerid][Fines] += 430;
case 23..24: APlayerData[playerid][Fines] += 460;
case 25..26: APlayerData[playerid][Fines] += 490;
case 27..28: APlayerData[playerid][Fines] += 520;
case 29..30: APlayerData[playerid][Fines] += 550;
default: APlayerData[playerid][Fines] += 1000;
}
APlayerData[playerid][PlayerCaughtSpeeding] = 20;
SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You've been caught by a speedtrap, slow down!");
}
case 3:
{
APlayerData[playerid][PlayerCaughtSpeeding] = 20;
SendClientMessage(playerid, 0xFFFFFFFF, "You are being lucky! Speedtrap couldn't catch you.");
}
}
}
}
}
}
}
}
}
}
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]--;
}