Rent system - States
#1

Hello.

Problem with rent system in the state.

- There is no errors,but when I enter "rentable" vehicle nothing doesn't show. + I know that is problem something with onplayerstatechange but I don't know how to fix.

- Codes:

PHP код:
public OnPlayerStateChange(playeridnewstateoldstate)
{
    new 
newcar GetPlayerVehicleID(playerid);
    if(
newstate == 1)
    {
        if(
RentVozila(newcar))
        {
            if(
Rentano[playerid] != newcar)
            {
                
ShowPlayerDialog(playerid,DIALOG_RENT,DIALOG_STYLE_LIST,"Iznamjite vozilo","[1] Rent Vrijeme - N/A (500$)","Odaberi","Izlaz");
                
TogglePlayerControllable(playerid,0);
            }
        }
    }
    return 
1;

Unrent command:

PHP код:
CMD:unrentaj(playerid,params[])
{
       new 
idcar GetPlayerVehicleID(playerid);
       if(
Rentano[playerid] != 299)
       {
        if(
idcar == Rentano[playerid])
        {
               
TogglePlayerControllable(playerid1);
        }
        
SetVehicleToRespawn(Rentano[playerid]);
          
Rentano[playerid] = 299;
          
SendClientMessage(playerid,-1,"{00C0FF}WG:{FFFFFF} Uspjesno ste unrentali vozilo");
    }
    return 
1;

Rent dialog:

PHP код:
        case DIALOG_RENT:
        {
            new 
poruka[128];
            if(!
responseSendClientMessage(playerid,-1,"{00C0FF}WG:{FFFFFF} Izasli ste iz iznajmljivanja vozila") && RemovePlayerFromVehicle(playerid);
            {
                if(
response)
                {
                    if(
GetPlayerMoney(playerid) < 500) return SendClientMessage(playerid,-1,"{F81414}Greska:{FFFFFF} Nemate dovoljno novca na racunu");
                    if(
Rentano[playerid] != 299) return SendClientMessage(playerid,-1,"{F81414}Greska:{FFFFFF} Vec imate iznajmljeno vozilo");
                    {
                        for(new 
i=0i<MAX_PLAYERSi++)
                        if(
Rentano[i] == GetPlayerVehicleID(playerid)) return SendClientMessage(playerid,-1,"{F81414}Greska:{FFFFFF} Netko je vec rentovo ovo vozilo");
                        {
                            
GivePlayerMoney(playerid,-500);
                            
Rentano[playerid] = GetPlayerVehicleID(playerid);
                            
format(poruka,sizeof(poruka),"~g~ Uspjesno ste rentali vozilo!\nAko ne koristite ~y~/unrent");
                            
GameTextForPlayer(playerid,poruka,5000,1);
                        }
                    }
                }
            }
            return 
1;
        } 
Thank you very much!
Reply


Messages In This Thread
Rent system - States - by NoDi522 - 17.03.2015, 15:36
Re: Rent system - States - by ReD_HunTeR - 17.03.2015, 16:01
Re: Rent system - States - by NoDi522 - 17.03.2015, 16:16
Re: Rent system - States - by NoDi522 - 18.03.2015, 15:12
Re: Rent system - States - by CalvinC - 18.03.2015, 15:15
Re: Rent system - States - by NoDi522 - 18.03.2015, 15:16
Re: Rent system - States - by NoDi522 - 18.03.2015, 16:35

Forum Jump:


Users browsing this thread: 1 Guest(s)