IRCCMD
#1

That command gives me many errors and i tried to fix.

PHP код:
IRCCMD:admins(botid, channel[], user[], host[], params[])
{
   new 
IsOnline = 0;
   new 
wordss[400];
   foreach(
Player, i)
   {
      if (
pData[i][Admin] >= 3)
      {
              
format(wordss, sizeof(wordss),  "9,2 Admin %s (ID: %d) [Level %d]\n",GetName(i), i, pData[i][Admin]);
              
IsOnline++;
              
IRC_GroupSay(groupID, IRC_CHANNEL, wordss);
        }
   }
   if (
IsOnline == 0)
   
IRC_GroupSay(groupID, IRC_CHANNEL, "No admins are online!");
   else
   {
        
format(wordss, sizeof(wordss), "11,2 %d RightX Admin Online",IsOnline);
          
IRC_GroupSay(groupID, IRC_CHANNEL, wordss);
          new 
msg[134],msg1[1323];
            
format(msg, sizeof(msg), "*Online Admins Player List Requested by %s ~ Total %d", user, IsOnline);
            
SendClientMessageToAll(0xFFB400FF, msg);
        
format(msg1, sizeof(msg1), "0,10 *Online Admins List Requested by %s ~ Total %d",user,IsOnline);
          
IRC_GroupSay(groupID, IRC_CHANNEL, msg1);
   }
   return 
1;
} 
Errors:

Код:
D:\samp folder\RightX\gamemodes\TestG.pwn(2927) : warning 219: local variable "msg" shadows a variable at a preceding level
D:\samp folder\RightX\gamemodes\TestG.pwn(4034) : error 001: expected token: "-string end-", but found "-identifier-"
D:\samp folder\RightX\gamemodes\TestG.pwn(4034) : error 001: expected token: ";", but found "["
D:\samp folder\RightX\gamemodes\TestG.pwn(4039) : error 010: invalid function or declaration
D:\samp folder\RightX\gamemodes\TestG.pwn(4041) : error 010: invalid function or declaration
D:\samp folder\RightX\gamemodes\TestG.pwn(4048) : error 010: invalid function or declaration
D:\samp folder\RightX\gamemodes\TestG.pwn(4050) : error 010: invalid function or declaration
D:\samp folder\RightX\gamemodes\TestG.pwn(4055) : error 021: symbol already defined: "format"
D:\samp folder\RightX\gamemodes\TestG.pwn(4060) : error 010: invalid function or declaration
D:\samp folder\RightX\gamemodes\TestG.pwn(4068) : warning 203: symbol is never used: "IsOnline"
D:\samp folder\RightX\gamemodes\TestG.pwn(4068) : warning 203: symbol is never used: "msg"
D:\samp folder\RightX\gamemodes\TestG.pwn(4068) : warning 203: symbol is never used: "msg1"
D:\samp folder\RightX\gamemodes\TestG.pwn(4068) : warning 203: symbol is never used: "wordss"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


8 Errors.
Reply
#2

Show these lines: (eg: line X: line here)

4034
4039
4041
4048
4050
4055
4060
4068
Reply
#3

PHP код:
IRCCMD:admins(botid, channel[], user[], host[], params[]) 
PHP код:
   foreach(Player, i) 
PHP код:
if (pData[i][Admin] >= 3) 
PHP код:
if (IsOnline == 0) 
PHP код:
else 
PHP код:
format(msg, sizeof(msg), "*Online Admins Player List Requested by %s ~ Total %d", user, IsOnline); 
PHP код:
   return 1; 
PHP код:
Line 4068 is the end of the gamemode and its empty :) 
Reply
#4

well i optimized it a bit, but i am pretty sure those errors arent from this cmd:

