Why this error? (dcmd,sscanf)
#1

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?
Reply
#2

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

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?

Reply
#4

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...
Reply
#5

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


Forum Jump:


Users browsing this thread: 1 Guest(s)