SA-MP Forums Archive
Why this error? (dcmd,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: Why this error? (dcmd,sscanf) (/showthread.php?tid=77516)



Why this error? (dcmd,sscanf) - user226 - 11.05.2009

I added in my pawno code:
1)
pawn Код:
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
2) In OnPlayerCommandText
pawn Код:
dcmd(heal, 4, cmdtext);
3) under OnPlayerCommandText
pawn Код:
dcmd_heal(playerid, params[])
{
    new
        id;
    if (sscanf(params, "u", id)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/heal <playerid>\"");
    else if (id == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFF0000AA, "Player not found");
    else
    {
        SetPlayerHealth(id, 100.0);
        SendClientMessage(id, 0x00FF00AA, "You have been healed");
        SendClientMessage(playerid, 0x00FF00AA, "Player healed");
    }
    return 1;
}
And got these errors:
\GM.pwn(405) : error 017: undefined symbol "sscanf"
405 line is: if (sscanf(params, "u", id))........

What I did is not right?
--------------------------------------
I also wanted to ask,My mode half of commands made through:
if(!strcmp(cmdtext, "/cmd, true))
and the other half through dcmd:
dcmd(CMD, 3, cmdtext);
This is bad, or nothing scary?


Re: Why this error? (dcmd,sscanf) - Weirdosport - 11.05.2009

You need the huuuge sscanf stock at the bottom of your script, see here: https://sampwiki.blast.hk/wiki/Sscanf


Re: Why this error? (dcmd,sscanf) - user226 - 11.05.2009

Thank you very much!
And what can you say about this:
Quote:

I also wanted to ask,My mode half of commands made through:
if(!strcmp(cmdtext, "/cmd, true))
and the other half through dcmd:
dcmd(CMD, 3, cmdtext);
This is bad, or nothing scary?




Re: Why this error? (dcmd,sscanf) - Weirdosport - 11.05.2009

They should work, but it would be preferable to have them as all one type, or all the other, and DCMD is superior I think. Saying that I'm often lazy and just use whatever new.pwn gives me...


Re: Why this error? (dcmd,sscanf) - user226 - 11.05.2009

Mmmm...
Thanks..
I use dcmd in other include, and if(!strcmp... in GameMode Pawno Code