Problem with command string
#1

While working on my new gamemode i did now create the easiest command in the world and get an error,
while i have made alot more advanced commands and getting no error.

It's just stupid...

EDIT: GOD DAMNIT (sorry) i can see the error... I have to set the size in the sscanf line.. (s[size])
I always see the error once i ask for help, same thing last time i posted... -_-

pawn Код:
COMMAND:gm(playerid,params[])
{
    // I increased the string sizes to see If It worked but It didn't, thus why the strings are 256.
    new string[256];
    if (!sscanf(params,"s",string))
    {
        new str[256];
        new log[256];
        new month[12];
        new hh,mm,ss,y,m,d;
        gettime(hh,mm,ss);
        getdate(y,m,d);
        format(month, 12, "%s", Months[m-1]);
        format(str,sizeof(str),"OOC | %s: %s",PlayerName(playerid),string);
        format(log,sizeof(log),"[%s %d, %d, %d:%d:%d] %s: %s\r\n",month,d,y,hh,mm,ss,PlayerName(playerid),string);
        new File:lfile = fopen("GPMRP/Logs/OOC-Chat.log",io_append);
        fwrite(lfile,log);
        fclose(lfile);
        SendClientMessageToAll(COLOR_DARKSLATEGRAY,str);
    }
    else SendClientMessage(playerid,-1,"USAGE: /gm [message]");
    return 1;
}
Well the thing is, that the message is cut off like after like a few characters;

This is the log;
Код:
[February 26, 2011, 13:23:22] Mike Garber: testing how this works again no
That is 74 characters (with the log time stamps thats not shown ingame), while the string is 256 now, and it still doesn't work.

I might have too much code in my head to see the error but thanks in advance for any help.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)