SA-MP Forums Archive
Problem with acmds - 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: Problem with acmds (/showthread.php?tid=638879)



Problem with acmds - baki - 07.08.2017

PHP код:
COMMAND:acmds(playeridparams[])
{
        if(
GetPVarInt(playerid"PlayerAdminLevel") < 1) return SCM(playeridCOLOR_RED"You need to be admin to use this command!");
        if(
GetPVarInt(playerid"PlayerAdminLevel") == 1){
        
SCM(playerid,-1,""COL_YELLOW"=======Commands======="); <------line 515
        SCM
(playerid,-1,""COL_YELLOW"Level 1:"COL_RED" /say | /(un)freeze | /goto | /[un]mute ");}
        if(
GetPVarInt(playerid"PlayerAdminLevel") == 2){
        
SCM(playerid,-1,""COL_YELLOW"=======Commands=======");
        
SCM(playerid,-1,""COL_YELLOW"Level 1:"COL_RED" /say | /(un)freeze | /goto | /[un]mute ");
        
SCM(playerid,-1,""COL_YELLOW"Level 2:"COL_RED" /kick | /announce | /bring | /drop | /(un)jail | /spawn | /ip ");}
        if(
GetPVarInt(playerid"PlayerAdminLevel") == 3){
        
SCM(playerid,-1,""COL_YELLOW"=======Commands=======");
        
SCM(playerid,-1,""COL_YELLOW"Level 1:"COL_RED" /say | /(un)freeze | /goto | /[un]mute ");
        
SCM(playerid,-1,""COL_YELLOW"Level 2:"COL_RED" /kick | /announce | /bring | /drop | /(un)jail | /spawn | /ip ");
        
SCM(playerid,-1,""COL_YELLOW"Level 3:"COL_RED" /slay | /explode | /ban | /setdeaths | /setkills ");}
        if(
GetPVarInt(playerid"PlayerAdminLevel") == 4){
        
SCM(playerid,-1,""COL_YELLOW"=======Commands=======");
        
SCM(playerid,-1,""COL_YELLOW"Level 1:"COL_RED" /say | /(un)freeze | /goto | /[un]mute |");
        
SCM(playerid,-1,""COL_YELLOW"Level 2:"COL_RED" /kick | /announce | /bring | /drop | /(un)jail | /spawn | /ip ");
        
SCM(playerid,-1,""COL_YELLOW"Level 3:"COL_RED" /slay | /explode | /ban | /setdeaths | /setkills ");
        
SCM(playerid,-1,""COL_YELLOW"Level 4:"COL_RED" /setscore | /setmoney | /setplayerbank | /healall | /armourall | /disarm | /unban");}
        if(
GetPVarInt(playerid"PlayerAdminLevel") == 5){
        
SCM(playerid,-1,""COL_YELLOW"=======Commands=======");
        
SCM(playerid,-1,""COL_YELLOW"Level 1:"COL_RED" /say | /(un)freeze | /goto | /[un]mute |");
        
SCM(playerid,-1,""COL_YELLOW"Level 2:"COL_RED" /kick | /announce | /bring | /drop | /(un)jail | /spawn | /ip ");
        
SCM(playerid,-1,""COL_YELLOW"Level 3:"COL_RED" /slay | /explode | /ban | /setdeaths | /setkills ");
        
SCM(playerid,-1,""COL_YELLOW"Level 4:"COL_RED" /setscore | /setmoney | /setplayerbank | /healall | /armourall | /disarm | /unban");}
        
SCM(playerid,-1,""COL_YELLOW"Level 5:"COL_RED" /setlevel | /gmx ");}
        return 
1;

The errors i get

