sscanf(2.0) and IRC command - 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: sscanf(2.0) and IRC command (
/showthread.php?tid=144765)
sscanf(2.0) and IRC command -
dcmd_crash - 29.04.2010
More sscanf 2.0 dilemmas!
I'm rewriting my IRC script, I'm trying to add this command but I got to a certain point and got stuck... how would I do it so you can enter a password parameter and it'll use it but if you don't enter a password parameter it'll just join the channel without. I'm tired right now I can't think properly .. any help is appreciated, etc.
Also, note that the parameters will be strings, right? The usage format'd be like:
pawn Код:
!join #channel passwordhere
- with password
or it can also be used without
pawn Код:
IRCCMD:join(botid, channel[], user[], host[], params[])
{
if(IRC_IsOp(botid, channel, user))
{
if(!isnull(params))
{
new channel, msg[128], pass;
if(sscanf(params, "s[100]z[100]", channel, pass))
{
IRC_JoinChannel(gBotID[0], channel
Re: sscanf(2.0) and IRC command -
Miguel - 29.04.2010
Man, it's pretty simple:
pawn Код:
// Let's make a 3 parameters exaple
new
a[10],
b[10],
c[10];
#define Z 8 // sizeof
if(sscanf(string, "s["#Z"]", a))
{
// the stuff to join the channel
}
else if(sscanf(string, "s["#Z"]s["#Z"]", a, b))
{
// this is what happens if he typed the first param but not the second
}
else if(sscanf(string, "s["#Z"]s["#Z"]s["#Z"]", a, b, c))
{
// this is what happens if he types the first and the second but not the third
}
else
{
// this is what happens if he typed all the params
}
Re: sscanf(2.0) and IRC command -
dcmd_crash - 29.04.2010
That helped a great deal .. but, does that actually work? Why didn't I think of that?! lol :P