SA-MP Forums Archive
Need Help !! - 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: Need Help !! (/showthread.php?tid=637939)



Need Help !! - Speaker - 24.07.2017

Код:
	if(sscanf(params,"c[300]",params))return ShowPlayerDialog(playerid,ERROR_DIALOG+1,DIALOG_STYLE_MSGBOX,"ERROR!","{FFFFFF}[Usage]:- {EA0000}/creategang [gangname]","Ok","");
this is the code it is a part of a cmd that that creates Gang

So When i go in game and type
Код:
/creategang a
A single character then it creates the gang

but when i type name of gang great than 1 character like this
Код:
/creategang ab
then it don't make the gang and it shows me this error
Код:
[Usage]:-/creategang [gangname]



Re: Need Help !! - Xeon™ - 24.07.2017

Here's list of params

Код:
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
        s                       String                                Blabla
c is a char, mean single letter, you should use s instand. and there no need for 300 cells, 24 is enough

PHP код:
if(sscanf(params,"s[24]",params))return ShowPlayerDialog(playerid,ERROR_DIALOG+1,DIALOG_STYLE_MSGBOX,"ERROR!","{FFFFFF}[Usage]:- {EA0000}/creategang [gangname]","Ok",""); 



Re: Need Help !! - Ebisu - 24.07.2017

Use this.
PHP код:
new gangname[100];
if(
sscanf(params,"s",gangname))return ShowPlayerDialog(playerid,ERROR_DIALOG+1,DIALOG_STYLE_MSGBOX,"ERROR!","{FFFFFF}[Usage]:- {EA0000}/creategang [gangname]","Ok",""); 
And yes, Read this carefully.

Код:
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
        s                       String                                Blabla



Re: Need Help !! - Speaker - 24.07.2017

Thank u Bro


Re: Need Help !! - Xeon™ - 24.07.2017

Quote:
Originally Posted by Ebisu
Посмотреть сообщение
Use this.
PHP код:
new gangname[100];
if(
sscanf(params,"s",gangname))return ShowPlayerDialog(playerid,ERROR_DIALOG+1,DIALOG_STYLE_MSGBOX,"ERROR!","{FFFFFF}[Usage]:- {EA0000}/creategang [gangname]","Ok",""); 
this will not work, because of you didnt add the buffer on string its must be "s[100]" not "s"

EDIT: it will, but not stable (it will give always warnings on console)