[SOLVED]Detect a player in car ?
#1

I made a command on my server that when the player types it in, it puts him in a RC vehicle.

Now the problem is, that if someone already is in that vehicle others can still type in that command and 2 (or more) players would end up together in that RC vehicle as drivers (and thats not fun )

Is there a way to detect is that RC vehicle free ?

So if it's free, it would normally put player in the vehicle, and if it's not it would display a message like "The RC vehicle is being used, try again later."

Thanks for your answers
Reply
#2

pawn Код:
//top
new
  theRC;

//in creation
  theRC = CreateVehicle( .......................

//in your command
  bool: allowed = true;
  for ( new i; i < MAX_PLAYERS; i ++ )
  {
    if ( GetPlayerVehicleID( i ) == theRC )
    {
      allowed = false;
      break;
    }
  }
  if ( allowed ) PutPlayerInVehicle( ..........
  else SendClientMessage( ............., "that vehicle is taken, blah blah.........."
Reply
#3

Thanks Donny, it works
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)