SA-MP Forums Archive
Server Crashes - 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: Server Crashes (/showthread.php?tid=189580)



Server Crashes - ollis93 - 12.11.2010

Hi,
Everytime I write something in my server
(T- blabla - Enter) my server crashes.
It just stops/exits, without any error or something.

Any idea? /commands works.
pawn Код:
public OnPlayerText(playerid, text[])
{
    ServerInfo[TotText] ++;
    dini_IntSet(SFile, "MessagesSent", ServerInfo[TotText]);
    new playrname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playrname, sizeof(playrname));
    new chat[256], second, minute, hour;
    gettime(hour,minute,second);
    format(chat, sizeof(chat), "\n[%d:%d:%d]%s: %s", hour, minute, second, playrname, text);
    ChatLog(chat);
    SpamStrings[playerid] ++;
    if(SpamStrings[playerid] >= MAX_SPAM)
    {
        switch (Lang[playerid])
        {
            case 0:
            {
                SendClientMessage(playerid, COLOR_BRIGHTRED, "TEXT LIMIT EXCEEDED - Please wait before talking again !");
                return 0;
            }
            case 1:
            {
            }
        }
    }
    if(Muted[playerid] == 1)
    {
        switch (Lang[playerid])
        {
            case 0:
            {
                SendClientMessage(playerid, COLOR_BRIGHTRED, "You can't talk, you are Muted !");
                return 0;
            }


        }
        SendClientMessage(playerid, COLOR_BRIGHTRED, "You are Muted !");
        return 0;
    }
    if(ServerInfo[ChatLocked] == 1 && PlayerInfo[playerid][pAdmin] < 1)
    {
        switch (Lang[playerid])
        {
            case 0:
            {
                SendClientMessage(playerid, COLOR_BRIGHTRED, "You can't talk, the chat is Locked !");
                return 0;
            }

        }
    }
    if(strcmp(text, "login", true,5) == 0)
    {
        return 0;
    }
    return 1;
}



Re: Server Crashes - Mauzen - 12.11.2010

You have some bug in your OnPlayerText then. Maybe an array index out of bounds or so. Go through it and try to find anything unusual.


Re: Server Crashes - ollis93 - 12.11.2010

Quote:
Originally Posted by Mauzen
Посмотреть сообщение
You have some bug in your OnPlayerText then. Maybe an array index out of bounds or so. Go through it and try to find anything unusual.
pawn Код:
public OnPlayerText(playerid, text[])
{
    ServerInfo[TotText] ++;
    dini_IntSet(SFile, "MessagesSent", ServerInfo[TotText]);
    new playrname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playrname, sizeof(playrname));
    new chat[256], second, minute, hour;
    gettime(hour,minute,second);
    format(chat, sizeof(chat), "\n[%d:%d:%d]%s: %s", hour, minute, second, playrname, text);
    ChatLog(chat);
    SpamStrings[playerid] ++;
    if(SpamStrings[playerid] >= MAX_SPAM)
    {
        switch (Lang[playerid])
        {
            case 0:
            {
                SendClientMessage(playerid, COLOR_BRIGHTRED, "TEXT LIMIT EXCEEDED - Please wait before talking again !");
                return 0;
            }
            case 1:
            {
            }
        }
    }
    if(Muted[playerid] == 1)
    {
        switch (Lang[playerid])
        {
            case 0:
            {
                SendClientMessage(playerid, COLOR_BRIGHTRED, "You can't talk, you are Muted !");
                return 0;
            }


        }
        SendClientMessage(playerid, COLOR_BRIGHTRED, "You are Muted !");
        return 0;
    }
    if(ServerInfo[ChatLocked] == 1 && PlayerInfo[playerid][pAdmin] < 1)
    {
        switch (Lang[playerid])
        {
            case 0:
            {
                SendClientMessage(playerid, COLOR_BRIGHTRED, "You can't talk, the chat is Locked !");
                return 0;
            }

        }
    }
    if(strcmp(text, "login", true,5) == 0)
    {
        return 0;
    }
    return 1;
}
Can you see any? :-S