Command help
#1

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 
05i++)
        {
            new 
Float:XFloat:YFloat:Z;
            
GetObjectPos(PolicijskeKazne[i], XYZ);
        
            if (
IsPlayerInRangeOfPoint(playerid2.5XYZ))
            {
                
Pronasao 1;
            }
         }
     
         if(
Pronasao == 0) return 0;
     
     
         for (new 
0MAX_PLAYERSi++)
        {
            if(
IsPlayerConnected(i) && !IsPlayerNPC(i) && APlayerData[i][PlayerClass] == ClassPolice){
             
Policajaca Policajaca 1;
            }
        }
     
     
        
Cijena = ((GetPlayerWantedLevel(playerid) * 1000) / Policajaca) / 2;
        
Cijena floatround(Cijenafloatround_round);
        
Puna Cijena Policajaca;
        
    
        new 
Linija[128], Nadimak[MAX_PLAYER_NAME];
        
GetPlayerName(playeridNadimaksizeof(Nadimak));
        
format(Linijasizeof(Linija), "Igrac %s je platio jamcevinu za svoje prekrsaje. Dobio si %i$."NadimakCijena);
    
    
        for (new 
0MAX_PLAYERSi++)
        {
              if(
IsPlayerConnected(i) && !IsPlayerNPC(i) && APlayerData[i][PlayerClass] == ClassPolice){
                
APlayerData[i][PlayerMoney] = APlayerData[i][PlayerMoney] + Cijena;
                   
SendClientMessage(i0xFFFFFFLinija);
            }
         }
    
    
        
APlayerData[playerid][PlayerMoney] = APlayerData[playerid][PlayerMoney] - Puna;
        
PostaviWantedLevel(playerid0);
    
    
    
        new 
LinijaZ[128];
        
format(LinijaZsizeof(LinijaZ), "Uspjesno si platio svoju jamcevinu u iznosu od %i$. Pokusaj smanjiti prekrsaje sljedeci put."Puna);
        
SendClientMessage(playerid0xFFFFFFLinijaZ);
    
        return 
1;
    }
    return 
0;

Reply
#2

if you are using GetPlayerWantedlevel

pawn Код:
GetWantedPrice(playerid) //Add this anywhere in the script
{
    new wantedprice;
    switch(GetPlayerWantedLevel(playerid))
    {
        case 0: wantedprice = 0;
        case 1: wantedprice = 10;
        case 2: wantedprice = 20;
        case 3: wantedprice = 30;
            //add more if u want to
        default: wantedprice = 0;
    }
    return wantedprice;
}


        //Add this where you are checking if the cop is offline.
       //Kada nema pandura offline dodaj ovo
    if(GetPlayerMoney(playerid) < GetWantedPrice(playerid)) //Proveravas da li ima para
        return SendClientMessage(playerid,COLOR_RED,"Not enough money"); //Ako nema para

    GivePlayerMoney(playerid,-GetWantedPrice(playerid)); //Smanjujemo pare
    SetPlayerWantedLevel(playerid,0);  //stavljas wanted na 0

}
Reply
#3

Or just use this

When you check if there are any cops online/offline
pawn Код:
new price = GetPlayerWantedLevel(playerid)*10; //cena svakog wanted levela ce biti 10$. Znaci 10 wanteda = 100. 10x10
    if(GetPlayerMoney(playerid) < price) //proveravamo da li ima para
        return SendClientMessage(playerid,COLOR_RED,"Nemas dovoljno para");
       
    GivePlayerMoney(playerid,-price);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)