rent car
#1

Hello!

Im making rent car system but i dont understand how can i make that no one can enter car if that is already rented.

Like this

P.S this code is just fast example, hope you understand me

Код:
CMD:rentcar(playerid,params[])
{
if(!IsRented(playerid)) return scm(playerid, -1, "This car is already rented);
{
SetRented to car !!!!!!!
SCM(playerid,-1,"You have rented this car");
return 1;
}

Onplayerenterveh
if(IsRented(playerid)) 
{
removeplayerfromveh

stock IsRented
SetRented to car !!!!!!!
Reply
#2

you should not use "IsRented(playerid)" but "IsRented(vehicleid)"
Reply
#3

Can you give me code how can i set it to vehicleid?
Reply
#4

Anyone?
Reply
#5

.... you might just want to look over tutorials... if you dont know how to change playerid in vehicleid...

SIMPLY REPLACE THE TEXT jeez

Its basic pawn..
Reply
#6

<removed>

use a global variable...
soemthing like this:
Код:
new rented[MAX_VEHICLES];

public OnVehicleSpawn(vehicleid)
{
   rented[vehicleid] = 0;
   return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
   if(newstate == PLAYER_STATE_DRIVER)
   {
      new vehicleid = GetPlayerVehicleID(playerid);
      if(IsRented(vehicleid))
      {
         RemovePlayerFromVehicle(playerid);
      }
   }
   return 1;
}

stock IsRented(vehicleid)
{
   return rented[vehicleid];
}
and when a player rents a vehicle you ofc have to use:
Код:
rented[vehicleid] = 1;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)