15.03.2012, 19:31
I got this function and at the keystatechange there is a print to see if it actually works. It does. But in this function its also and it doesnt respond Worked... :\ this is the code:
Thanks if you can see the problem
pawn Код:
// This function gets called when a police player presses the FIRE key (to fine nearby wanted players) when he's on foot
Police_FineNearbyPlayers(playerid)
{
// Setup local variables
new Float:x, Float:y, Float:z;
// Scan through all players
for (new PlayerToCheck; PlayerToCheck < MAX_PLAYERS; PlayerToCheck++)
{
// check if this player is connected
if (IsPlayerConnected(PlayerToCheck))
{
// Check if the other player isn't the same police player
if (PlayerToCheck == playerid)
{
// Check if the current player is wanted and the wanted player is driving slowly (below 30 kph)
if ((GetPlayerWantedLevel(PlayerToCheck) > 0) && (APlayerData[PlayerToCheck][PlayerSpeed] < 30))
{
// Get the position of this player
GetPlayerPos(PlayerToCheck, x, y, z);
// Check if the police-player is in range of the player (police player and wanted player must be within 10 meters of eachother)
if (IsPlayerInRangeOfPoint(playerid, 10.0, x, y, z))
{
// Fine the player
Police_PayFine(playerid, PlayerToCheck);
SendClientMessage(playerid, COLOR_GREY, "Worked..");
// Exit the function
return 1;
}
// Check if the police-player is in range of the player (he can be inside his vehicle or on foot)
if (IsPlayerInRangeOfPoint(playerid, 50.0, x, y, z))
{
GameTextForPlayer(PlayerToCheck, "~r~This is the police! Stop at once!~w~", 3000, 4); // Warn the player
// Also start a timer which gives the player a chance to stop and get a fine
// If he doesn't stop, the player will be sent to jail when he gets fined
if (APlayerData[PlayerToCheck][PoliceWarnedMe] == false)
{
APlayerData[PlayerToCheck][PoliceWarnedMe] = true;
APlayerData[PlayerToCheck][Value_PoliceCanJailMe] = DefaultWarnTimeBeforeJail;
APlayerData[PlayerToCheck][Timer_PoliceCanJailMe] = SetTimerEx("Timer_PoliceCanJailPlayer", 5000, true, "i", PlayerToCheck);
}
}
}
}
}
}
return 1;
}