Need Code
#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
pawn Код:
new PlayerRentedVehicleID[MAx_PLAYERS];
and under the code that lets the player rent the car,add:
pawn Код:
PlayerRentedVehicleID[playerid] = GetPlayerVehicleID(playerid);
and when he unrents:
pawn Код:
PlayerRentedVehicleID[playerid] = 0;
and to detect if player is renting the car he entered use:
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;
    }
}
Reply


Messages In This Thread
Need Code - by NoDi522 - 09.04.2015, 10:00
Re: Need Code - by JeaSon - 09.04.2015, 10:05
Re: Need Code - by NoDi522 - 09.04.2015, 10:10
Re: Need Code - by NoDi522 - 09.04.2015, 11:09
Re: Need Code - by NoDi522 - 09.04.2015, 12:41
AW: Need Code - by Mencent - 09.04.2015, 12:51
Re: Need Code - by NoDi522 - 09.04.2015, 12:54
Re: Need Code - by [ABK]Antonio - 09.04.2015, 12:58
Re: Need Code - by NoDi522 - 09.04.2015, 13:00
Re: Need Code - by R0 - 09.04.2015, 13:10

Forum Jump:


Users browsing this thread: 2 Guest(s)