SA-MP Forums Archive
Renting Car 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)
+--- Thread: Renting Car system (/showthread.php?tid=460196)



Renting Car system - TranquiliZed - 27.08.2013

I am making a car rent system. So far I have the cars defined as rentcars. I also have so when you enter then it brings up a dialog asking whether to rent or to get out. I need to know what would be the best way about defining the rent cars to that player for 30 minutes.

pawn Код:
if(dialogid == RENT_MENU)
{
    if(response)
    {

    }
}



Re: Renting Car system - PaulDinam - 27.08.2013

Best thing is to make a var for player for instance:
RentVehicle[MAX_PLAYERS];

When player connects:
RentVehicle[playerid] = INVALID_VEHICLE_ID;

pawn Код:
stock IsVehicleRented(vehicle)
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        return true;
    }
    return false;
}
OnPlayerStateChange:
if the player is driver as a new state, use the stock above and send him the proper messages.

In /rentvehicle cmd also check if the vehicle is taken by someone else if not then just set the RentVehicle value to the vehicle id.