A weird ID bug.
#1

So, I use sscanf, and for some CMD's like /gethere and /gotoid, it works for ID's 1-5 but for ID 6,7,etc do not work but when they re-log, it does work again, I want to make it so it always works, I have the latest sscanf plugins, includes as well, any help please?
Reply
#2

Show the code, please. Also, aren't they BOTs?
Reply
#3

They are actual players, anyway, here is the code:
Код:
CMD:gethere(playerid, params[])
{
	new giveplayerid;
	if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /gethere [playerid]");

	new Float:plocx,Float:plocy,Float:plocz;
	if (IsPlayerConnected(giveplayerid))
	{
		if(PlayerInfo[giveplayerid][pAdmin] >= PlayerInfo[playerid][pAdmin])
		{
			SendClientMessageEx(playerid, COLOR_WHITE, "You can't perform this action on an equal or higher level administrator.");
			return 1;
		}
		if (PlayerInfo[playerid][pAdmin] >= 2)
		{
			if(GetPlayerState(giveplayerid) == PLAYER_STATE_SPECTATING)
			{
				SendClientMessageEx(playerid, COLOR_GRAD2, "That player is spectating someone.");
				return 1;
			}
			GetPlayerPos(playerid, plocx, plocy, plocz);
			Streamer_UpdateEx(giveplayerid, plocx, plocy, plocz);
			SetPVarInt(playerid, "BeingTeleported", 1);
			SetPlayerVirtualWorld(giveplayerid, PlayerInfo[playerid][pVW]);

			PlayerInfo[giveplayerid][pLocal] = PlayerInfo[playerid][pLocal];

			if (GetPlayerState(giveplayerid) == 2)
			{
				TelePos[giveplayerid][0] = 0.0;
				TelePos[giveplayerid][1] = 0.0;
				new tmpcar = GetPlayerVehicleID(giveplayerid);
				SetVehiclePos(tmpcar, plocx, plocy+4, plocz);
				LinkVehicleToInterior(GetPlayerVehicleID(giveplayerid), GetPlayerInterior(playerid));
				SetPlayerInterior(giveplayerid, GetPlayerInterior(playerid));
				SetVehicleVirtualWorld(GetPlayerVehicleID(giveplayerid), GetPlayerVirtualWorld(playerid));
				SetPlayerVirtualWorld(giveplayerid, GetPlayerVirtualWorld(playerid));
			}
			else
			{
				SetPlayerPos(giveplayerid,plocx,plocy+2, plocz);
				SetPlayerInterior(giveplayerid, GetPlayerInterior(playerid));
				SetPlayerVirtualWorld(giveplayerid, GetPlayerVirtualWorld(playerid));
			}

			SendClientMessageEx(giveplayerid, COLOR_GRAD1, "   You have been teleported!");
		}
		else
		{
			SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
		}

	}
	else SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified.");
	return 1;
}
Reply
#4

The "u" on sscanf is meant for User name/id (bots and players), and it may be bugging your code.

Why don't you simple put "d" for player's ID? Else, I'd suggest you put "r", that's meant for Player name/id.

May not work, since I just used Float, String, Integer on the Sscanf.
Reply
#5

Didn't work, could you show me how you would do it your way, with the strings, float's and integers, please?
Reply
#6

Happened to me before, just update your sscanf plugin and include to the latest version and re-compile
Reply
#7

I already tried that, it didn't work.
Reply
#8

Command to go to X, Y and Z (Float):

pawn Код:
CMD:lgoto(playerid, params[])
{
        new Float:x, Float:y, Float:z, string[128];
        if(sscanf(params, "fff", x, y, z)) return Msg(playerid, color, ""#gold"[USAGE]: "#blue"/lgoto <x> <y> <z>");
        if(GetPlayerState(playerid) == 2) SetVehiclePos(GetPlayerVehicleID(playerid),x,y,z);
        else SetPlayerPos(playerid,x,y,z);
        format(string,sizeof(string),""#blue"You have gone to the coordinates "#red"X: %.2f, "#pink"Y: %.2f, "#ice"Z: %.2f", x,y,z); Msg(playerid,color,string);
        Sound(playerid,1054);
        return 1;
}

For String and Integer together:

pawn Код:
new string[700], id, reason[70], day, month, year, hour, minute, second;
    new ActualDay, ActualMonth, ActualYear, ActualHour, ActualMinute, ActualSecond;
    if(sscanf(params, "ds[70]dddddd", id, reason, day, month, year, hour, minute, second)) return Msg(playerid, color, ""#gold"[USAGE]: "#blue"/ban <playerid> <reason> <unban day> <unban month> <unban year> <unban hour> <unban minute> <unban second>");
Reply
#9

Quote:
Originally Posted by Feastahashi
Посмотреть сообщение
The "u" on sscanf is meant for User name/id (bots and players), and it may be bugging your code.

Why don't you simple put "d" for player's ID? Else, I'd suggest you put "r", that's meant for Player name/id.

May not work, since I just used Float, String, Integer on the Sscanf.
There's nothing wrong with "u" specifier.

The solution is what Red_Dragon said. I've seen millions times that problem and on the description, I've updated to the latest version, but they didn't. Download again the plugin and the include, and replace them with the old files. Re-compile your script and you're done!

Sscanf Thread
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)