help in sscanf - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: help in sscanf (
/showthread.php?tid=265963)
help in sscanf -
EviLpRo - 03.07.2011
Hello!
If I want to make this command:
pawn Код:
CMD:kick(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return 1;
new ID,Reason[128], string[128];
if(sscanf(params, "us[128]", ID, Reason)) return SendClientMessage(playerid,WHITE,"USAGE: /Kick [ID] [Reason]");
if(ID == INVALID_PLAYER_ID) return SendClientMessage(playerid,RED,"Player not found.");
format(string, sizeof(string),"*** %s Has been kicked by: %s. (%s)",GetName(ID),GetName(playerid),Reason);
SendClientMessageToAll(RED,string);
TogglePlayerControllable(ID,false);
Kick(ID);
return 1;
}
Integration of strcmp and sscanf, how I do it?
Thanks in advance helpers
Re: help in sscanf -
PrawkC - 03.07.2011
It does use sscanf...
Re: help in sscanf -
EviLpRo - 03.07.2011
I want to combine orders with strcmp and sscanf, how I do it?
That's my question (:
Re: help in sscanf -
Mrminecraft202 - 03.07.2011
You cannot combine them im pretty sure of that.
Re: help in sscanf -
cessil - 03.07.2011
if you're talking about using strcmp for deciding which command was triggered then I suggest using ZCMD instead
Re: help in sscanf -
Gazmull - 03.07.2011
pawn Код:
if(strcmp(cmd, "/kick", true) == 0)
{
if(!IsPlayerAdmin(playerid)) return 1;
new ID,Reason[128], string[128];
if(sscanf(params, "us[128]", ID, Reason)) return SendClientMessage(playerid,WHITE,"USAGE: /Kick [ID] [Reason]");
if(ID == INVALID_PLAYER_ID) return SendClientMessage(playerid,RED,"Player not found.");
format(string, sizeof(string),"*** %s Has been kicked by: %s. (%s)",GetName(ID),GetName(playerid),Reason);
SendClientMessageToAll(RED,string);
TogglePlayerControllable(ID,false);
Kick(ID);
return 1;
}
But i suggest to use ZCMD or DCMD.
Re: help in sscanf -
[HiC]TheKiller - 03.07.2011
Quote:
Originally Posted by Gazmull
pawn Код:
if(strcmp(cmd, "/kick", true) == 0) { if(!IsPlayerAdmin(playerid)) return 1; new ID,Reason[128], string[128]; if(sscanf(params, "us[128]", ID, Reason)) return SendClientMessage(playerid,WHITE,"USAGE: /Kick [ID] [Reason]"); if(ID == INVALID_PLAYER_ID) return SendClientMessage(playerid,RED,"Player not found."); format(string, sizeof(string),"*** %s Has been kicked by: %s. (%s)",GetName(ID),GetName(playerid),Reason); SendClientMessageToAll(RED,string); TogglePlayerControllable(ID,false); Kick(ID); return 1; }
But i suggest to use ZCMD or DCMD.
|
Considering that code wouldn't work at all, it would be a good idea. Normal commands in OnPlayerCommandText do not have the 'params' variable.
Re: help in sscanf -
EviLpRo - 03.07.2011
No matter, I could finally do it (:
Thanks to everyone who tried to help (: