rent - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: rent (
/showthread.php?tid=611456)
rent -
Micko123 - 06.07.2016
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(playerid, newstate, oldstate)
{
new vozilo = GetPlayerVehicleID(playerid);
if(RentAuta(vozilo))
{
if(Rentano[playerid] != vozilo)
{
TogglePlayerControllable(playerid, 0);
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(playerid, 0);
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 i = 0; i < sizeof(rentauta); i++)
{
if(carid == rentauta[i]) return 1;
}
return 0;
}
////////////////////////////////////////////////////////////////////////////////
stock RentMotor(carid)
{
for(new i = 0; i < sizeof(rentmotor); i++)
{
if(carid == rentmotor[i]) return 1;
}
return 1;
}
When i add this
PHP код:
else if(RentMotor(vozilo))
{
if(Rentano[playerid] != vozilo)
{
TogglePlayerControllable(playerid, 0);
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??
Re: rent -
Mencent - 06.07.2016
Hello!
PHP код:
stock RentMotor(carid)
{
for(new i = 0; i < sizeof(rentmotor); i++)
{
if(carid == rentmotor[i]) return 1;
}
return 0;
}
return 1; => return 0;
This was the mistake.