09.04.2015, 13:10
Listen,you are checking if player is renting a car,if he is renting any car it shows him that this car is rented,you should change your OnPlayerStateChange code,add these
and under the code that lets the player rent the car,add:
and when he unrents:
and to detect if player is renting the car he entered use:
pawn Код:
new PlayerRentedVehicleID[MAx_PLAYERS];
pawn Код:
PlayerRentedVehicleID[playerid] = GetPlayerVehicleID(playerid);
pawn Код:
PlayerRentedVehicleID[playerid] = 0;
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new Vozilo = GetPlayerVehicleID(playerid);
{
if(newstate == PLAYER_STATE_DRIVER && Vozilo == Rent[0] || Vozilo == Rent[1] || Vozilo == Rent[2] || Vozilo == Rent[3] || Vozilo == Rent[4] || Vozilo == Rent[5] || Vozilo == Rent[6] || Vozilo == Rent[7])
{
if(Rentano[playerid] == 0 && PlayerRentedVehicleID[playerid] == 0)
{
ShowPlayerDialog(playerid,DIALOG_RENT,DIALOG_STYLE_LIST,""COLOR_ZUTA"Rent Vozila","{FFFFFF} ** "COLOR_SIVA"5 {FFFFFF}minuta\n** "COLOR_SIVA"15 {FFFFFF} minuta\n** "COLOR_SIVA"30 {FFFFFF} minuta","Iznajmi","Izlaz");
TogglePlayerControllable(playerid,0);
}
else if(Rentano[playerid] == 1 && PlayerRentedVehicleID[playerid] != Vozilo)
{
RemovePlayerFromVehicle(playerid); //he has rented a car but this is not his rented car
}
else
{
SendClientMessage(playerid, -1, "This is your rented car"); //he entered his rented vehicle
}
}
return 1;
}
}