SA-MP Forums Archive
/goto command doenst work - 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 command doenst work (/showthread.php?tid=421531)



/goto command doenst work - HurtLocker - 09.03.2013

Well, here is my code:
Код:
#include <a_samp>
#include <sscanf2>
#include <zcmd>

CMD:goto(playerid, params[])
{
    new target;    
    if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, 0xFF0000AA, "USAGE: /goto [ID]");    
    new Float:tX,Float:tY,Float:tZ;
    new vehicleid = GetPlayerVehicleID(playerid);
    GetPlayerPos(targetid,tX,tY,tZ);
    if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: This player is not connected");
    if (vehicleid == 0)
    {
         SetPlayerPos(playerid,tX+1,tY+1,tZ);
    }
    else
    {
        SetVehiclePos(vehicleid,tX+2,tY+2,tZ);
        PutPlayerInVehicle(playerid,vehicleid,0);
    }
    return 1;
}
The problem is that when I write /goto [anynumberhere] i just get the message "error: the player is not connected"
Even if the id of the player online is valid.

Yes, I have written next to plugins "sscanf" in server.cfg
Yes, I have the zcmd and sscanf2 includes in pawno/include folder.
Please help!


Re: /goto command doenst work - sampreader - 09.03.2013

#include <a_samp>
#include <sscanf2>
#include <zcmd>
Код:
CMD:goto(playerid, params[])
{
    new target;    
    if(sscanf(params, "d", targetid)) return SendClientMessage(playerid, 0xFF0000AA, "USAGE: /goto [ID]");    
	if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: This player is not connected");
	
    new Float:tX, Float:tY, Float:tZ;
    new vehicleid = GetPlayerVehicleID(playerid);
    GetPlayerPos(targetid, tX, tY, tZ);
    
    if (vehicleid == 0)
    {
         SetPlayerPos(playerid, tX+1, tY+1, tZ);
    }
    else
    {
        SetVehiclePos(vehicleid, tX+2, tY+2, tZ);
        PutPlayerInVehicle(playerid, vehicleid, 0);
    }
    return 1;
}
try 'd' if ID


Re: /goto command doenst work - Mystique - 09.03.2013

Change
Код:
new target;
to
Код:
new targetid;



Re: /goto command doenst work - SilverKiller - 09.03.2013

Change
pawn Код:
new target;
To
pawn Код:
new targetid;
EDIT: too late.


Re: /goto command doenst work - HurtLocker - 09.03.2013

I dont know how this happened but my .pwn file has "new targetid;" so it's correct. But sampreader, the d letter is the solution!! Thank you a lot man!