/goto C-ordinate
#1

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

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

Is it able i can do this in a FS and also use ZCMD and sscanf2? cause i wanna use it temporary
Reply
#4

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

Код:
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;
}
Reply
#6

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)