SA-MP Forums Archive
NEED HELP - 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: NEED HELP (/showthread.php?tid=78770)



NEED HELP - Vaibhav - 23.05.2009

Hello guys,

I am a beginner scripter.I want to know how to make some simple commands like /bike,/car etc...
And how to make a teleport command which tele us to a place with our vehicle.Thanks

-Vaibhav


Re: NEED HELP - Ignas1337 - 23.05.2009

first, you got to get the coordinates for the teleport location. use the debugger mode and /save function. there will be savedpositions file in your gta directory if you /save. the command is like /save [comment] so you should enter something like /save telespot1 to recognise the info. Next if you were on foot there should be AddPlayerClass(blablabla, coordinates, weapons, ..). You need to get the first three coordinates. They are as following: x, y, z. then there is angle. if you want you can use that one too.

now for the command i use dcmd function, but as ou're new you could use strcmp just now.

pawn Код:
//OnPlayerCommandText(playerid, cmdtext[])
if(strcmp(cmdtext, "/goto_cars", true) == 0)
{
SetPlayerPos(playerid, /*coordinate x*/, /*coordinate y*/, /*coordinate z*/);
/* use this if you want to us angle :*/
SetPlayerFacingAngle(playerid, /* angle here);
return SendClientMessage(playerid, 0xFFFFFFFF, "You have been teleported to cars!");
}
note to replace my comments wit actual x y z and angle coordinates.

hope it helped!


Re: NEED HELP - CJ101 - 23.05.2009

The Wiki is your best friend


Re: NEED HELP - Vaibhav - 23.05.2009

Quote:
Originally Posted by Ignas1337
first, you got to get the coordinates for the teleport location. use the debugger mode and /save function. there will be savedpositions file in your gta directory if you /save. the command is like /save [comment] so you should enter something like /save telespot1 to recognise the info. Next if you were on foot there should be AddPlayerClass(blablabla, coordinates, weapons, ..). You need to get the first three coordinates. They are as following: x, y, z. then there is angle. if you want you can use that one too.

now for the command i use dcmd function, but as ou're new you could use strcmp just now.

pawn Код:
//OnPlayerCommandText(playerid, cmdtext[])
if(strcmp(cmdtext, "/goto_cars", true) == 0)
{
SetPlayerPos(playerid, /*coordinate x*/, /*coordinate y*/, /*coordinate z*/);
/* use this if you want to us angle :*/
SetPlayerFacingAngle(playerid, /* angle here);
return SendClientMessage(playerid, 0xFFFFFFFF, "You have been teleported to cars!");
}
note to replace my comments wit actual x y z and angle coordinates.

hope it helped!
Thanks
ill go and test it.


Re: NEED HELP - Vaibhav - 23.05.2009

Ok this teleport is working and what about /bike and /car command?
Or do you know how to make a command which looks like this /car [Vehicle ID/Vehicle name]


Re: NEED HELP - Lewwy - 23.05.2009

It doesn't work because you need the correct coordinates, and replace it with the commented text.