SA-MP Forums Archive
I need /goto , Command please reply fast! - 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: I need /goto , Command please reply fast! (/showthread.php?tid=281130)



I need /goto , Command please reply fast! - [DU] - 04.09.2011

Hi guys my server is in build so I need a goto command fast.I've found one but doesen't work i have problems with it thanks if you help me with that.
The command when you just type /goto should be looking like this,
/goto [player,ID]
Thanks.
HostName: HostName: Life for Speed Drift4life 24/7
Address: 213.135.162.207:7777
Players: 15 / 50
Ping: 6
Mode: Life For Speed Drift 4 Life
Map: San Andreas
Guys none of these works!


Re: I need /goto , Command please reply fast! - =WoR=G4M3Ov3r - 04.09.2011

Using ZCMD

PHP код:
CMD:goto(playeridparams[]) 

    new 
ID
    new 
Str[64]; 
    if(
sscanf(params"u"ID)) SendClientMessage(playeridCOLOR_GREY"USAGE: /goto [playerid]"); 
    else if(
IsPlayerConnected(ID) == 0SendClientMessage(playeridCOLOR_GREY"Player is not connected!"); 
    new 
Float:xFloat:yFloat:z
    
GetPlayerPos(IDxyz); 
    
SetPlayerPos(playeridx+1y+1z); 
    return 
1




Re: I need /goto , Command please reply fast! - Wesley221 - 04.09.2011

It would help if you show us the code.

pawn Код:
command(goto, playerid, params[])
{
    new ID;
    if(sscanf(params, "u", ID)) SendClientMessage(playerid, 0xF97804FF, "USAGE: /goto [id]");
    else if(ID == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xF97804FF, "Player is not connected!");
    else
    {
    new Float:x, Float:y, Float:z;
    GetPlayerPos(ID, x, y, z);
    SetPlayerPos(playerid, x+1, y+1, z);
    }
    return 1;
}
Rough example


Re : I need /goto , Command please reply fast! - Lhine.S - 04.09.2011

Past this OnGameModeInit
Quote:

if(strcmp( cmd, "/got", true ) == 0)
{
new tmp[256];
tmp = strtok(cmdtext,idx);
if(!strlen(tmp)) { return 1; }

new Float:X, Float:Y, Float:Z;

if(GetPlayerVehicleID(playerid))
{
GetPlayerPos( strval(tmp), X, Y, Z );
SetVehiclePos( GetPlayerVehicleID(playerid), X+2, Y+2, Z );
} else {
GetPlayerPos( strval(tmp), X, Y, Z );
SetPlayerPos( playerid, X+2, Y+2, Z );
}
return 1;
}




Re: Re : I need /goto , Command please reply fast! - Kingunit - 04.09.2011

Quote:
Originally Posted by Lhine.S
Посмотреть сообщение
Past this OnGameModeInit
Bro, learn to use some TABS.

pawn Код:
/-----[Goto]-----
CMD:goto(playerid, params[])
{
    new targetid, string[128];
    if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_WHITE, "[CMD] /[PlayerID/PartOfName]");
    if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "[ERROR] Player not connected!");
    else
    {
        new pName[24];
        GetPlayerName(targetid,pName,128);
        format(string, sizeof(string), "You succesfully teleported to [%d] %s.",targetid, pName);
        SendClientMessage(playerid,COLOR_RED,string);
        SetPlayerInterior(playerid,GetPlayerInterior(targetid));
        new Float:TPX, Float:TPY, Float:TPZ;
        GetPlayerPos(targetid, TPX, TPY, TPZ);
        SetPlayerPos(playerid, TPX, TPY, TPZ+1);
    }
    return 1;
}



Re: I need /goto , Command please reply fast! - Darnell - 04.09.2011

You forgot to add an ' / ' there Kingunit.


Re: I need /goto , Command please reply fast! - Kingunit - 04.09.2011

Oh yeah I see, sorry:

pawn Код:
//-----[Goto]-----
CMD:goto(playerid, params[])
{
    new targetid, string[128];
    if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_WHITE, "[CMD] /[PlayerID/PartOfName]");
    if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "[ERROR] Player not connected!");
    else
    {
        new pName[24];
        GetPlayerName(targetid,pName,128);
        format(string, sizeof(string), "You succesfully teleported to [%d] %s.",targetid, pName);
        SendClientMessage(playerid,COLOR_RED,string);
        SetPlayerInterior(playerid,GetPlayerInterior(targetid));
        new Float:TPX, Float:TPY, Float:TPZ;
        GetPlayerPos(targetid, TPX, TPY, TPZ);
        SetPlayerPos(playerid, TPX, TPY, TPZ+1);
    }
    return 1;
}