sscanf command problem
#1

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;
}
Reply
#2

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

It prints an empty line.
Reply
#4

Is your server updated to 0.3d R2?
Reply
#5

Yes, 0.3d R2-800p.
Reply
#6

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

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

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)
Reply
#9

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


Forum Jump:


Users browsing this thread: 3 Guest(s)