Admin command, 2 errors? +1 rep
#1

PHP код:
 error 010invalid function or declaration
error 010
invalid function or declaration 
On those two lines:

PHP код:
if(adminCount == 0SendClientMessage(playerid,-1,"There is no admin online!");
    return 
1
Here is the whole command:

PHP код:

CMD
:admins(playerid,params[])
{
    new 
adminCount,string[128];
    new 
Name[MAX_PLAYER_NAME];
    
GetPlayerName(playeridNamesizeof(Name));
        if(
PInfo[playerid][Level] > 0) {
            
format(string,sizeof(string),"[%s] %s",AdminLevelName(playerid),Name);
            
SendClientMessage(playerid,-1,string);
            
adminCount++;
        }
    }
    if(
adminCount == 0SendClientMessage(playerid,-1,"There is no admin online!");
    return 
1;

And please help, I couldnt findout to give REP last time, but I found out to do now!
Reply
#2

pawn Код:
if(adminCount == 0) return  SendClientMessage(playerid,-1,"There is no admin online!");


----

CMD:admins(playerid,params[])
{
    new adminCount,string[128];
    new Name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, Name, sizeof(Name));
        if(PInfo[playerid][Level] > 0) {
            format(string,sizeof(string),"[%s] %s",AdminLevelName(playerid),Name);
            SendClientMessage(playerid,-1,string);
            adminCount++;
        }
    }
    if(adminCount == 0) return  SendClientMessage(playerid,-1,"There is no admin online!");
    return 1;
}
Reply
#3

Quote:
Originally Posted by Jony_Cruze
Посмотреть сообщение
if(adminCount == 0) return SendClientMessage(playerid,-1,"There is no admin online!");
return 0;
}
Jony Cruze's answer is incorrect, as he is returning twice and not opening a bracket. You'll get an unreachable code error and probably a lot of other errors. He's also a jerk for editing his post and them commenting below, but that's not really my issue

pawn Код:
if(adminCount == 0) return SendClientMessage(playerid,-1,"There is no admin online!");
Just this will work

Also, you're closing a bracket and I'm not sure where its from, look into that too.
Reply
#4

pawn Код:
CMD:admins(playerid,params[])
{
    new adminCount,string[128];
    new Name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, Name, sizeof(Name));
        if(PInfo[playerid][Level] > 0) {
            format(string,sizeof(string),"[%s] %s",AdminLevelName(playerid),Name);
            SendClientMessage(playerid,-1,string);
            adminCount++;
        }
    }
    if(adminCount == 0) return SendClientMessage(playerid,-1,"There is no admin online!");
    return 1;
}
Reply
#5

Now let's post all players of samp.com the copied respons...loosers
Reply
#6

lmao, none of this worked.
Reply
#7

Quote:
Originally Posted by Lynet
Посмотреть сообщение
lmao, none of this worked.
Did you also fix the bracket issue I pointed out?

Keep in mind GetPlayerName doesn't actually open a new bracket, as your code seems to think.
Reply
#8

pawn Код:
CMD:admins(playerid,params[])
{
    new adminCount,string[128];
    new Name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, Name, sizeof(Name));
    if(PInfo[playerid][Level] > 0)
    {
        format(string,sizeof(string),"[%s] %s",AdminLevelName(playerid),Name);
        SendClientMessage(playerid,-1,string);
        adminCount++;
   
    }
    else if(adminCount == 0)
    {
        SendClientMessage(playerid,-1,"There is no admin online!");
    }
}
Reply
#9

got one error now:

error 010: invalid function or declaration

on this line:

PHP код:
if(adminCount == 0
Reply
#10

Quote:
Originally Posted by Jony_Cruze
Посмотреть сообщение
pawn Код:
CMD:admins(playerid,params[])
{
    new adminCount,string[128];
    new Name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, Name, sizeof(Name));
    if(PInfo[playerid][Level] > 0)
    {
        format(string,sizeof(string),"[%s] %s",AdminLevelName(playerid),Name);
        SendClientMessage(playerid,-1,string);
        adminCount++;
   
    }
    else if(adminCount == 0)
    {
        SendClientMessage(playerid,-1,"There is no admin online!");
    }
}
Stop copying other people's replies and trying to look smart you weirdo.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)