How to spawn inside vehicle using cmdtext!, then deleting vehicle after spawn??!
#1

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!!
Reply
#2

Putplayerinvehicle ?
Reply
#3

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

it depends how u script it show your code
Reply
#5

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.
Reply
#6

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;
}
Reply
#7

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.
Reply
#8

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

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!
Reply
#10

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!
Reply
#11

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
Reply
#12

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
Reply
#13

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
Reply
#14

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;
}
Reply
#15

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!
Reply
#16

alright cool you helped me also on this post
Reply
#17

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!!
Reply
#18

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


Forum Jump:


Users browsing this thread: 3 Guest(s)