[ZCMD]Admin Errore
#1

pawn Код:
CMD:ladmins(playerid,params[])
{
    #pragma unused params
        new count = 0;
        new string[128];
        SendClientMessage(playerid, green, " ");
        SendClientMessage(playerid, green, "___________ |- Online Admins -| ___________");
        SendClientMessage(playerid, green, " ");
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if (IsPlayerConnected(i))
            {
                if(PlayerInfo[i][Level] >= 1 && PlayerInfo[i][Hide] == 0)
                {
                    if(PlayerInfo[i][Level] > 5)
                    {
                        AdmRank = "Professional Admin";
                    }
                    if(IsPlayerAdmin(i))
                    {
                        AdmRank = "RCON Administrator";
                    }
                    else
                    {
                        switch(PlayerInfo[i][Level])
                        {
                            case 1: {
                            AdmRank = "Basic Moderator";
                            }
                            case 2: {
                            AdmRank = "Moderator";
                            }
                            case 3: {
                            AdmRank = "Master Moderator";
                            }
                            case 4: {
                            AdmRank = "Administrator";
                            }
                            case 5: {
                            AdmRank = "Master Administrator";
                            }
                        }
                    }
                    switch(PlayerInfo[i][OnDuty])
                    {
                        case 0: {
                        AdmDuty = "Playing!";
                        }
                        case 1: {
                        AdmDuty = "On Duty!";
                        }
                      }
                    }
                    format(string, 128, "Level: %d - %s (Id:%i) | %s | %s",PlayerInfo[i][Level], PlayerName2(i),i,AdmRank,AdmDuty);
                    SendClientMessage(playerid, string);
                    count++;
                }
            }
        }
        if (count == 0)
        SendClientMessage(playerid,red,"No admin online in the list");
        SendClientMessage(playerid, green, " _______________________________________");
        return 1;
}

My Error:


PHP код:
C:\Documents and Settings\PhongLan\Desktop\New Folder (8)\gamemodes\SATDM_v9.pwn(20785) : error 022must be lvalue (non-constant)
C:\Documents and Settings\PhongLan\Desktop\New Folder (8)\gamemodes\SATDM_v9.pwn(20785) : warning 215expression has no effect
C
:\Documents and Settings\PhongLan\Desktop\New Folder (8)\gamemodes\SATDM_v9.pwn(20788) : error 022must be lvalue (non-constant)
C:\Documents and Settings\PhongLan\Desktop\New Folder (8)\gamemodes\SATDM_v9.pwn(20788) : warning 215expression has no effect
C
:\Documents and Settings\PhongLan\Desktop\New Folder (8)\gamemodes\SATDM_v9.pwn(20792) : warning 217loose indentation
C
:\Documents and Settings\PhongLan\Desktop\New Folder (8)\gamemodes\SATDM_v9.pwn(20793) : error 035argument type mismatch (argument 2)
C:\Documents and Settings\PhongLan\Desktop\New Folder (8)\gamemodes\SATDM_v14.pwn(20798) : error 010invalid function or declaration
C
:\Documents and Settings\PhongLan\Desktop\New Folder (8)\gamemodes\SATDM_v14.pwn(20801) : error 010invalid function or declaration
Pawn compiler 3.2.3664              Copyright 
(c1997-2006ITB CompuPhase 
-Can You guy help ? REP REP REP ++++
Reply
#2

error 035: argument type mismatch (argument 2)

You just forgot the second parameter of SendClientMessage function.

pawn Код:
SendClientMessage(playerid,color,msg[]);
error 022: must be lvalue (non-constant)

This is error is caused when you set values to enum, for example:

pawn Код:
enum error
{
    enumitem
}

enumitem = 10;
The right way to use enums with variables, is setting them into an array, like this:

pawn Код:
enum myenum
{
    item1,
    item2
}

new MyArray[myenum];

MyArray[item1] = 1;
warning 217: loose indentation

You forgot to use the proper tab indentation. A 'dirty' code, without indentation look like this:

pawn Код:
new mycode;
if(mycode == 0)
{
SendClientMessage(playerid,-1,"You're a dirty scripter!");
}
Now, the same code, much better to see from where wich line belongs, using indentation

pawn Код:
new mycode;
if(mycode == 0)
{
    SendClientMessage(playerid,-1,"You're a clean scripter!");
}
Search for some tutorials about this.

error 010: invalid function or declaration

You've closed more brackets then you've opened.

This is a erroneous code, opening 2 brackets, and closing 3.

pawn Код:
public OnPlayerConnect(playerid)
{
    printf("Hello world!");
    if(gettime() == gettime())
    {
        printf("Why the hell do a comparison like that?");
    }
    }
    return 1;
}
Now the right code:

pawn Код:
public OnPlayerConnect(playerid)
{
    printf("Hello world!");
    if(gettime() == gettime())
    {
        printf("Why the hell do a comparison like that?");
    }
    return 1;
}
So, this is it. Hope you learn something.
Reply
#3

can you fix my command for my becuz i'm realy confusing
Reply
#4

Quote:
Originally Posted by donhu789
Посмотреть сообщение
can you fix my command for my becuz i'm realy confusing
Did you at least tried to fix one of this errors? This is the only way to learn, trying.
Reply
#5

i fix some but i have those code again i bit confusing for now can you just help once i will try other becuz i'm scripting other TRUSTED PLAYER,VIPS , Master Admin, Now i confusing of this for now
Reply
#6

no more help ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)