SSCANF + STRCMP. - 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 + STRCMP. (
/showthread.php?tid=297193)
SSCANF + STRCMP. -
yanir3 - 14.11.2011
I want to make a command with
sscanf, something about this: /admin [kick/ban] [id]
I had some issues with my vehicle sys, so can somebody show me example similiar to this ^?
Thanks in advance.
Re: SSCANF + STRCMP. -
Kingunit - 14.11.2011
Just a example:
pawn Код:
if(sscanf(params,"us[64]",targetid, reason))
Re: SSCANF + STRCMP. -
Kostas' - 14.11.2011
Sscanf:
Код:
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 + STRCMP. -
smeti - 14.11.2011
pawn Код:
COMMAND:admin(playerid, params[])
{
new
id,
str[128];
if(sscanf(params, "s[128]u", str, id)) return SendClientMessage(playerid, -1, "Usage: /admin [kick/ban] [id/name]");
if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "No connected player");
if(strcmp(str, "ban", true) == 0)
{
Ban(id);
}
else if(strcmp(str, "kick", true) == 0)
{
Kick(id);
}
return 1;
}
No tested.
Re: SSCANF + STRCMP. -
yanir3 - 14.11.2011
I think I got it, thanks.