SA-MP Forums Archive
goto cordinate - 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)
+--- Thread: goto cordinate (/showthread.php?tid=458962)



goto cordinate - Admin22 - 19.08.2013

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


Re: goto cordinate - AfikAtashga - 19.08.2013

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.


Re: goto cordinate - Admin22 - 19.08.2013

i dont have strtok


Re: goto cordinate - Vanter - 19.08.2013

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


Re: goto cordinate - Max5 - 19.08.2013

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;
}