/goto command doenst work
#1

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!
Reply
#2

#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
Reply
#3

Change
Код:
new target;
to
Код:
new targetid;
Reply
#4

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

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!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)