PHP код:
C:\Users\Baki\Desktop\developer\pawno\include\_mysql_register.inc(515) : error 001expected token"-string end-"but found "-identifier-"
C:\Users\Baki\Desktop\developer\pawno\include\_mysql_register.inc(515) : warning 215expression has no effect
C
:\Users\Baki\Desktop\developer\pawno\include\_mysql_register.inc(515) : error 001expected token";"but found "-string-"
C:\Users\Baki\Desktop\developer\pawno\include\_mysql_register.inc(515) : warning 215expression has no effect
C
:\Users\Baki\Desktop\developer\pawno\include\_mysql_register.inc(515) : error 001expected token";"but found ")"
C:\Users\Baki\Desktop\developer\pawno\include\_mysql_register.inc(515) : fatal error 107too many error messages on one line 
Will be glad to rep you if you helped me!


Re: Problem with acmds - Eoussama - 07.08.2017

Show SCM and COL_YELLOW


Re: Problem with acmds - baki - 07.08.2017

Quote:
Originally Posted by Eoussama
Посмотреть сообщение
Show SCM and COL_YELLOW
You mean i should show if i put the include or the include itself?

PHP код:
// Include by Zeex
#include <zcmd>
#include <SCM>
#include <sscanf2>
// Include by ******
// *****************************************************************************
// Defines
// *******
#define COL_YELLOW 0xFFFF00AA
//White
#define COLOR_WHITE         0xFFFFFFFF
// Red Color
#define COLOR_RED 0xFF0033AA
// Green Color
#define COLOR_GREEN 0x33AA33FF
// Yellow Color
#define COLOR_SAY 0xFFDD00AA 



Re: Problem with acmds - Eoussama - 07.08.2017

This is your mistake
#define COL_YELLOW 0xFFFF00AA

You can't use hex color in text formatting,
here's a correct practice
#define COL_YELLOW "{FFFF00}"

