goto cordinate
#1

Can any one tell me code to make goto cordinate commands..
Reply
#2

You need to use strtok.
If you haven't strtok, tell me.
OnPlayerCommandText:
Код:
new cmd[50];
cmd = strtok(cmdtext, idx);
if(!strcmp(cmd, "/Teleport", true))
{
new tmp[128], tmp2[128];
cmd = strtok(cmdtext, idx);
tmp = strtok(cmdtext, idx);
tmp2 = strtok(cmdtext, idx);
if(!strlen(cmd) || !strlen(tmp) || !strlen(tmp2)) return SendClientMessage(playerid, 0x808080FF, "/Teleport [x] [y] [z]");
new Float:x = Floatstr(cmd), Float:y = Floatstr(tmp), Float:z = Floatsr(tmp2));
SetPlayerPos(playerid, x, y, z);
return SendClientMessage(playerid, 0xFFFFFFFF, "You have been teleported succesfully.");
}
*Write in the forum.
Reply
#3

i dont have strtok
Reply
#4

SEARCH BEFORE POSTING
https://sampwiki.blast.hk/wiki/Creating_Commands
Reply
#5

Like this?
pawn Код:
CMD:gotocoord(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 3)
    {
        new Float: pos[3], int;
        if(sscanf(params, "fffd", pos[0], pos[1], pos[2], int)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /gotocoord [x coordinate] [y coordinate] [z coordinate] [interior]");

        SendClientMessageEx(playerid, COLOR_GRAD2, "You have been teleported to the coordinates specified.");
        SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
        SetPlayerInterior(playerid, int);
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)