PDA

View Full Version : Help - New


xHarshx
09/12/2013, 08:31 AM
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:
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:
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:
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!

BizzyD
09/12/2013, 08:32 AM
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);
}
}
}

xHarshx
09/12/2013, 08:39 AM
Alright lemme try!

xHarshx
09/12/2013, 08:43 AM
Tried the new CMD you gave me the with Bracker...Still i get these
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.

]Rafaellos[
09/12/2013, 08:43 AM
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.

Tried the new CMD you gave me the with Bracker...Still i get these
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.

xHarshx
09/12/2013, 08:51 AM
I tried both of those ways i till get those 4 Errors.

]Rafaellos[
09/12/2013, 08:54 AM
Because you don't have Foreach! Use this instead.

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;
}

xHarshx
09/12/2013, 09:05 AM
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!