26.07.2015, 23:37
So what this command does it allows a player to pay money for remowing his wanted level in a police station.But the thing is the command is set to check if atleast 1 police officer is online to allow a player to pay his wanted level.I want to set it that a player can pay his wanted level even if a police officer is not online,how can i do that,what do i need to change?? Help
PHP код:
COMMAND:kazna(playerid,params[])
{
if (APlayerData[playerid][LoggedIn] == true && GetPlayerWantedLevel(playerid) > 0)
{
new Pronasao = 0;
new Policajaca = 0;
new Cijena = 0;
new Puna = 0;
for (new i = 0; i < 5; i++)
{
new Float:X, Float:Y, Float:Z;
GetObjectPos(PolicijskeKazne[i], X, Y, Z);
if (IsPlayerInRangeOfPoint(playerid, 2.5, X, Y, Z))
{
Pronasao = 1;
}
}
if(Pronasao == 0) return 0;
for (new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && !IsPlayerNPC(i) && APlayerData[i][PlayerClass] == ClassPolice){
Policajaca = Policajaca + 1;
}
}
Cijena = ((GetPlayerWantedLevel(playerid) * 1000) / Policajaca) / 2;
Cijena = floatround(Cijena, floatround_round);
Puna = Cijena * Policajaca;
new Linija[128], Nadimak[MAX_PLAYER_NAME];
GetPlayerName(playerid, Nadimak, sizeof(Nadimak));
format(Linija, sizeof(Linija), "Igrac %s je platio jamcevinu za svoje prekrsaje. Dobio si %i$.", Nadimak, Cijena);
for (new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && !IsPlayerNPC(i) && APlayerData[i][PlayerClass] == ClassPolice){
APlayerData[i][PlayerMoney] = APlayerData[i][PlayerMoney] + Cijena;
SendClientMessage(i, 0xFFFFFF, Linija);
}
}
APlayerData[playerid][PlayerMoney] = APlayerData[playerid][PlayerMoney] - Puna;
PostaviWantedLevel(playerid, 0);
new LinijaZ[128];
format(LinijaZ, sizeof(LinijaZ), "Uspjesno si platio svoju jamcevinu u iznosu od %i$. Pokusaj smanjiti prekrsaje sljedeci put.", Puna);
SendClientMessage(playerid, 0xFFFFFF, LinijaZ);
return 1;
}
return 0;
}