cordinate teleport -
popystone - 16.09.2012
Hi please i need help i want to make a simple cmd that you can use to teleport to cordinates like [x y z cords].
can someone help me with this please!!
Re: cordinate teleport -
clarencecuzz - 16.09.2012
STRCMP
pawn Код:
if(strcmp(cmdtext, "/teleport", true) == 0)
{
SetPlayerPos(playerid, X, Y, Z); //Replace X, Y and Z with your coords.
return 1;
}
ZCMD
pawn Код:
CMD:teleport(playerid,params[])
{
SetPlayerPos(playerid, X, Y, Z); //Replace X, Y and Z with your coords.
return 1;
}
Read this for more information:
https://sampwiki.blast.hk/wiki/SetPlayerPos
Re: cordinate teleport -
cosbraa - 16.09.2012
pawn Код:
CMD:tp(playerid, params[])
{
new int, Float: x, Float: y, Float: z;
if(sscanf(params, "dfff", int, x, y, z))
return SendClientMessage(playerid, GREY, "SYNTAX: /tp [int] [x] [y] [z]");
SetPlayerPos(playerid, x, y, z);
SetPlayerInterior(playerid, int);
return SendClientMessage(playerid, -1, "Teleport successful.");;
}
Added interior value incase you want to teleport to interiors aswell.
Re: cordinate teleport -
clarencecuzz - 16.09.2012
Well that's not a very 'simple' command, not one that newbies would understand straight up.
Re: cordinate teleport -
JaKe Elite - 16.09.2012
If you want to create a teleport with the vehicle support
add this to your teleport command
pawn Код:
if(IsPlayerInAnyVehicle(playerid)) //if player is in vehicle
{
SetPlayerVehiclePos(GetPlayerVehicleID(playerid), x, y, z); //change the x, y, z to your coordinate
SetPlayerVehicleZAngle(GetPlayerVehicleID(playerid), ang); //change the ang to your coordinate
LinkVehicleToInterior(GetPlayerVehicleID(playerid), int);
SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), world);
}
else //if player is onfoot
{
SetPlayerPos(playerid, x, y, z); //change the x, y, z to your coordinate
SetPlayerFacingAngle(playerid, ang); //change the ang to your coordinate
}
Re: cordinate teleport -
popystone - 17.09.2012
Quote:
Originally Posted by cosbraa
pawn Код:
CMD:tp(playerid, params[]) { new int, Float: x, Float: y, Float: z; if(sscanf(params, "dfff", int, x, y, z)) return SendClientMessage(playerid, GREY, "SYNTAX: /tp [int] [x] [y] [z]"); SetPlayerPos(playerid, x, y, z); SetPlayerInterior(playerid, int); return SendClientMessage(playerid, -1, "Teleport successful.");; }
Added interior value incase you want to teleport to interiors aswell.
|
hi i got this errors when i compiled
C:\Users\YOUNG MONEY\Desktop\SAMP scripts\1\Newport City Roleplay\gamemodes\EG-RP.pwn(35725) : warning 217: loose indentation
C:\Users\YOUNG MONEY\Desktop\SAMP scripts\1\Newport City Roleplay\gamemodes\EG-RP.pwn(35725) : error 029: invalid expression, assumed zero
C:\Users\YOUNG MONEY\Desktop\SAMP scripts\1\Newport City Roleplay\gamemodes\EG-RP.pwn(35725) : error 017: undefined symbol "cmd_tp"
C:\Users\YOUNG MONEY\Desktop\SAMP scripts\1\Newport City Roleplay\gamemodes\EG-RP.pwn(35725) : error 029: invalid expression, assumed zero
C:\Users\YOUNG MONEY\Desktop\SAMP scripts\1\Newport City Roleplay\gamemodes\EG-RP.pwn(35725) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
4 Errors.
Re: cordinate teleport -
newbienoob - 17.09.2012
pawn Код:
CMD:tp(playerid, params[])
{
new int, Float: x, Float: y, Float: z;
if(sscanf(params, "dfff", int, x, y, z)) return SendClientMessage(playerid, -1, "SYNTAX: /tp [int] [x] [y] [z]");
SetPlayerPos(playerid, x, y, z);
SetPlayerInterior(playerid, int);
SendClientMessage(playerid, -1, "Teleport successful.");
return 1;
}
Re: cordinate teleport -
JustinAn - 17.09.2012
Quote:
Originally Posted by popystone
hi i got this errors when i compiled
C:\Users\YOUNG MONEY\Desktop\SAMP scripts\1\Newport City Roleplay\gamemodes\EG-RP.pwn(35725) : warning 217: loose indentation
C:\Users\YOUNG MONEY\Desktop\SAMP scripts\1\Newport City Roleplay\gamemodes\EG-RP.pwn(35725) : error 029: invalid expression, assumed zero
C:\Users\YOUNG MONEY\Desktop\SAMP scripts\1\Newport City Roleplay\gamemodes\EG-RP.pwn(35725) : error 017: undefined symbol "cmd_tp"
C:\Users\YOUNG MONEY\Desktop\SAMP scripts\1\Newport City Roleplay\gamemodes\EG-RP.pwn(35725) : error 029: invalid expression, assumed zero
C:\Users\YOUNG MONEY\Desktop\SAMP scripts\1\Newport City Roleplay\gamemodes\EG-RP.pwn(35725) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
4 Errors.
|
You forgot to add the ZCMD include, which is a fast command processor.
Download:
Put that in your server folder then into the 'pawno' folder, in the folder called 'includes' where all the .inc files are located.
Now, compile your script.
Re: cordinate teleport -
XtremeR - 17.09.2012
pawn Код:
CMD:teleport(playerid, params[])
{
if(IsPlayerInAnyVehicle(playerid))
{
SetPlayerVehiclePos(GetPlayerVehicleID(playerid), x, y, z);
}
else
{
SetPlayerPos(playerid, x, y, z);
}
return 1;
}
A Simple one this should work