/goto C-ordinate - 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: /goto C-ordinate (
/showthread.php?tid=266549)
/goto C-ordinate -
Karl1195 - 05.07.2011
Hey guys i have been thinking about to do a teleportation instade of /goto player /goto x,y,z but i gave up doing it few weeks ago. But now i am really in need of this can some one Help me do it.
Thanks a lot
Karl1195.
Re: /goto C-ordinate -
Wesley221 - 05.07.2011
pawn Код:
COMMAND:tele(playerid, cmdtext[])
{
new X, Y, Z, string[128];
if(sscanf(cmdtext, "iii", X, Y, Z)) return SendClientMessage(playerid, -1, " ** Usage: /tele [x] [y] [z] ");
SetPlayerPos(playerid, X, Y, Z);
format(string, sizeof string, "You teled to: X:%i, Y:%i, Z:%i ", X, Y, Z);
SendClientMessage(playerid, -1, string);
return 1;
}
Should look like this, although this is a rough example, and im not sure if it gives any errors!
ZCMD & sscanf2 is needed for this
Re: /goto C-ordinate -
Karl1195 - 05.07.2011
Is it able i can do this in a FS and also use ZCMD and sscanf2? cause i wanna use it temporary
Re: /goto C-ordinate -
HyperZ - 05.07.2011
Quote:
Originally Posted by Wesley221
pawn Код:
COMMAND:tele(playerid, cmdtext[]) { new X, Y, Z, string[128]; if(sscanf(cmdtext, "iii", X, Y, Z)) return SendClientMessage(playerid, -1, " ** Usage: /tele [x] [y] [z] "); SetPlayerPos(playerid, X, Y, Z); format(string, sizeof string, "You teled to: X:%i, Y:%i, Z:%i ", X, Y, Z); SendClientMessage(playerid, -1, string); return 1; }
Should look like this, although this is a rough example, and im not sure if it gives any errors!
ZCMD & sscanf2 is needed for this
|
It should be
pawn Код:
CMD:goto(playerid, params[])
{
new
string[128],
Float:Pos[3]
;
if(sscanf(params, "fff", Pos[0], Pos[1], Pos[2]))
return SendClientMessage(playerid, -1, "/goto[positionX] [positionY] [positionZ]");
SetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
format(string, sizeof(string), "You have set yourself to position: %f %f %f.", Pos[0], Pos[1], Pos[2]);
SendClientMessage(playerid, -1, string);
return 1;
}
Created with Zcmd and Sscanf2.
Re: /goto C-ordinate -
Karl1195 - 05.07.2011
Код:
CMD:goto(playerid, params[])
{
new
string[128],
Float:Pos[3]
;
if(sscanf(params, "fff", Pos[0], Pos[1], Pos[2]))
return SendClientMessage(playerid, -1, "/goto[positionX] [positionY] [positionZ]");
SetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
format(string, sizeof(string), "You have set yourself to position: %f %f %f.", Pos[0], Pos[1], Pos[2]);
SendClientMessage(playerid, -1, string);
return 1;
}
Re: /goto C-ordinate -
HyperZ - 05.07.2011
Quote:
Originally Posted by Karl1195
Код:
CMD:goto(playerid, params[])
{
new
string[128],
Float:Pos[3]
;
if(sscanf(params, "fff", Pos[0], Pos[1], Pos[2]))
return SendClientMessage(playerid, -1, "/goto[positionX] [positionY] [positionZ]");
SetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
format(string, sizeof(string), "You have set yourself to position: %f %f %f.", Pos[0], Pos[1], Pos[2]);
SendClientMessage(playerid, -1, string);
return 1;
}
So i should just put it like this in the script and add the includes?
|
Yes.
Sscanf2 Zcmd.
Re: /goto C-ordinate -
Karl1195 - 05.07.2011
So i should just put it like this in the script and add the includes?
Код:
CMD:goto(playerid, params[])
shouldn't i change that??
to example :
Код:
if(strcmp(cmd, "/gotoc [X] [Y] [Z]", true) == 0)
or some thing.
Cause i am adding to a FS
Re: /goto C-ordinate -
HyperZ - 05.07.2011
Quote:
Originally Posted by Karl1195
So i should just put it like this in the script and add the includes?
Код:
CMD:goto(playerid, params[])
shouldn't i change that??
to example :
Код:
if(strcmp(cmd, "/gotoc [X] [Y] [Z]", true) == 0)
or some thing.
Cause i am adding to a FS
|
Nah.. its created with sscanf and zcmd. you can't use strcmp.