udb_hash symbol already defined
#1

Hello,

i want to ask you that how can i fix it ?

Код:
52) : error 021: symbol already defined: "udb_hash"
and the line of code 52

Код:
stock udb_hash(buf[]) {
    new length=strlen(buf);
    new s1 = 1;
    new s2 = 0;
    new n;
    for (n=0; n<length; n++)
    {
       s1 = (s1 + buf[n]) % 65521;
       s2 = (s2 + s1)     % 65521;
    }
    return (s2 << 16) + s1;
}
Thank you if you hepled me
Reply
#2

You already have the function udb_hash defined somewhere in your code.
Reply
#3

Thanks i have fixed it ?

and i wanted to know how to make a /admin command please help me
Reply
#4

@kyriakos587, what do you want to do from this command (/admin command)?
Reply
#5

i want /admin command so players can see whether the admins are online or not
Reply
#6

I use this:

PHP код:
COMMAND:admin(playerid,params[])
{
    new 
id[MAX_PLAYER_NAME], string[128];
    
SendClientMessage(playerid0xFFAE00FF" ");
    
SendClientMessage(playerid0xFFAE00FF"----' Online Admins '----");
    for(new 
0MAX_PLAYERSi++)
    {
        if(
IsPlayerConnected(i))
        {
          if(
PlayerInfo[i][pAdmin] > 0)
          {
                switch(
PlayerInfo[i][pAdmin])
                {
                case 
1AdmRank "Trial Moderator";
                case 
2AdmRank "Moderator";
                case 
3AdmRank "Master Moderator";
                case 
4AdmRank "Trial Administrator";
                case 
5AdmRank "Administrator";
                case 
6AdmRank "Master Administrator";
                case 
7AdmRank "Trusted Administrator";
                case 
8AdmRank "Head Administrator";
                case 
9AdmRank "Co-Owner";
                case 
10AdmRank "Owner";
                }
                
GetPlayerName(iidsizeof(id));
                
format(stringsizeof(string), "%s (%d) ({FF0000}%s{00FF00})"idiAdmRank);
                
SendClientMessage(playerid0x00FF00FFstring);
             }
             else if(!
IsPlayerConnected(i) && PlayerInfo[i][pAdmin] <= 0)
             {
               
SendClientMessage(playerid0xFFAE00FF"There Are No Admins Online");
             }
         }
    }
    return 
1;

Reply
#7

Thanks
Reply
#8

It shows me this error

Код:
C:\Users\Administrator\Desktop\SAMP\gamemodes\freeroam.pwn(5494) : error 017: undefined symbol "AdmRank"
C:\Users\Administrator\Desktop\SAMP\gamemodes\freeroam.pwn(5494) : error 017: undefined symbol "Administrator"
C:\Users\Administrator\Desktop\SAMP\gamemodes\freeroam.pwn(5494) : warning 215: expression has no effect
C:\Users\Administrator\Desktop\SAMP\gamemodes\freeroam.pwn(5495) : error 014: invalid statement; not in switch
C:\Users\Administrator\Desktop\SAMP\gamemodes\freeroam.pwn(5495) : warning 215: expression has no effect
C:\Users\Administrator\Desktop\SAMP\gamemodes\freeroam.pwn(5495) : error 001: expected token: ";", but found ":"
C:\Users\Administrator\Desktop\SAMP\gamemodes\freeroam.pwn(5495) : error 029: invalid expression, assumed zero
C:\Users\Administrator\Desktop\SAMP\gamemodes\freeroam.pwn(5495) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


6 Errors.
Reply
#9

Here:

PHP код:
COMMAND:admin(playerid,params[]) 

    new 
id[MAX_PLAYER_NAME], string[128]; 
    
SendClientMessage(playerid0xFFAE00FF" "); 
    
SendClientMessage(playerid0xFFAE00FF"----' Online Admins '----"); 
    for(new 
0MAX_PLAYERSi++) 
    { 
        if(
IsPlayerConnected(i)) 
        { 
             if(
PlayerInfo[i][pAdmin] > 0
             { 
                
GetPlayerName(iidsizeof(id)); 
                
format(stringsizeof(string), "%s (%d) "idi,); 
                
SendClientMessage(playerid0x00FF00FFstring); 
             } 
             else if(!
IsPlayerConnected(i) && PlayerInfo[i][pAdmin] <= 0
             { 
               
SendClientMessage(playerid0xFFAE00FF"There Are No Admins Online"); 
             } 
         } 
    } 
    return 
1

Reply
#10

i made my own command like this

Код:
CMD:akill(playerid,params[])
{
        if(!IsPlayerAnAdmin(playerid,4))return SendClientMessage(playerid,0xFF0000FF,"You're not allowed to use this command!");
        new pID, string[128],string3[128];
        if(sscanf(params,"u",pID))return SendClientMessage(playerid,COLOR_GREEN,"/akill [id]]");
        format(string,sizeof(string),"You adminkilled %s.",PlayerName(pID));
        for(new i=0;i<GetMaxPlayers();i++)
        {
        if(IsPlayerConnected(i))
        {
        if(IsPlayerAnAdmin(i,1))
        {
    	format(string3,sizeof(string3),"A: %s used the AKILL command.",PlayerName(playerid));
        SendClientMessage(i,COLOR_ORANGE,string3);
        }
        }
        }
        SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
        SendClientMessage(pID,COLOR_ORANGE,"* An admin killed you by a command.");
        SetPlayerHealth(pID,0);
        return 1;
}
and i use IsPlayerAnAdmin Function
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)