Remote function
#1

Hello,
I am trying to make script, that give tickets to players.
I am trying to use the function IsACop to make sure cops wont get tickets.

Script in gamemode:
Код:
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;
}
Filterscript:
Код:
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;
}
The problem is that cops and regular players are getting tickets..

help..
Reply


Messages In This Thread
Remote function [SOLVED] - by morha12 - 17.05.2014, 06:47
Re: Remote function - by KubiPL - 17.05.2014, 07:53
Re: Remote function - by morha12 - 17.05.2014, 08:08
Re: Remote function - by morha12 - 17.05.2014, 08:51
Re: Remote function - by morha12 - 17.05.2014, 09:14
Re: Remote function - by Threshold - 17.05.2014, 09:31
Re: Remote function - by morha12 - 17.05.2014, 09:46
Re: Remote function - by Threshold - 17.05.2014, 09:49
Re: Remote function - by morha12 - 17.05.2014, 09:53
Re: Remote function - by Pottus - 17.05.2014, 13:11

Forum Jump:


Users browsing this thread: 1 Guest(s)