SA-MP Forums Archive
sscanf errors? - 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 errors? (/showthread.php?tid=447784)



sscanf errors? - Necip - 01.07.2013

I just scripted a /pm system but I get a weird error...Here is the error:
Код:
SAMP\gamemodes\HGRP.pwn(39699) : error 017: undefined symbol "string"
SAMP\gamemodes\HGRP.pwn(39699) : error 017: undefined symbol "string"
SAMP\gamemodes\HGRP.pwn(39699) : error 029: invalid expression, assumed zero
SAMP\gamemodes\HGRP.pwn(39699) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
And here is the code:
pawn Код:
CMD:pm(playerid, params[])
{
        new id, msg[81];
        if(sscanf(params, "us[81]", id, msg)) return SendClientMessageEx(playerid, COLOR_GRAD3, "{FF0000}Usage: {FFFFFF}/pm [playerid] [text]");
        if(msg[80]) return SendClientMessageEx(playerid, COLOR_GRAD3, "{FF0000}Error! {FFFFFF}Invalid PM Lenght. Your PM Must Be Between 1-80 Characters.");
        if(isnull(msg)) return SendClientMessageEx(playerid, COLOR_GRAD3, "{FF0000}Error! {FFFFFF}Invalid PM Lenght. Your PM Must Be Between 1-80 Characters.");
        if(!IsPlayerConnected(id)) return SendClientMessageEx(playerid, COLOR_GRAD3, "Invalid Player!");
//      if(HidePM[id] > 0) SendClientMessageEx(playerid, COLOR_YELLOW, "{FF0000}%s {009900}(%d) {FFFFFF}Is {FF0000}Not {FFFFFF}Accepting His PMs At The Moment.", GetPlayerNameEx(id), id);
        else
        {
            format(string, sizeof(string), "%s(ID: %d) PMs:(( %s ))", GetPlayerNameEx(playerid), playerid, msg); // ERROR LINE
            SendClientMessageEx(id, COLOR_ORANGE, string);
            format(string, sizeof(string), "PM sent to %s(ID: %d):(( %s ))", GetPlayerNameEx(id), id, msg);
            SendClientMessageEx(playerid,  COLOR_ORANGE, string);
            //SendClientMessage(id, COLOUR_INFO, "{FFFFFF}Use {33CCCC}/reply (/r) {FFFFFF}To Quick Reply And {33CCCC}/nopm {FFFFFF}To {FF0000}Disable {FFFFFF}PMs.");
            SetPVarInt(id, "LastMessage", playerid);
            #if defined LOG_PM
                LogPM(playerid, id, params);
            #endif
        }
        return 1;
}



Re: sscanf errors? - Necip - 01.07.2013

Quote:
Originally Posted by ******
Посмотреть сообщение
How is that a problem with "sscanf"? You are using a variable called "string" but haven't declared it.
Lol, whatever it is, I need help with solving it...


Re: sscanf errors? - SilverKiller - 01.07.2013

pawn Код:
new string[128];



Re: sscanf errors? - Kirollos - 01.07.2013

declare "string"


Re: sscanf errors? - Necip - 01.07.2013

Wow...How did I forget that stuff.Thank you so much, +REP