SA-MP Forums Archive
Sscanf Coding question - 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 Coding question (/showthread.php?tid=392208)



Sscanf Coding question - Michael_Cruise - 13.11.2012

Hello, I have see in many gamemodes like this:

Код:
if(sscanf(params,"us[100]"
if(sscanf(params."ui"
if(sscanf(params,"uii"
Any many like that
Can someone tell me what that "ui","uii" and "us[100] means? Please Help me..if there are any others then please teach that too plz.

I have errors in every commands, Like this one :

Код:
CMD:slap(playerid,params[])
{
	if(AdminLevel[playerid] <= 2) return SendClientMessage(playerid,COLOR_ERROR,"You don't have access to this command");
	if(sscanf(params,"ui",ID,cmdreason))
  	{
	   SendClientMessage(playerid, -1, "USAGE: /slap [playerid] [Reason]");
	   return 1;
	}
 	new ID, cmdreason, string[126], Float: PPos[3];
	if(IsSpawned[ID] != 1)
	{
		format(string,sizeof(string),"%s(%d) must be alive and spawned in order to slap him",PlayerName(ID),ID);
		SendClientMessage(playerid,COLOR_ERROR,string);
		return 1;
	}
	GetPlayerPos(ID, PPos[0], PPos[1], PPos[2]);
    SetPlayerPos(ID, PPos[0], PPos[1], PPos[2]+4);
    format(string,sizeof(string),"[ADMIN] %s(%d) has slapped %s(%d)",PlayerName(playerid),playerid,PlayerName(ID),ID);
    SendClientMessageToAll(COLOR_ADMIN,string);
    GameTextForPlayer(ID,"Slapped!", 3000, 1);
    return 1;
}



Re: Sscanf Coding question - Konstantinos - 13.11.2012

Код:
Specifier(s)			Name				Example values
	i, d			Integer				1, 42, -10
	c			Character			a, o, *
	l			Logical				true, false
	b			Binary				01001, 0b1100
	h, x			Hex				1A, 0x23
	o			Octal				045 12
	n			Number				42, 0b010, 0xAC, 045
	f			Float				0.7, -99.5
	g			IEEE Float			0.7, -99.5, INFINITY, -INFINITY, NAN, NAN_E
	u			User name/id (bots and players)	******, 0
	q			Bot name/id			ShopBot, 27
	r			Player name/id			******, 42



Re: Sscanf Coding question - Michael_Cruise - 13.11.2012

Quote:
Originally Posted by Dwane
Посмотреть сообщение
Код:
Specifier(s)			Name				Example values
	i, d			Integer				1, 42, -10
	c			Character			a, o, *
	l			Logical				true, false
	b			Binary				01001, 0b1100
	h, x			Hex				1A, 0x23
	o			Octal				045 12
	n			Number				42, 0b010, 0xAC, 045
	f			Float				0.7, -99.5
	g			IEEE Float			0.7, -99.5, INFINITY, -INFINITY, NAN, NAN_E
	u			User name/id (bots and players)	******, 0
	q			Bot name/id			ShopBot, 27
	r			Player name/id			******, 42
Thank you. Rep'ed