SA-MP Forums Archive
Random Error - 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: Random Error (/showthread.php?tid=513350)



Random Error - Johnson_Brooks - 15.05.2014

Код:
warning 217: loose indentation
error 029: invalid expression, assumed zero
error 017: undefined symbol "cmd_afk"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line
This occurs when i try to compile my script . Nothing is wrong in my script , i just get this error.
NOTE: the AFK command works perfectly , i scripted it like 2-3 days ago and its not the problem .
What happend ?


Re: Random Error - Sasino97 - 15.05.2014

Can you show us cmd_afk and what comes before it?


Re: Random Error - Johnson_Brooks - 15.05.2014

its not the afk command causing this , im pretty sure but here you go :
pawn Код:
CMD:afk(playerid,params[])
{
    if(IsAfk[playerid] == 0)
    {
        new string[128];
        new pName[MAX_PLAYER_NAME];
        GetPlayerName(playerid,pName,sizeof(pName));
        format(string,sizeof(string),"%s(%d) is now AFK -%s",pName,playerid,params);
        TogglePlayerControllable(playerid,0);
        SendClientMessageToAll(COLOR_YELLOW,string);
        IsAfk[playerid] = 1;
        }
        else
        SendClientMessage(playerid,COLOR_BRIGHTRED,"You are already AFK");
    return true;
}
Before CMD:afk :
pawn Код:
forward SendClientMessageToAllCops(msg[]);
public SendClientMessageToAllCops(msg[])
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(HasLawEnforcementRadio[i] == 1)
            {
                SendClientMessage(i,COLOR_LIGHTBLUE,msg);
            }
        }
    }
EDIT: I figured it out :S .
It should be
pawn Код:
forward SendClientMessageToAllCops(msg[]);
public SendClientMessageToAllCops(msg[])
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(HasLawEnforcementRadio[i] == 1)
            {
                SendClientMessage(i,COLOR_LIGHTBLUE,msg);
            }
        }
    }
        return 1;
}
Sorry...


Re: Random Error - Sasino97 - 15.05.2014


That's why I asked to show also what came BEFORE the afk command. If you miss a bracket in a function, the functions coming after it will throw those random errors.


Re: Random Error - Johnson_Brooks - 15.05.2014

Quote:
Originally Posted by [GF]Sasino97
Посмотреть сообщение

That's why I asked to show also what came BEFORE the afk command. If you miss a bracket in a function, the functions coming after it will throw those random errors.
Thats what i figured out after re-reading your post . Thanks .