PHP код:
IRCCMD:admins(botid, channel[], user[], host[], params[]) 
{ 
   new 
IsOnline = 0; 
   new 
wordss[128]; 
   foreach(
Player, i) 
   { 
        if (
pData[i][Admin] >= 3) 
        { 
            
format(wordss, sizeof(wordss),  "9,2 Admin %s (ID: %d) [Level %d]\n",GetName(i), i, pData[i][Admin]); 
            
IsOnline++; 
            
IRC_GroupSay(groupID, IRC_CHANNEL, wordss); 
        } 
   } 
   if (
IsOnline == 0) 
   
IRC_GroupSay(groupID, IRC_CHANNEL, "No admins are online!"); 
   else 
    { 
        
format(wordss, sizeof(wordss), "11,2 %d RightX Admin Online",IsOnline); 
        
IRC_GroupSay(groupID, IRC_CHANNEL, wordss); 
        new 
msg99[128]; 
        
format(msg99, sizeof(msg99), "*Online Admins Player List Requested by %s ~ Total %d", user, IsOnline); 
        
SendClientMessageToAll(0xFFB400FF, msg99); 
        
format(msg99, sizeof(msg99), "0,10 *Online Admins List Requested by %s ~ Total %d",user,IsOnline); 
        
IRC_GroupSay(groupID, IRC_CHANNEL, msg99); 
    } 
   return 
1; 
} 
Reply
#5

Код:
D:\samp folder\RightX\gamemodes\TestG.pwn(4034) : error 001: expected token: "-string end-", but found "-identifier-"
D:\samp folder\RightX\gamemodes\TestG.pwn(4034) : error 001: expected token: ";", but found "["
D:\samp folder\RightX\gamemodes\TestG.pwn(4038) : error 010: invalid function or declaration
D:\samp folder\RightX\gamemodes\TestG.pwn(4040) : error 010: invalid function or declaration
D:\samp folder\RightX\gamemodes\TestG.pwn(4047) : error 010: invalid function or declaration
D:\samp folder\RightX\gamemodes\TestG.pwn(4049) : error 010: invalid function or declaration
D:\samp folder\RightX\gamemodes\TestG.pwn(4054) : error 021: symbol already defined: "format"
D:\samp folder\RightX\gamemodes\TestG.pwn(4059) : error 010: invalid function or declaration
D:\samp folder\RightX\gamemodes\TestG.pwn(4068) : warning 203: symbol is never used: "IsOnline"
D:\samp folder\RightX\gamemodes\TestG.pwn(4068) : warning 203: symbol is never used: "TDStats"
D:\samp folder\RightX\gamemodes\TestG.pwn(4068) : warning 203: symbol is never used: "msg99"
D:\samp folder\RightX\gamemodes\TestG.pwn(4068) : warning 203: symbol is never used: "wordss"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


8 Errors.
Reply
#6

Looking at your code, it seems fine to me, at least for the errors you've provided. You might have a symbol missed somewhere near the code of this command.

PS: Indent your code more.
Reply
#7

PHP код:
IRCCMD:admins(botid, channel[], user[], host[], params[])
{
    
//if(IRC_IsVoice(botid, channel, user))
    //{
    
new count, string[512];
    foreach(new 
i : Player)
    {
        if(!(
pData[i][Admin] >= 1 && pData[i][Admin] <= 5)) continue;
        
format(string, sizeof(string), "%s01%s[%i] (Level: %i) , ", string, GetName(i), i, pData[i][Admin]), count++;
    }
    if(
count)
    {
        new 
len = strlen(string);
        
strdel(string, (len - 4), len);
        
format(string, sizeof(string), "2Connected Admins[%i]: %s", count, string);
        
IRC_GroupSay(groupID, IRC_CHANNEL, string);
    }
    else 
IRC_GroupSay(groupID, IRC_CHANNEL, "4No Admins Online!");
    
//}
    //else IRC_Say(botid, channel, "26[ERROR] 01You must have Voice to use this command.");
    
return 1;
} 
Update your foreach include, https://sampforum.blast.hk/showthread.php?tid=570868 and fix the errors foreach throws out..
Reply
#8

I need it to show online admins and count of them
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)