07.04.2012, 12:37
(
Последний раз редактировалось OleKristian95; 07.04.2012 в 14:03.
)
I'm having problems with creating a /richlist command for my IRC
The command looks like this:
This is the errors I get:
Line 34041:
The command looks like this:
pawn Код:
IRCCMD:richlist(botid, channel[], user[], host[], params[]) {
if (IRC_IsHalfop(botid, channel, user))
new msg[128], Slot1 = -1, Slot2 = -1, Slot3 = -1, Slot4 = -1, HighestCash = -9999;
IRC_GroupSay(gGroupID, channel, msg);
format(msg, sizeof(msg), "Rich List:");
IRC_GroupSay(gGroupID, channel, msg);
for(new x=0; x<MAX_PLAYERS; x++) if (IsPlayerConnected(x)) if (GetPlayerMoney(x) >= HighestCash) {
HighestCash = GetPlayerMoney(x);
Slot1 = x;
}
HighestCash = -9999;
for(new x=0; x<MAX_PLAYERS; x++) if (IsPlayerConnected(x) && x != Slot1) if (GetPlayerMoney(x) >= HighestCash) {
HighestCash = GetPlayerMoney(x);
Slot2 = x;
}
HighestCash = -9999;
for(new x=0; x<MAX_PLAYERS; x++) if (IsPlayerConnected(x) && x != Slot1 && x != Slot2) if (GetPlayerMoney(x) >= HighestCash) {
HighestCash = GetPlayerMoney(x);
Slot3 = x;
}
HighestCash = -9999;
for(new x=0; x<MAX_PLAYERS; x++) if (IsPlayerConnected(x) && x != Slot1 && x != Slot2 && x != Slot3) if (GetPlayerMoney(x) >= HighestCash) {
HighestCash = GetPlayerMoney(x);
Slot4 = x;
}
IRC_GroupSay(gGroupID, channel, msg);
format(msg, sizeof(msg), "(%d) %s - $%d", Slot1,PlayerName2(Slot1),GetPlayerMoney(Slot1) );
IRC_GroupSay(gGroupID, channel, msg);
if(Slot2 != -1) {
new msg[128];
IRC_GroupSay(gGroupID, channel, msg);
format(msg, sizeof(msg), "(%d) %s - $%d", Slot2,PlayerName2(Slot2),GetPlayerMoney(Slot2) );
IRC_GroupSay(gGroupID, channel, msg);
}
if(Slot3 != -1) {
IRC_GroupSay(gGroupID, channel, msg);
format(msg, sizeof(msg), "(%d) %s - $%d", Slot3,PlayerName2(Slot3),GetPlayerMoney(Slot3) );
IRC_GroupSay(gGroupID, channel, msg);
}
if(Slot4 != -1) {
IRC_GroupSay(gGroupID, channel, msg);
format(msg, sizeof(msg), "(%d) %s - $%d", Slot4,PlayerName2(Slot4),GetPlayerMoney(Slot4) );
IRC_GroupSay(gGroupID, channel, msg);
}
return 1;
}
pawn Код:
C:\Users\Ole Kristian\Desktop\San Andreas Server\gamemodes\SATDM~RP.pwn(34041) : error 003: declaration of a local variable must appear in a compound block
C:\Users\Ole Kristian\Desktop\San Andreas Server\gamemodes\SATDM~RP.pwn(34041) : error 017: undefined symbol "msg"
C:\Users\Ole Kristian\Desktop\San Andreas Server\gamemodes\SATDM~RP.pwn(34041) : warning 215: expression has no effect
C:\Users\Ole Kristian\Desktop\San Andreas Server\gamemodes\SATDM~RP.pwn(34041) : error 001: expected token: ";", but found "]"
C:\Users\Ole Kristian\Desktop\San Andreas Server\gamemodes\SATDM~RP.pwn(34041) : 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.
pawn Код:
new msg[128], Slot1 = -1, Slot2 = -1, Slot3 = -1, Slot4 = -1, HighestCash = -9999;