SA-MP Forums Archive
Help me fixing this. Please. - 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: Help me fixing this. Please. (/showthread.php?tid=450353)



Help me fixing this. Please. - Magic_Time - 12.07.2013

I want to explode all the players except admins.
I receive the following errors while compiling:
Код:
C:\Users\Account\Downloads\samp03x_svr_R1-2_win32\gamemodes\GM.pwn(335) : error 012: invalid function call, not a valid address
C:\Users\Account\Downloads\samp03x_svr_R1-2_win32\gamemodes\GM.pwn(335) : warning 215: expression has no effect
C:\Users\Account\Downloads\samp03x_svr_R1-2_win32\gamemodes\GM.pwn(335) : error 001: expected token: ";", but found "]"
C:\Users\Account\Downloads\samp03x_svr_R1-2_win32\gamemodes\GM.pwn(335) : error 029: invalid expression, assumed zero
C:\Users\Account\Downloads\samp03x_svr_R1-2_win32\gamemodes\GM.pwn(335) : fatal error 107: too many error messages on one line

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


4 Errors.
pawn Код:
CMD:explodeall(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 5)
    {
        foreach(new i : Player)
        {
            if(PlayerInfo(i][pAdmin] >= 1)//Here is the error line 335
            {
                return 1;
            }
            new Float:x, Float:y, Float:z;
            GetPlayerPos(i, x, y, z);
            CreateExplosion(x, y, z, 12, 10.0);
            SendFMessage(i, -1, "%s %s has exploded all players online!", GetAdminLevel(playerid), Name(playerid));
        }
    }
    else
    {
        SendClientMessage(playerid, -1, NO_PERM);
    }
    return 1;
}



Re: Help me fixing this. Please. - DobbysGamertag - 12.07.2013

pawn Код:
CMD:explodeall(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 5)
    {
        foreach(new i : Player)
        {
            if(PlayerInfo[i][pAdmin] >= 1)
            {
                return 1;
            }
            new Float:x, Float:y, Float:z;
            GetPlayerPos(i, x, y, z);
            CreateExplosion(x, y, z, 12, 10.0);
            SendFMessage(i, -1, "%s %s has exploded all players online!", GetAdminLevel(playerid), Name(playerid));
        }
    }
    else
    {
        SendClientMessage(playerid, -1, NO_PERM);
    }
    return 1;
}



Re: Help me fixing this. Please. - DaRk_RaiN - 12.07.2013

Quote:
Originally Posted by DobbysGamertag
Посмотреть сообщение
pawn Код:
CMD:explodeall(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 5)
    {
        foreach(new i : Player)
        {
            if(PlayerInfo[i][pAdmin] >= 1)
            {
                return 1;
            }
            new Float:x, Float:y, Float:z;
            GetPlayerPos(i, x, y, z);
            CreateExplosion(x, y, z, 12, 10.0);
            SendFMessage(i, -1, "%s %s has exploded all players online!", GetAdminLevel(playerid), Name(playerid));
        }
    }
    else
    {
        SendClientMessage(playerid, -1, NO_PERM);
    }
    return 1;
}
That will fix the error but it won't work properly, what he did there is when the loop finds an admin; it will stop because he returned.
Try this:
pawn Код:
CMD:explodeall(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 5)
    {
        foreach(new i : Player)
        {
            if(PlayerInfo[i][pAdmin] >= 1)continue;
            new Float:x, Float:y, Float:z;
            GetPlayerPos(i, x, y, z);
            CreateExplosion(x, y, z, 12, 10.0);
            SendFMessage(i, -1, "%s %s has exploded all players online!", GetAdminLevel(playerid), Name(playerid));
        }
    }
    else
    {
        SendClientMessage(playerid, -1, NO_PERM);
    }
    return 1;
}