I need Help with car rent system
#1

Hello guys!

I decided to make a car renting system. Now I have problems with it


These are defined

pawn Код:
new rent1;
new rent2;
new rent3;
new rent4;
new rent5;
Following vehicles created:

pawn Код:
rent1 = CreateVehicle(411, 1979.2745,2057.9265,10.5474,356.2919, 0, 1, 800); //RentInfernus
rent2 = CreateVehicle(451, 1986.1975,2058.6926,10.5271,2.2146, 0, 1, 800); // RentTurismo
rent3 = CreateVehicle(410, 1991.7778,2059.3577,10.4760,2.3409, 0, 1, 800);// RentManana
rent4 = CreateVehicle(400, 1993.6920,2053.1448,10.9125,270.0105, 0, 1, 800);// RentLandstalker
rent5 = CreateVehicle(536, 1992.2272,2037.8275,10.5506,269.4868, 0, 1, 800);// RentBlade

And OnPlayerEnterVehicle- Callback:

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
     }
     if (GetVehicleModel(vehicleid) == rent1 && ispassenger == 0)
    {
        GameTextForPlayer(playerid,"You can rent this Infernus for 15000$. ~n~ Use /rentcar to rent it",10000,6);
        SendClientMessage(playerid,COLOR_YELLOW, "If you want to exit, use /exit");
        TogglePlayerControllable(playerid, 0);
    }
    else if (GetVehicleModel(vehicleid) == rent2 && ispassenger == 0)
    {
        GameTextForPlayer(playerid,"You can rent this Turismo for 15000$. ~n~ Use /rentcar to rent it",10000,6);
        SendClientMessage(playerid,COLOR_YELLOW, "If you want to exit, use /exit");
        TogglePlayerControllable(playerid, 0);
    }
    else if (GetVehicleModel(vehicleid) == rent3 && ispassenger == 0)
    {
        GameTextForPlayer(playerid,"You can rent this Manana for 15000$. ~n~ Use /rentcar to rent it",10000,6);
        SendClientMessage(playerid,COLOR_YELLOW, "If you want to exit, use /exit");
        TogglePlayerControllable(playerid, 0);
    }
    else if (GetVehicleModel(vehicleid) == rent4 && ispassenger == 0)
    {
        GameTextForPlayer(playerid,"You can rent this Landstalker for 15000$. ~n~ Use /rentcar to rent it",10000,6);
        SendClientMessage(playerid,COLOR_YELLOW, "If you want to exit, use /exit");
        TogglePlayerControllable(playerid, 0);
    }
    else if (GetVehicleModel(vehicleid) == rent5 && ispassenger == 0)
    {
        GameTextForPlayer(playerid,"You can rent this Blade for 15000$. ~n~ Use /rentcar to rent it",10000,6);
        SendClientMessage(playerid,COLOR_YELLOW, "If you want to exit, use /exit");
        TogglePlayerControllable(playerid, 0);
    }
    return 1;
}

And the problem is: When I enter those vehicles, GameTextForPlayer doesn't appear, and it doesn't freeze the player.
Reply
#2

your using 'GetVehicleModel' use use the vehicleid instead. so:

if(vehicleid == rent1 && ispassenger == 0)
Reply
#3

Quote:
Originally Posted by Pandabeer1337
your using 'GetVehicleModel' use use the vehicleid instead. so:

if(vehicleid == rent1 && ispassenger == 0)
Okay thanks man
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)