SA-MP Forums Archive
Admin command, 2 errors? +1 rep - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Admin command, 2 errors? +1 rep (/showthread.php?tid=430218)



Admin command, 2 errors? +1 rep - Lynet - 13.04.2013

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!


Re: Admin command, 2 errors? +1 rep - Jony_Cruze - 13.04.2013

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;
}



Re: Admin command, 2 errors? +1 rep - Revo - 13.04.2013

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.


Re: Admin command, 2 errors? +1 rep - Avi Raj - 13.04.2013

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;
}



Re: Admin command, 2 errors? +1 rep - Jony_Cruze - 13.04.2013

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


Re: Admin command, 2 errors? +1 rep - Lynet - 13.04.2013

lmao, none of this worked.


Re: Admin command, 2 errors? +1 rep - Revo - 13.04.2013

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.


Re: Admin command, 2 errors? +1 rep - Jony_Cruze - 13.04.2013

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!");
    }
}



Re: Admin command, 2 errors? +1 rep - Lynet - 13.04.2013

got one error now:

error 010: invalid function or declaration

on this line:

PHP код:
if(adminCount == 0



Re: Admin command, 2 errors? +1 rep - Potassium - 13.04.2013

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.