#1

So i have this rent system and i have problem. I made rent for cars and it works great. But when i add motorbikes it gets buggy.
PHP код:
public OnPlayerStateChange(playeridnewstateoldstate)
{
    new 
vozilo GetPlayerVehicleID(playerid);
    if(
RentAuta(vozilo))
    {
         if(
Rentano[playerid] != vozilo)
        {
               
TogglePlayerControllable(playerid0);
               
GameTextForPlayer(playerid,"~w~Mozete rentati ovo vozilo ~b~/rent ~w~ili ~b~/izlaz~n~~w~Cena Renta: ~g~300$",5000,3);
        }
    }
    else if(
RentMotor(vozilo))
    {
         if(
Rentano[playerid] != vozilo)
           {
            
TogglePlayerControllable(playerid0);
            
GameTextForPlayer(playerid,"~w~Mozete rentati ovaj motor ~b~/rent ~w~ili ~b~/izlaz~n~~w~Cena Renta: ~g~80$",5000,3);
        }
    }
    return 
1;
}
stock RentAuta(carid)
{
     for(new 
0sizeof(rentauta); i++)
    {
        if(
carid == rentauta[i])    return 1;
    }
    return 
0;
}
////////////////////////////////////////////////////////////////////////////////
stock RentMotor(carid)
{
     for(new 
0sizeof(rentmotor); i++)
    {
        if(
carid == rentmotor[i])    return 1;
    }
    return 
1;

When i add this
PHP код:
else if(RentMotor(vozilo))
    {
         if(
Rentano[playerid] != vozilo)
           {
            
TogglePlayerControllable(playerid0);
            
GameTextForPlayer(playerid,"~w~Mozete rentati ovaj motor ~b~/rent ~w~ili ~b~/izlaz~n~~w~Cena Renta: ~g~80$",5000,3);
        }
    } 
As soon as i spawn it shows me that GameTextForPlayer and when i enter car it says that i can rent bike o.O. It only happens when i write that GameTextForPlayer for bikes.Any ideas??
Reply
#2

Hello!

PHP код:
stock RentMotor(carid)
{
    for(new 
0sizeof(rentmotor); i++)
    {
        if(
carid == rentmotor[i])    return 1;
    }
    return 
0;

return 1; => return 0;

This was the mistake.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)