Make writing readable code a habbit, here's a clearner version
PHP код:
#define COL_YELLOW2 "{FFFF00}"
#define COL_RED2 "{FF0000}"
//if/else if
COMMAND:acmds(playerid

    if(
GetPVarInt(playerid"PlayerAdminLevel") < 1) return SendClientMessage(playeridCOLOR_RED"You need to be admin to use this command!"); 
    
    
SendClientMessage(playerid,-1,""COL_YELLOW2"=======Commands======="); 
    if(
GetPVarInt(playerid"PlayerAdminLevel") == 1)
        
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 1:"COL_RED2" /say | /(un)freeze | /goto | /[un]mute ");
    else if(
GetPVarInt(playerid"PlayerAdminLevel") == 2)
    {  
        
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 1:"COL_RED2" /say | /(un)freeze | /goto | /[un]mute "); 
        
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 2:"COL_RED2" /kick | /announce | /bring | /drop | /(un)jail | /spawn | /ip ");
    } 
    else if(
GetPVarInt(playerid"PlayerAdminLevel") == 3)
    { 
        
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 1:"COL_RED2" /say | /(un)freeze | /goto | /[un]mute "); 
        
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 2:"COL_RED2" /kick | /announce | /bring | /drop | /(un)jail | /spawn | /ip "); 
        
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 3:"COL_RED2" /slay | /explode | /ban | /setdeaths | /setkills ");
    }
    else if(
GetPVarInt(playerid"PlayerAdminLevel") == 4)
    {  
        
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 1:"COL_RED2" /say | /(un)freeze | /goto | /[un]mute |"); 
        
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 2:"COL_RED2" /kick | /announce | /bring | /drop | /(un)jail | /spawn | /ip "); 
        
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 3:"COL_RED2" /slay | /explode | /ban | /setdeaths | /setkills "); 
        
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 4:"COL_RED2" /setscore | /setmoney | /setplayerbank | /healall | /armourall | /disarm | /unban");
    } 
    else if(
GetPVarInt(playerid"PlayerAdminLevel") == 5)
    {  
        
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 1:"COL_RED2" /say | /(un)freeze | /goto | /[un]mute |"); 
        
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 2:"COL_RED2" /kick | /announce | /bring | /drop | /(un)jail | /spawn | /ip "); 
        
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 3:"COL_RED2" /slay | /explode | /ban | /setdeaths | /setkills "); 
        
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 4:"COL_RED2" /setscore | /setmoney | /setplayerbank | /healall | /armourall | /disarm | /unban");
        
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 5:"COL_RED2" /setlevel | /gmx ");
    } 
    
    return 
1
}
//switch (better than the one above, and faster) 
COMMAND:acmds(playerid

    if(
GetPVarInt(playerid"PlayerAdminLevel") < 1) return SendClientMessage(playeridCOLOR_RED"You need to be admin to use this command!"); 
    
    
SendClientMessage(playerid,-1,""COL_YELLOW2"=======Commands======="); 
    switch(
GetPVarInt(playerid"PlayerAdminLevel"))
    {
        case 
1:
            
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 1:"COL_RED2" /say | /(un)freeze | /goto | /[un]mute ");
        case 
2:
        {
            
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 1:"COL_RED2" /say | /(un)freeze | /goto | /[un]mute "); 
            
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 2:"COL_RED2" /kick | /announce | /bring | /drop | /(un)jail | /spawn | /ip ");
        }
        case 
3:
        {
            
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 1:"COL_RED2" /say | /(un)freeze | /goto | /[un]mute "); 
            
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 2:"COL_RED2" /kick | /announce | /bring | /drop | /(un)jail | /spawn | /ip "); 
            
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 3:"COL_RED2" /slay | /explode | /ban | /setdeaths | /setkills ");
        }
        case 
4:
        {
            
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 1:"COL_RED2" /say | /(un)freeze | /goto | /[un]mute |"); 
            
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 2:"COL_RED2" /kick | /announce | /bring | /drop | /(un)jail | /spawn | /ip "); 
            
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 3:"COL_RED2" /slay | /explode | /ban | /setdeaths | /setkills "); 
            
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 4:"COL_RED2" /setscore | /setmoney | /setplayerbank | /healall | /armourall | /disarm | /unban");
        }
        case 
5:
        {
            
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 1:"COL_RED2" /say | /(un)freeze | /goto | /[un]mute |"); 
            
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 2:"COL_RED2" /kick | /announce | /bring | /drop | /(un)jail | /spawn | /ip "); 
            
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 3:"COL_RED2" /slay | /explode | /ban | /setdeaths | /setkills "); 
            
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 4:"COL_RED2" /setscore | /setmoney | /setplayerbank | /healall | /armourall | /disarm | /unban");
            
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 5:"COL_RED2" /setlevel | /gmx ");
        }
    }
    
    return 
1




Re: Problem with acmds - baki - 07.08.2017

Quote:
Originally Posted by Eoussama
Посмотреть сообщение
This is your mistake
#define COL_YELLOW 0xFFFF00AA

You can't use hex color in text formatting,
here's a correct practice
#define COL_YELLOW "{FFFF00}"

Make writing readable code a habbit, here's a clearner version
PHP код:
#define COL_YELLOW2 "{FFFF00}"
#define COL_RED2 "{FF0000}"
//if/else if
COMMAND:acmds(playerid

    if(
GetPVarInt(playerid"PlayerAdminLevel") < 1) return SendClientMessage(playeridCOLOR_RED"You need to be admin to use this command!"); 
    
    
SendClientMessage(playerid,-1,""COL_YELLOW2"=======Commands======="); 
    if(
GetPVarInt(playerid"PlayerAdminLevel") == 1)
        
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 1:"COL_RED2" /say | /(un)freeze | /goto | /[un]mute ");
    else if(
GetPVarInt(playerid"PlayerAdminLevel") == 2)
    {  
        
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 1:"COL_RED2" /say | /(un)freeze | /goto | /[un]mute "); 
        
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 2:"COL_RED2" /kick | /announce | /bring | /drop | /(un)jail | /spawn | /ip ");
    } 
    else if(
GetPVarInt(playerid"PlayerAdminLevel") == 3)
    { 
        
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 1:"COL_RED2" /say | /(un)freeze | /goto | /[un]mute "); 
        
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 2:"COL_RED2" /kick | /announce | /bring | /drop | /(un)jail | /spawn | /ip "); 
        
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 3:"COL_RED2" /slay | /explode | /ban | /setdeaths | /setkills ");
    }
    else if(
GetPVarInt(playerid"PlayerAdminLevel") == 4)
    {  
        
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 1:"COL_RED2" /say | /(un)freeze | /goto | /[un]mute |"); 
        
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 2:"COL_RED2" /kick | /announce | /bring | /drop | /(un)jail | /spawn | /ip "); 
        
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 3:"COL_RED2" /slay | /explode | /ban | /setdeaths | /setkills "); 
        
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 4:"COL_RED2" /setscore | /setmoney | /setplayerbank | /healall | /armourall | /disarm | /unban");
    } 
    else if(
GetPVarInt(playerid"PlayerAdminLevel") == 5)
    {  
        
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 1:"COL_RED2" /say | /(un)freeze | /goto | /[un]mute |"); 
        
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 2:"COL_RED2" /kick | /announce | /bring | /drop | /(un)jail | /spawn | /ip "); 
        
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 3:"COL_RED2" /slay | /explode | /ban | /setdeaths | /setkills "); 
        
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 4:"COL_RED2" /setscore | /setmoney | /setplayerbank | /healall | /armourall | /disarm | /unban");
        
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 5:"COL_RED2" /setlevel | /gmx ");
    } 
    
    return 
1
}
//switch (better than the one above, and faster) 
COMMAND:acmds(playerid

    if(
GetPVarInt(playerid"PlayerAdminLevel") < 1) return SendClientMessage(playeridCOLOR_RED"You need to be admin to use this command!"); 
    
    
SendClientMessage(playerid,-1,""COL_YELLOW2"=======Commands======="); 
    switch(
GetPVarInt(playerid"PlayerAdminLevel"))
    {
        case 
1:
            
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 1:"COL_RED2" /say | /(un)freeze | /goto | /[un]mute ");
        case 
2:
        {
            
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 1:"COL_RED2" /say | /(un)freeze | /goto | /[un]mute "); 
            
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 2:"COL_RED2" /kick | /announce | /bring | /drop | /(un)jail | /spawn | /ip ");
        }
        case 
3:
        {
            
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 1:"COL_RED2" /say | /(un)freeze | /goto | /[un]mute "); 
            
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 2:"COL_RED2" /kick | /announce | /bring | /drop | /(un)jail | /spawn | /ip "); 
            
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 3:"COL_RED2" /slay | /explode | /ban | /setdeaths | /setkills ");
        }
        case 
4:
        {
            
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 1:"COL_RED2" /say | /(un)freeze | /goto | /[un]mute |"); 
            
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 2:"COL_RED2" /kick | /announce | /bring | /drop | /(un)jail | /spawn | /ip "); 
            
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 3:"COL_RED2" /slay | /explode | /ban | /setdeaths | /setkills "); 
            
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 4:"COL_RED2" /setscore | /setmoney | /setplayerbank | /healall | /armourall | /disarm | /unban");
        }
        case 
5:
        {
            
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 1:"COL_RED2" /say | /(un)freeze | /goto | /[un]mute |"); 
            
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 2:"COL_RED2" /kick | /announce | /bring | /drop | /(un)jail | /spawn | /ip "); 
            
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 3:"COL_RED2" /slay | /explode | /ban | /setdeaths | /setkills "); 
            
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 4:"COL_RED2" /setscore | /setmoney | /setplayerbank | /healall | /armourall | /disarm | /unban");
            
SendClientMessage(playerid,-1,""COL_YELLOW2"Level 5:"COL_RED2" /setlevel | /gmx ");
        }
    }
    
    return 
1

Thank you very much my friend REP+