IRCCMD
#1

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

PHP код:
IRCCMD:admins(botidchannel[], user[], host[], params[])
{
   new 
IsOnline 0;
   new 
wordss[400];
   foreach(
Playeri)
   {
      if (
pData[i][Admin] >= 3)
      {
              
format(wordsssizeof(wordss),  "9,2 Admin %s (ID: %d) [Level %d]\n",GetName(i), ipData[i][Admin]);
              
IsOnline++;
              
IRC_GroupSay(groupIDIRC_CHANNELwordss);
        }
   }
   if (
IsOnline == 0)
   
IRC_GroupSay(groupIDIRC_CHANNEL"No admins are online!");
   else
   {
        
format(wordsssizeof(wordss), "11,2 %d RightX Admin Online",IsOnline);
          
IRC_GroupSay(groupIDIRC_CHANNELwordss);
          new 
msg[134],msg1[1323];
            
format(msgsizeof(msg), "*Online Admins Player List Requested by %s ~ Total %d"userIsOnline);
            
SendClientMessageToAll(0xFFB400FFmsg);
        
format(msg1sizeof(msg1), "0,10 *Online Admins List Requested by %s ~ Total %d",user,IsOnline);
          
IRC_GroupSay(groupIDIRC_CHANNELmsg1);
   }
   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(botidchannel[], user[], host[], params[]) 
PHP код:
   foreach(Playeri
PHP код:
if (pData[i][Admin] >= 3
PHP код:
if (IsOnline == 0
PHP код:
else 
PHP код:
format(msgsizeof(msg), "*Online Admins Player List Requested by %s ~ Total %d"userIsOnline); 
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(botidchannel[], user[], host[], params[]) 

   new 
IsOnline 0
   new 
wordss[128]; 
   foreach(
Playeri
   { 
        if (
pData[i][Admin] >= 3
        { 
            
format(wordsssizeof(wordss),  "9,2 Admin %s (ID: %d) [Level %d]\n",GetName(i), ipData[i][Admin]); 
            
IsOnline++; 
            
IRC_GroupSay(groupIDIRC_CHANNELwordss); 
        } 
   } 
   if (
IsOnline == 0
   
IRC_GroupSay(groupIDIRC_CHANNEL"No admins are online!"); 
   else 
    { 
        
format(wordsssizeof(wordss), "11,2 %d RightX Admin Online",IsOnline); 
        
IRC_GroupSay(groupIDIRC_CHANNELwordss); 
        new 
msg99[128]; 
        
format(msg99sizeof(msg99), "*Online Admins Player List Requested by %s ~ Total %d"userIsOnline); 
        
SendClientMessageToAll(0xFFB400FFmsg99); 
        
format(msg99sizeof(msg99), "0,10 *Online Admins List Requested by %s ~ Total %d",user,IsOnline); 
        
IRC_GroupSay(groupIDIRC_CHANNELmsg99); 
    } 
   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(botidchannel[], user[], host[], params[])
{
    
//if(IRC_IsVoice(botid, channel, user))
    //{
    
new countstring[512];
    foreach(new 
Player)
    {
        if(!(
pData[i][Admin] >= && pData[i][Admin] <= 5)) continue;
        
format(stringsizeof(string), "%s01%s[%i] (Level: %i) , "stringGetName(i), ipData[i][Admin]), count++;
    }
    if(
count)
    {
        new 
len strlen(string);
        
strdel(string, (len 4), len);
        
format(stringsizeof(string), "2Connected Admins[%i]: %s"countstring);
        
IRC_GroupSay(groupIDIRC_CHANNELstring);
    }
    else 
IRC_GroupSay(groupIDIRC_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)