Issue with Cars
#1

Well, I currently have a Stunt/Dm server etc.
But the issue is, I have set boundaries on the Dm places, so the pilots in the Hydra's cant get out of the Area, but I still think people will have the intelligence to come along and steal the planes without teleporting there...
So can Anyone provide a code that would make it possible to Lock the Vehicle or Eject the user on entering it if he hasn't teleported to my /adm tele
Or even provide a link to a place where I can learn it, and not links to websites, I mean direct links to the actual page etc.
Reply
#2

Any one Supply some help?
Reply
#3

This is pretty easy. When you create a vehicle, it returns the vehicle's id. You need to fetch the id and store it in a variable. Then, when a player enters the plane and is not a pilot or w/e, it needs to remove them. Or you can lock the plane's doors ( players can still get in the plane if someone leaves the doors open ).

pawn Код:
//Create a variable for the planes ( adjust the size of the variable for however many needed )
new Planes[4];

//Find when the vehicle is created
Planes[0] = AddStaticVehicle/CreateVehicle//...
Planes[1] = //The same
//Etc...

//Create this callback if not already there
public OnPlayerStateChange(playerid,newstate,oldstate)
{
  if(newstate == PLAYER_STATE_DRIVER)
  {
     if(GetPlayerVehicleID(playerid) == Planes[1])
     {
       if(//Use some variable to check if they are able to use these ( admin, etc.. ))
       {
          RemovePlayerFromVehicle(playerid);
          return 1;
       }
     }
     //Do the same for the other planes.
  }
  return 1;
}
Try that.
Reply
#4

Quote:
Originally Posted by backwardsman97
This is pretty easy. When you create a vehicle, it returns the vehicle's id. You need to fetch the id and store it in a variable. Then, when a player enters the plane and is not a pilot or w/e, it needs to remove them. Or you can lock the plane's doors ( players can still get in the plane if someone leaves the doors open ).

pawn Код:
//Create a variable for the planes ( adjust the size of the variable for however many needed )
new Planes[4];

//Find when the vehicle is created
Planes[0] = AddStaticVehicle/CreateVehicle//...
Planes[1] = //The same
//Etc...

//Create this callback if not already there
public OnPlayerStateChange(playerid,newstate,oldstate)
{
  if(newstate == PLAYER_STATE_DRIVER)
  {
    if(GetPlayerVehicleID(playerid) == Planes[1])
    {
       if(//Use some variable to check if they are able to use these ( admin, etc.. ))
       {
         RemovePlayerFromVehicle(playerid);
         return 1;
       }
    }
    //Do the same for the other planes.
  }
  return 1;
}
Try that.
Ahh ok thanks man, I appreciate the help I can get, I learn more from looking at things then reading how to make them, a combo of both is brilliant, but yeah, thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)