SA-MP Forums Archive
Help - New - 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 - New (/showthread.php?tid=480148)



Help - New - xHarshx - 09.12.2013

Hello, since i was asked to make a new thread on this I did. So, I was making 2 Commands: /unfreezeall and /freezeall and I get some errors.
These are my CMDs:
FreezeAll:
pawn Код:
CMD:freezeall(playerid, params[])
{
    if (PlayerInfo[playerid][pAdmin] >= 4)
    {
        foreach (new i : Player)
        {
            TogglePlayerControllable(i, 0);
            new name[MAX_PLAYER_NAME], string[128];
            GetPlayerName(playerid, name, sizeof(name));
            format(string, sizeof(string), "AdmCmd: Administrator %s has frozen all players.", name);
            SendClientMessageToAll(-1, string);
    }
}
UnFreezeAll:
pawn Код:
CMD:unfreezeall(playerid, params[])
{
    if (PlayerInfo[playerid][pAdmin] >= 4)
    {
        foreach (new i : Player)
        {
            TogglePlayerControllable(i, 1);
            new name[MAX_PLAYER_NAME], string[128];
            GetPlayerName(playerid, name, sizeof(name));
            format(string, sizeof(string), "AdmCmd: Administrator %s has unfrozen all players.", name);
            SendClientMessageToAll(-1, string);
    }
}
And these are my errors:
pawn Код:
F:\UP COMPUTER\HARSHPREET SINGH NIJHAR\SA-MP (SERVER)\CG-RP - LINUX\CG-RP\gamemodes\CG-RP.pwn(3178) : error 017: undefined symbol "ProxDetector"
F:\UP COMPUTER\HARSHPREET SINGH NIJHAR\SA-MP (SERVER)\CG-RP - LINUX\CG-RP\gamemodes\CG-RP.pwn(3186) : error 017: undefined symbol "ProxDetector"
F:\UP COMPUTER\HARSHPREET SINGH NIJHAR\SA-MP (SERVER)\CG-RP - LINUX\CG-RP\gamemodes\CG-RP.pwn(3193) : error 017: undefined symbol "ProxDetector"
F:\UP COMPUTER\HARSHPREET SINGH NIJHAR\SA-MP (SERVER)\CG-RP - LINUX\CG-RP\gamemodes\CG-RP.pwn(3202) : error 017: undefined symbol "ProxDetector"
F:\UP COMPUTER\HARSHPREET SINGH NIJHAR\SA-MP (SERVER)\CG-RP - LINUX\CG-RP\gamemodes\CG-RP.pwn(3216) : error 017: undefined symbol "ProxDetector"
F:\UP COMPUTER\HARSHPREET SINGH NIJHAR\SA-MP (SERVER)\CG-RP - LINUX\CG-RP\gamemodes\CG-RP.pwn(3223) : error 017: undefined symbol "ProxDetector"
F:\UP COMPUTER\HARSHPREET SINGH NIJHAR\SA-MP (SERVER)\CG-RP - LINUX\CG-RP\gamemodes\CG-RP.pwn(3227) : error 017: undefined symbol "GivePlayerCash"
F:\UP COMPUTER\HARSHPREET SINGH NIJHAR\SA-MP (SERVER)\CG-RP - LINUX\CG-RP\gamemodes\CG-RP.pwn(3230) : error 017: undefined symbol "ProxDetector"
F:\UP COMPUTER\HARSHPREET SINGH NIJHAR\SA-MP (SERVER)\CG-RP - LINUX\CG-RP\gamemodes\CG-RP.pwn(3237) : error 017: undefined symbol "ProxDetector"
F:\UP COMPUTER\HARSHPREET SINGH NIJHAR\SA-MP (SERVER)\CG-RP - LINUX\CG-RP\gamemodes\CG-RP.pwn(3245) : error 017: undefined symbol "ProxDetector"
F:\UP COMPUTER\HARSHPREET SINGH NIJHAR\SA-MP (SERVER)\CG-RP - LINUX\CG-RP\gamemodes\CG-RP.pwn(3252) : error 017: undefined symbol "ProxDetector"
F:\UP COMPUTER\HARSHPREET SINGH NIJHAR\SA-MP (SERVER)\CG-RP - LINUX\CG-RP\gamemodes\CG-RP.pwn(3259) : error 017: undefined symbol "ProxDetector"
F:\UP COMPUTER\HARSHPREET SINGH NIJHAR\SA-MP (SERVER)\CG-RP - LINUX\CG-RP\gamemodes\CG-RP.pwn(3267) : error 017: undefined symbol "GivePlayerCash"
F:\UP COMPUTER\HARSHPREET SINGH NIJHAR\SA-MP (SERVER)\CG-RP - LINUX\CG-RP\gamemodes\CG-RP.pwn(3270) : error 017: undefined symbol "ProxDetector"
F:\UP COMPUTER\HARSHPREET SINGH NIJHAR\SA-MP (SERVER)\CG-RP - LINUX\CG-RP\gamemodes\CG-RP.pwn(3277) : error 017: undefined symbol "ProxDetector"
F:\UP COMPUTER\HARSHPREET SINGH NIJHAR\SA-MP (SERVER)\CG-RP - LINUX\CG-RP\gamemodes\CG-RP.pwn(3284) : error 017: undefined symbol "ProxDetector"
F:\UP COMPUTER\HARSHPREET SINGH NIJHAR\SA-MP (SERVER)\CG-RP - LINUX\CG-RP\gamemodes\CG-RP.pwn(3306) : error 017: undefined symbol "ProxDetector"
F:\UP COMPUTER\HARSHPREET SINGH NIJHAR\SA-MP (SERVER)\CG-RP - LINUX\CG-RP\gamemodes\CG-RP.pwn(3315) : error 017: undefined symbol "ProxDetector"
F:\UP COMPUTER\HARSHPREET SINGH NIJHAR\SA-MP (SERVER)\CG-RP - LINUX\CG-RP\gamemodes\CG-RP.pwn(3327) : error 017: undefined symbol "ProxDetector"
F:\UP COMPUTER\HARSHPREET SINGH NIJHAR\SA-MP (SERVER)\CG-RP - LINUX\CG-RP\gamemodes\CG-RP.pwn(3342) : error 017: undefined symbol "ProxDetector"
F:\UP COMPUTER\HARSHPREET SINGH NIJHAR\SA-MP (SERVER)\CG-RP - LINUX\CG-RP\gamemodes\CG-RP.pwn(3350) : error 017: undefined symbol "ProxDetector"
F:\UP COMPUTER\HARSHPREET SINGH NIJHAR\SA-MP (SERVER)\CG-RP - LINUX\CG-RP\gamemodes\CG-RP.pwn(3358) : error 017: undefined symbol "ProxDetector"
F:\UP COMPUTER\HARSHPREET SINGH NIJHAR\SA-MP (SERVER)\CG-RP - LINUX\CG-RP\gamemodes\CG-RP.pwn(3376) : error 017: undefined symbol "ProxDetector"
F:\UP COMPUTER\HARSHPREET SINGH NIJHAR\SA-MP (SERVER)\CG-RP - LINUX\CG-RP\gamemodes\CG-RP.pwn(3398) : error 017: undefined symbol "ProxDetector"
F:\UP COMPUTER\HARSHPREET SINGH NIJHAR\SA-MP (SERVER)\CG-RP - LINUX\CG-RP\gamemodes\CG-RP.pwn(3406) : error 017: undefined symbol "ProxDetector"
F:\UP COMPUTER\HARSHPREET SINGH NIJHAR\SA-MP (SERVER)\CG-RP - LINUX\CG-RP\gamemodes\CG-RP.pwn(3414) : error 017: undefined symbol "GivePlayerCash"

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


26 Errors.
So, can you guys please help me!


Re: Help - New - BizzyD - 09.12.2013

You are missing a closing bracket

Код:
CMD:freezeall(playerid, params[])
{
    if (PlayerInfo[playerid][pAdmin] >= 4)
    {
        foreach (new i : Player)
        {
            TogglePlayerControllable(i, 0);
            new name[MAX_PLAYER_NAME], string[128];
            GetPlayerName(playerid, name, sizeof(name));
            format(string, sizeof(string), "AdmCmd: Administrator %s has frozen all players.", name);
            SendClientMessageToAll(-1, string);
       }
  }
}

CMD:unfreezeall(playerid, params[])
{
    if (PlayerInfo[playerid][pAdmin] >= 4)
    {
        foreach (new i : Player)
        {
            TogglePlayerControllable(i, 1);
            new name[MAX_PLAYER_NAME], string[128];
            GetPlayerName(playerid, name, sizeof(name));
            format(string, sizeof(string), "AdmCmd: Administrator %s has unfrozen all players.", name);
            SendClientMessageToAll(-1, string);
    }
}
}



Re: Help - New - xHarshx - 09.12.2013

Alright lemme try!


Re: Help - New - xHarshx - 09.12.2013

Tried the new CMD you gave me the with Bracker...Still i get these
pawn Код:
F:\UP COMPUTER\HARSHPREET SINGH NIJHAR\SA-MP (SERVER)\CG-RP - LINUX\CG-RP\gamemodes\CG-RP.pwn(65825) : error 017: undefined symbol "foreach"
F:\UP COMPUTER\HARSHPREET SINGH NIJHAR\SA-MP (SERVER)\CG-RP - LINUX\CG-RP\gamemodes\CG-RP.pwn(65825) : error 029: invalid expression, assumed zero
F:\UP COMPUTER\HARSHPREET SINGH NIJHAR\SA-MP (SERVER)\CG-RP - LINUX\CG-RP\gamemodes\CG-RP.pwn(65825) : error 017: undefined symbol "i"
F:\UP COMPUTER\HARSHPREET SINGH NIJHAR\SA-MP (SERVER)\CG-RP - LINUX\CG-RP\gamemodes\CG-RP.pwn(65825) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.



Re: Help - New - ]Rafaellos[ - 09.12.2013

pawn Код:
CMD:freezeall(playerid, params[])
{
    if (PlayerInfo[playerid][pAdmin] >= 4)
    {
        new name[MAX_PLAYER_NAME], string[128];
        GetPlayerName(playerid, name, sizeof(name));
        format(string, sizeof(string), "AdmCmd: Administrator %s has frozen all players.", name);
        SendClientMessageToAll(-1, string);
       
        foreach (new i : Player)
        {
            TogglePlayerControllable(i, 0);
        }
    }
    return 1;
}

CMD:unfreezeall(playerid, params[])
{
    if (PlayerInfo[playerid][pAdmin] >= 4)
    {
        new name[MAX_PLAYER_NAME], string[128];
        GetPlayerName(playerid, name, sizeof(name));
        format(string, sizeof(string), "AdmCmd: Administrator %s has unfrozen all players.", name);
        SendClientMessageToAll(-1, string);
       
        foreach (new i : Player)
        {
            TogglePlayerControllable(i, 1);
        }
    }
    return 1;
}
Use it like that, otherwise it will spam the string as much as players are connected.

Quote:
Originally Posted by xHarshx
Посмотреть сообщение
Tried the new CMD you gave me the with Bracker...Still i get these
pawn Код:
F:\UP COMPUTER\HARSHPREET SINGH NIJHAR\SA-MP (SERVER)\CG-RP - LINUX\CG-RP\gamemodes\CG-RP.pwn(65825) : error 017: undefined symbol "foreach"
F:\UP COMPUTER\HARSHPREET SINGH NIJHAR\SA-MP (SERVER)\CG-RP - LINUX\CG-RP\gamemodes\CG-RP.pwn(65825) : error 029: invalid expression, assumed zero
F:\UP COMPUTER\HARSHPREET SINGH NIJHAR\SA-MP (SERVER)\CG-RP - LINUX\CG-RP\gamemodes\CG-RP.pwn(65825) : error 017: undefined symbol "i"
F:\UP COMPUTER\HARSHPREET SINGH NIJHAR\SA-MP (SERVER)\CG-RP - LINUX\CG-RP\gamemodes\CG-RP.pwn(65825) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
Seems like you don't have Foreach included.


Re: Help - New - xHarshx - 09.12.2013

I tried both of those ways i till get those 4 Errors.


Re: Help - New - ]Rafaellos[ - 09.12.2013

Because you don't have Foreach! Use this instead.

pawn Код:
CMD:freezeall(playerid, params[])
{
    if (PlayerInfo[playerid][pAdmin] >= 4)
    {
        new name[MAX_PLAYER_NAME], string[128];
        GetPlayerName(playerid, name, sizeof(name));
        format(string, sizeof(string), "AdmCmd: Administrator %s has frozen all players.", name);
        SendClientMessageToAll(-1, string);

        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i)) TogglePlayerControllable(i, 0);
        }
    }
    return 1;
}

CMD:unfreezeall(playerid, params[])
{
    if (PlayerInfo[playerid][pAdmin] >= 4)
    {
        new name[MAX_PLAYER_NAME], string[128];
        GetPlayerName(playerid, name, sizeof(name));
        format(string, sizeof(string), "AdmCmd: Administrator %s has unfrozen all players.", name);
        SendClientMessageToAll(-1, string);

        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i)) TogglePlayerControllable(i, 1);
        }
    }
    return 1;
}



Re: Help - New - xHarshx - 09.12.2013

Thank you I +RPed you and it works.. But look at dis' I downloaded and placed the foreach.inc in the include folder and i also added: #include <foreach> in the script..but then why did it still not work..
Otherwise still thanks for solving it!