commands problem
#11

The folder must exist and you don't check if the file handle is valid. If it is not and it is used in a file function, that function will crash the server.

pawn Code:
Admin(const string[])
{
    new File: hFile = fopen("ServerInfo/log.log", io_append);

    if (!hFile) return; // invalid handle, don't proceed

    fwrite(hFile, string);
    fwrite(hFile, "\r\n");
    fclose(hFile);
}
Quote:
Originally Posted by Shinja
View Post
Try this
PHP Code:
stock AdminMsg(playeridcmdused[])
{
    foreach(new 
Player)
    {
        if(
pInfo[playerid][AdminLevel] >= && LoginCheck[i] ==)
        {
            new 
str1[128];
            
format(str1,sizeof(str1),"Admin %s (%d) Issued Command /%s.",pname(playerid),playerid,cmdused);
            
SendClientMessage(i,COLOR_HOTPINK,str1);
            
Admin(str1);
            return 
1;
        }
        else return 
0;
    }

and return 1; on stock Admin
Returning any value inside a loop breaks, thus won't be sent to the rest of the admins. Creating a string inside a loop is also bad.
Reply


Messages In This Thread
commands problem - by JuzDoiT - 06.08.2016, 14:57
Re: commands problem - by Shinja - 06.08.2016, 15:02
Re: commands problem - by JuzDoiT - 06.08.2016, 15:05
Re: commands problem - by Shinja - 06.08.2016, 15:08
Re: commands problem - by JuzDoiT - 06.08.2016, 15:11
Re: commands problem - by Shinja - 06.08.2016, 15:16
Re: commands problem - by JuzDoiT - 06.08.2016, 15:21
Re: commands problem - by Shinja - 06.08.2016, 15:27
Re: commands problem - by JuzDoiT - 06.08.2016, 15:33
Re: commands problem - by Shinja - 06.08.2016, 15:40
Re: commands problem - by Konstantinos - 06.08.2016, 15:44
Re: commands problem - by Shinja - 06.08.2016, 15:52
Re: commands problem - by SyS - 06.08.2016, 15:58
Re: commands problem - by JuzDoiT - 06.08.2016, 15:58
Re: commands problem - by Shinja - 06.08.2016, 16:02
Re: commands problem - by SyS - 06.08.2016, 16:05

Forum Jump:


Users browsing this thread: 1 Guest(s)