SA-MP Forums Archive
how can i put player in vehicle they just spawned - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: how can i put player in vehicle they just spawned (/showthread.php?tid=145679)



how can i put player in vehicle they just spawned - iggy1 - 03.05.2010

i know there are lots of existing FS out there tht do this but im learning so i have this

Code:
CMD:spawn(playerid, params[])
{
  new idx;
  new cid;
  new tmp[256];
  new Float:x, Float:y, Float:z;
  GetPlayerPos(Pid,x,y,z);

  tmp = strtok(params, idx);
  if(isnull(params))
  {
    SendClientMessage(Pid, 0x00ff00FF, "usage /spawn [vehicleid]");
    return 1;
  }
  else
  {
  new Float:Xv;
  Xv = x -5.0;
  cid = strval(tmp);
  AddStaticVehicleEx(cid,Xv,y,z,180.0,-1,-1,0);
  return 1;
  }
}
so if someone would be so kind as to tell me how the fook to put the player in the vehicle that was spawned i b most greatfull thanks.

ps. im not being lazy iv tryed a few things none work


Re: how can i put player in vehicle they just spawned - SloProKiller - 03.05.2010

pawn Code:
CMD:spawn(playerid, params[])
{
  new idx;
  new cid, vid;
  new tmp[256];
  new Float:x, Float:y, Float:z;
  GetPlayerPos(Pid,x,y,z);

  tmp = strtok(params, idx);
  if(isnull(params))
  {
    SendClientMessage(Pid, 0x00ff00FF, "usage /spawn [vehicleid]");
    return 1;
  }
  else
  {
  new Float:Xv;
  Xv = x -5.0;
  cid = strval(tmp);
  vid = AddStaticVehicleEx(cid,Xv,y,z,180.0,-1,-1,0);
  PutPlayerInVehicle(playerid, vid, 0);
  return 1;
  }
}



Re: how can i put player in vehicle they just spawned - iggy1 - 03.05.2010

lol thanks for fast reply so simple was thinking to much into it nice1