SA-MP Forums Archive
zcmd xgoto +rep - 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: zcmd xgoto +rep (/showthread.php?tid=534154)



zcmd xgoto +rep - JakeHunter1 - 28.08.2014

Can somone tell me how to make to teleport on cords /xgoto z x like that ..
example /xgoto 2350.339843 -1181.649902 1027.976562


Re: zcmd xgoto +rep - Sledgehammer - 28.08.2014

pawn Код:
COMMAND:gotoco(playerid, params[])
{
    new Float:x, Float:y,  Float:z;
    if(sscanf(params, "fff", x, y, z)) return SendClientMessage(playerid, -1, "(USAGE) /xogotoco[x][y][z]");
    SetPlayerPos(playerid, x,y,z);
    return 1;
}
You using sscanf? Thats what I used for the params to check if the player has entered the correct details.

EDIT: I've fixed the code; Should all work now.


Re: zcmd xgoto +rep - SanAndreasMP - 28.08.2014

@Death1300 : You forgot a params, you put only 3. "fff" - x, y, z. and where's of world?


pawn Код:
CMD:gotoco(playerid, params[])
{
    new string[300], Float:x, Float:y,  Float:z, interior, world;
    if(sscanf(params, "fffd", x, y, z, interior, world)) return SendClientMessage(playerid, -1, "(USAGE) /xogotoco[x][y][z]");
    SetPlayerPos(playerid, x,y,z);
    SetPlayerVirtualWorld(playerid, world);
    return 1;
}



Re: zcmd xgoto +rep - JakeHunter1 - 28.08.2014

I'm using zcmd ..

Thanks you both i +rep you both


Re: zcmd xgoto +rep - iFarbod - 28.08.2014

Fixed version of Death1300's solution:

pawn Код:
CMD:xgoto(playerid, params[])
{
    new
        string[300],
        Float:x,
        Float:y,
        Float:z,
        interiorid;
    if(sscanf(params, "fffD(0)", x, y, z, interiorid)) return SendClientMessage(playerid, -1, "(USAGE) /xgoto[x][y][z] <Interior ID>");
    SetPlayerPos(playerid, x,y,z);
    SetPlayerInterior(playerid, interiorid);
    return 1;
}



Re: zcmd xgoto +rep - Sledgehammer - 28.08.2014

You only using zcmd? I've pusmed that you had sscanf too?

Edit: I apologize for the mistakes I made in the code. I just copied it from my script that I'm currently making (from scratch) but its all fixed now


Re: zcmd xgoto +rep - JakeHunter1 - 28.08.2014

Ty all +rep ..


Re: zcmd xgoto +rep - Don_Cage - 28.08.2014

Quote:
Originally Posted by iFarbod
Посмотреть сообщение
Fixed version of Death1300's solution:

pawn Код:
CMD:xgoto(playerid, params[])
{
    new
        string[300],
        Float:x,
        Float:y,
        Float:z,
        interiorid;
    if(sscanf(params, "fffD(0)", x, y, z, interiorid)) return SendClientMessage(playerid, -1, "(USAGE) /xgoto[x][y][z] <Interior ID>");
    SetPlayerPos(playerid, x,y,z);
    SetPlayerInterior(playerid, interiorid);
    return 1;
}
Useless string, you don't do anything with it.