17.03.2015, 15:36
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:
Unrent command:
Rent dialog:
Thank you very much!
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(playerid, newstate, oldstate)
{
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;
}
PHP код:
CMD:unrentaj(playerid,params[])
{
new idcar = GetPlayerVehicleID(playerid);
if(Rentano[playerid] != 299)
{
if(idcar == Rentano[playerid])
{
TogglePlayerControllable(playerid, 1);
}
SetVehicleToRespawn(Rentano[playerid]);
Rentano[playerid] = 299;
SendClientMessage(playerid,-1,"{00C0FF}WG:{FFFFFF} Uspjesno ste unrentali vozilo");
}
return 1;
}
PHP код:
case DIALOG_RENT:
{
new poruka[128];
if(!response) SendClientMessage(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=0; i<MAX_PLAYERS; i++)
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;
}