SA-MP Forums Archive
I need Help with car rent system - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: I need Help with car rent system (/showthread.php?tid=82720)



I need Help with car rent system - Jakku - 20.06.2009

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.


Re: I need Help with car rent system - Think - 20.06.2009

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

if(vehicleid == rent1 && ispassenger == 0)


Re: I need Help with car rent system - Jakku - 20.06.2009

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

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