giveplayeridcar?
#1

hi,i'm looking for a function like giveplayeridcar to give a player a specific id car(car id from /oldcar)or something like this.exist?
Reply
#2

need some help
Reply
#3

So basically you want a function that will take car of id say 3 and puts it beside or put them in it?

//This will check if someone else is driving the car, the last variable is optional to eject anyone in the vehicle
returns 0 - car is in use or does not exist 1 car available and returns
pawn Код:
stock giveplayeridcar(playerid, vehicleid, forceout=false)
{
 new Float:X, Float:Y, Float:Z, Float:A;
 GetVehiclePos(vehicleid, X, Y, Z);
 if(X==0 && Y==0 && Z == 0) return 0;
 for(new pid=0; pid < GetMaxPlayers(); pid++)
 {
  if(!IsPlayerConnected(pid) || GetPlayerVehicleID(pid)!=vehicleid) continue;
  if(!forceout) return 0;
  RemovePlayerFromVehicle(pid);
 }
 GetPlayerPos(pid, X, Y, Z);
 GetPlayerFacingAngle(pid, A);
 SetVehiclePos(X,Y,Z);
 PutPlayerInVehicle(playerid, vehicleid, 0);
 SetVehicleZAngle(vehicleid, A);
 return 1;
}
Reply
#4

so i have a car(let's say id 10).when a player type /tck give the player id car 10.

Reply
#5

And by give you mean take car 10 from wherever it is and put it either besdie the player or put the player in it where he is.

Thats what that function will do ^^

just do in your onplayercommandtext for /tck
then call the function with playerid, vehicleid and if you want, force.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)