SA-MP Forums Archive
sscanf command problem - 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: sscanf command problem (/showthread.php?tid=305444)



sscanf command problem - spedico - 22.12.2011

Making admin commands with sscanf, the commands won't work for ID 0, it just does the action for yourself (like, /kick 5 and it kicks you instead of ID 5)

my code, the problem shouldn't be in it because copypasting other peoples goto commands won't work either.
Код:
command(goto, playerid, params[])
{
	new tPlayer;
	if(!sscanf(params, "u", tPlayer))
 	{
	  	new Float:X, Float:Y, Float:Z, string[128];
	 	SetPlayerInterior(playerid, GetPlayerInterior(tPlayer));
	  	GetPlayerPos(tPlayer, X, Y, Z);
	   	SetPlayerPos(playerid, X, Y, Z + 5);
		format(string, sizeof(string), ""GREEN"Successfully teleported to "YELLOW"'%s'"GREEN".", GetName(tPlayer));
		SendClientMessage(playerid, -1, string);
		SendClientMessage(tPlayer, -1, ""RED"An admin has teleported to you.");
	}
	else return SendClientMessage(playerid, -1, ""RED"Usage: /goto <player>");
	return 1;
}



Re: sscanf command problem - Ash. - 22.12.2011

Print what "tPlayer" is in the if statement (first thing).


Re: sscanf command problem - spedico - 22.12.2011

It prints an empty line.


Re: sscanf command problem - Tee - 22.12.2011

Is your server updated to 0.3d R2?


Re: sscanf command problem - spedico - 22.12.2011

Yes, 0.3d R2-800p.


Re: sscanf command problem - Tee - 22.12.2011

Downgrade it to 0.3d ONLY. So that means NO 0.3d R2 or 0.3d R2-800p. Just 0.3d; This is because sscanf 2.0 was made to work on 0.3d not higher versions.


Re: sscanf command problem - spedico - 22.12.2011

Still doesn't work for ID 0, but everyone else can use it.


Re: sscanf command problem - Tee - 22.12.2011

That means you haven't downgraded your server, or you're doing something wrong. You need the sscanf 2.0 (Update 4).
I had this problem about 2 or 3 days ago, and that's how I fixed it (My server was running 0.3d R2 while the plugin was for 0.3d)


Re: sscanf command problem - wildcookie007 - 22.12.2011

pawn Код:
command(goto, playerid, params[])
{
    new tPlayer;
    if(!sscanf(params, "u", tPlayer))
    {
    return SendClientMessage(playerid, -1, ""RED"Usage: /goto <player>");
}
new Float:X, Float:Y, Float:Z, string[128];
        SetPlayerInterior(playerid, GetPlayerInterior(tPlayer));
        GetPlayerPos(tPlayer, X, Y, Z);
        SetPlayerPos(playerid, X, Y, Z + 5);
        format(string, sizeof(string), ""GREEN"Successfully teleported to "YELLOW"'%s'"GREEN".", GetName(tPlayer));
        SendClientMessage(playerid, -1, string);
        SendClientMessage(tPlayer, -1, ""RED"An admin has teleported to you.");
    return 1;
}
try this...