Speed camera problem
#1

Код:
if(IsPlayerInRangeOfPoint(playerid, 30, 1429.6327,-1592.7213,13.3906) || IsPlayerInRangeOfPoint(playerid, 3.0, 1550.3885,-1732.3440,13.3828) || IsPlayerInRangeOfPoint(playerid, 3.0, 1389.1293,-1872.4227,13.3828))
  {
    if (GetVehicleSpeed(GetPlayerVehicleID(playerid)) >= 100)
    {
        if(PlayerInfo[playerid][Member] == 1 || PlayerInfo[playerid][Leader] == 1){
            SendClientMessage(playerid, COLOR_LIGHTRED, "Pripazite na svoju brzinu, vozite brze od 100km/h");
        }
        else{
            SendClientMessage(playerid, COLOR_LIGHTRED, "Vozili ste prebrzo te vas je kamera uslikala");
            SendClientMessage(playerid, COLOR_LIGHTBLUE, "Naplacen vam je ticket od 2000$, mozete ga isplatiti u LSPDu");
			GivePlayerMoney(playerid, -2000);
		}
	}
  }
The code seems ok for me, but when I enter the speed camera radius with 100km/h+ text box become spammed just like:

SendClientMessage(playerid, COLOR_LIGHTRED, "Vozili ste prebrzo te vas je kamera uslikala");
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Naplacen vam je ticket od 2000$, mozete ga isplatiti u LSPDu");
SendClientMessage(playerid, COLOR_LIGHTRED, "Vozili ste prebrzo te vas je kamera uslikala");
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Naplacen vam je ticket od 2000$, mozete ga isplatiti u LSPDu");
SendClientMessage(playerid, COLOR_LIGHTRED, "Vozili ste prebrzo te vas je kamera uslikala");
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Naplacen vam je ticket od 2000$, mozete ga isplatiti u LSPDu");
And somethimes more. Sorry for my bad english, can someone help please?
Reply
#2

How about putting a return 1; after GivePlayerMoney ?
Reply
#3

Nothing, it happens again.

Can someone help please?
Reply
#4

Try this one:

pawn Код:
// On top of your script:
new bool:SpeedCam[MAX_PLAYERS];

//In your function.
if(IsPlayerInRangeOfPoint(playerid, 30, 1429.6327,-1592.7213,13.3906) || IsPlayerInRangeOfPoint(playerid, 3.0, 1550.3885,-1732.3440,13.3828) || IsPlayerInRangeOfPoint(playerid, 3.0, 1389.1293,-1872.4227,13.3828))
{
    //check if a player already hit the speedcam.
    if (!SpeedCam[playerid] && GetVehicleSpeed(GetPlayerVehicleID(playerid)) >= 100)
    {
        if(PlayerInfo[playerid][Member] == 1 || PlayerInfo[playerid][Leader] == 1) {
            SendClientMessage(playerid, COLOR_LIGHTRED, "Pripazite na svoju brzinu, vozite brze od 100km/h");
        } else {
            SendClientMessage(playerid, COLOR_LIGHTRED, "Vozili ste prebrzo te vas je kamera uslikala");
            SendClientMessage(playerid, COLOR_LIGHTBLUE, "Naplacen vam je ticket od 2000$, mozete ga isplatiti u LSPDu");
            GivePlayerMoney(playerid, -2000);
        }
        SpeedCam[playerid] = true; //setting it true
        SetTimerEx("ResetSpeedCam", 5000, false, "d", playerid); // reseting.
    }
}

forward ResetSpeedCam(playerid);
public ResetSpeedCam(playerid) { SpeedCam[playerid] = false; return true;}
Reply
#5

Thank you so much, kiss:
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)