SA-MP Forums Archive
How to spawn inside vehicle using cmdtext!, then deleting vehicle after spawn??! - 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 to spawn inside vehicle using cmdtext!, then deleting vehicle after spawn??! (/showthread.php?tid=103446)



How to spawn inside vehicle using cmdtext!, then deleting vehicle after spawn??! - DualDier12 - 19.10.2009

Yeah I need some help, um..what is the syntax for if I wanna do something like this:

When I type a command, such as "/monster" I want it to spawn me inside a monster truck instantly in my current position.

How would you set up the syntax for something like that? Anyone help me please?

(EDIT): Well the code works now..Thanks for it but I've ran into something else. Whenever I type in "/monster" and I spawn in the truck..when I get out..the truck STAYS there permanently..even if destroyed..it just respawns. Is there a way to make it so that like if I spawn "/monster" somewhere else..the previous one I spawned disappears..or like if I get out of the truck and no one is in it..get just disappears from being idle? Is there a way we can do that?? Cuz if I just let people spawn monster truck after monster truck..it will slow my server down majorly. Anyone?

(EDIT): I'm kinda a pawno noobie..so help me out here. I'm doing my best to learn the codes!!


Re: How to spawn inside vehicle using cmdtext! - Trooper[Y] - 19.10.2009

Putplayerinvehicle ?


Re: How to spawn inside vehicle using cmdtext! - DualDier12 - 19.10.2009

Quote:
Originally Posted by Trooper[Y
]
Putplayerinvehicle ?
I tried that..but it didn't work.


Re: How to spawn inside vehicle using cmdtext! - kman - 19.10.2009

it depends how u script it show your code


Re: How to spawn inside vehicle using cmdtext! - DualDier12 - 19.10.2009

if (strcmp("/monster", cmdtext, true, == 0)
{
PutPlayerInVehicle(playerid,556,0);
return 1;
}


That doesn't work. There's way more to it and I know there is.


Re: How to spawn inside vehicle using cmdtext! - Smokey619 - 19.10.2009

ok their i have it i tested and working the monster truck is 444

if (strcmp(cmdtext, "/monster", true) == 0)
{
PutPlayerInVehicle(playerid,444,0);
return 1;
}


Re: How to spawn inside vehicle using cmdtext! - DualDier12 - 19.10.2009

Like, in LADMIN, if you type "/lcar" you spawn in a cheetah wherever you are ..and instantly. I wanna do that except..changing it. I can't find the code in Ladmin,..the .pwn file is friggin massive! So I am trying to figure out the syntax for doing my own cmdtext vehicle instant spawns.


Re: How to spawn inside vehicle using cmdtext! - Smokey619 - 19.10.2009

oh yeah im also trying to do that because the code i posted on top just tele me to the truck


Re: How to spawn inside vehicle using cmdtext! - DualDier12 - 19.10.2009

Quote:
Originally Posted by Smokey619
ok their i have it i tested and working the monster truck is 444

if (strcmp(cmdtext, "/monster", true) == 0)
{
PutPlayerInVehicle(playerid,444,0);
return 1;
}
Um that doesn't work. Where does the vehicle spawn from? Are you SURE this works? This is impossible! That does not work!


Re: How to spawn inside vehicle using cmdtext! - DualDier12 - 19.10.2009

Quote:
Originally Posted by Smokey619
oh yeah im also trying to do that because the code i posted on top just tele me to the truck
Yeah, it doesn't work. It's something way different I'm sure of it. Does anyone know the syntax for that? You can do it in LADMIN!! Example : /lcar instantly spawns you inside a cheetah! I wanna do that except using my own vehicle ids!


Re: How to spawn inside vehicle using cmdtext! - Daren_Jacobson - 20.10.2009

pawn Код:
if (strcmp(cmdtext, "/monster", true) == 0)
{
  new Float:x, Float:y, Float:z, Float:angle;
  GetPlayerPos(playerid, x, y, z);
  GetPlayerFacingAngle(playerid, angle)
  PutPlayerInVehicle(playerid, CreateVehicle(556, x, y, z, angle, -1, -1, -1), 0);
  return 1;
}
should work, untested



Re: How to spawn inside vehicle using cmdtext! - Smokey619 - 20.10.2009

thanks man it works

Quote:
Originally Posted by Daren_Jacobson
pawn Код:
if (strcmp(cmdtext, "/monster", true) == 0)
{
 new Float:x, Float:y, Float:z, Float:angle;
 GetPlayerPos(playerid, x, y, z);
 GetPlayerFacingAngle(playerid, angle)
 PutPlayerInVehicle(playerid, CreateVehicle(556, x, y, z, angle, -1, -1, -1), 0);
 return 1;
}
should work, untested



Re: How to spawn inside vehicle using cmdtext! - DualDier12 - 20.10.2009

Quote:
Originally Posted by Smokey619
thanks man it works

Quote:
Originally Posted by Daren_Jacobson
pawn Код:
if (strcmp(cmdtext, "/monster", true) == 0)
{
 new Float:x, Float:y, Float:z, Float:angle;
 GetPlayerPos(playerid, x, y, z);
 GetPlayerFacingAngle(playerid, angle)
 PutPlayerInVehicle(playerid, CreateVehicle(556, x, y, z, angle, -1, -1, -1), 0);
 return 1;
}
should work, untested
: number of arguments does not match definition
: error 001: expected token: ";", but found "-identifier-"
: warning 217: loose indentation

I get these errors when I put in the code..before compile


Re: How to spawn inside vehicle using cmdtext! - Smokey619 - 20.10.2009

here he missed a part

if (strcmp(cmdtext, "/monster", true) == 0)
{
new Float, Float:y, Float:z, Float:angle;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, angle);
PutPlayerInVehicle(playerid, CreateVehicle(556, x, y, z, angle, -1, -1, -1), 0);
return 1;
}


Re: How to spawn inside vehicle using cmdtext! - DualDier12 - 20.10.2009

Quote:
Originally Posted by Smokey619
here he missed a part

if (strcmp(cmdtext, "/monster", true) == 0)
{
new Float, Float:y, Float:z, Float:angle;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, angle);
PutPlayerInVehicle(playerid, CreateVehicle(556, x, y, z, angle, -1, -1, -1), 0);
return 1;
}
There's nothing DIFFERENT about this code than what he put!! What did you change?

(EDIT): Nevermind, I found the difference. Now to see if it works!


Re: How to spawn inside vehicle using cmdtext! - Smokey619 - 20.10.2009

alright cool you helped me also on this post


Re: How to spawn inside vehicle using cmdtext! - DualDier12 - 20.10.2009

Well the code works now..Thanks for it but I've ran into something else. Whenever I type in "/monster" and I spawn in the truck..when I get out..the truck STAYS there permanently..even if destroyed..it just respawns. Is there a way to make it so that like if I spawn "/monster" somewhere else..the previous one I spawned disappears..or like if I get out of the truck and no one is in it..get just disappears from being idle? Is there a way we can do that?? Cuz if I just let people spawn monster truck after monster truck..it will slow my server down majorly. Anyone?

(EDIT): I'm kinda a pawno noobie..so help me out here. I'm doing my best to learn the codes!!


Re: How to spawn inside vehicle using cmdtext! - kman - 20.10.2009

what about command /callcar which gets the last car you entered