SA-MP Forums Archive
when a admin type /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: when a admin type /acmds (/showthread.php?tid=607586)



when a admin type /acmds - RedRex - 21.05.2016

Sup guys I need to know when a admin type /acmds he show commands admin but I want make if player level 1 show him only level 1 commands and 2same but how did we can do it??


Re: when a admin type /acmds - SyS - 21.05.2016

PHP код:
CMD:acmds(playerid)
{
if(
adminvariable[playerid]==1)//level 1 admin 
//show his cmds here in a dialog
if(adminvar[playerid]==2)//level 2
//same as above
return 1;

NOTE:its a sample code to give you idea on making your own


Re: when a admin type /acmds - luke49 - 21.05.2016

PHP код:
if (pInfo[playerid][AdminLevel] < 2)
{
    
//show 1 level admin cmds
}
if (
pInfo[playerid][AdminLevel] < 3)
{
    
//show 2 level admin cmds




Re: when a admin type /acmds - RedRex - 21.05.2016

thanks guys rep


Re: when a admin type /acmds - RedRex - 21.05.2016

its given me a errors Saw what i got

Код:
System.pwn(311) : error 017: undefined symbol "pInfo"
System.pwn(311) : warning 215: expression has no effect
System.pwn(311) : error 001: expected token: ";", but found "]"
System.pwn(311) : error 029: invalid expression, assumed zero
System.pwn(311) : fatal error 107: too many error messages on one line
and i type

PHP код:
CMD:acmds(playerid)
{
   if(
pInfo[playerid][AdminLevel] < 1)
   {
    
ShowPlayerDialog(playeridDIALOG_1DIALOG_STYLE_MSGBOX"Admin Commands Level 1","Soon Commands Added","Close");
   }
   if(
pInfo[playerid][AdminLevel] < 2)
   {
    
ShowPlayerDialog(playeridDIALOG_2DIALOG_STYLE_MSGBOX"Admin Commands Level 2","Soon Commands Added","Close");
   }
   if(
pInfo[playerid][AdminLevel] > 3)
   {
    
ShowPlayerDialog(playeridDIALOG_3DIALOG_STYLE_MSGBOX"Admin Commands Level 3","/Kick , Added More Soon","Close");
   }
   if(
pInfo[playerid][AdminLevel] > 4)
   {
    
ShowPlayerDialog(playeridDIALOG_4DIALOG_STYLE_MSGBOX"Admin Commands Level 4","/ban , Added More Soon","Close");
   }
   return 
1;

and up script i typed

Код:
#define DIALOG_1
#define DIALOG_2
#define DIALOG_3
#define DIALOG_4



Re: when a admin type /acmds - luke49 - 21.05.2016

at the top of your script:
PHP код:
enum PlayerInfo
{
    
AdminLevel
    
//here you can add more stuff, such as Score, Cash and etc.

PHP код:
new pInfo     [MAX_PLAYERS][PlayerInfo]; 



Re: when a admin type /acmds - oMa37 - 21.05.2016

Why don't use strcat?
Isn't it easier?

PHP код:
//Top of your script
    #define     strcpy(%0,%1) \ 
                    
strcat((%0[0] = '\0', %0), %1
PHP код:
CMD:acmds(playeridparams[])
{
    new 
STR[1246+546];
    if(
Variables of Level 1)
    {
        
strcat(STR"Level 1\n");
        
strcat(STR"Commands ..");
    }
    if(
Variables of Level 2)
    {
        
strcat(STR"Level 2\n");
        
strcat(STR"Commands ..");
    }
    
ShowPlayerDialog(playerid5411 DIALOG_STYLE_MSGBOX"ADMIN CMDS"STR"Close""");
    return 
1;




Re: when a admin type /acmds - RedRex - 21.05.2016

What the hell :O

Код:
C:\Users\Alomari\Desktop\New folder\System.pwn(173) : error 017: undefined symbol "PlayerInfo"
C:\Users\Alomari\Desktop\New folder\System.pwn(173) : error 009: invalid array size (negative, zero or out of bounds)
C:\Users\Alomari\Desktop\New folder\System.pwn(317) : warning 213: tag mismatch
C:\Users\Alomari\Desktop\New folder\System.pwn(319) : warning 202: number of arguments does not match definition
C:\Users\Alomari\Desktop\New folder\System.pwn(321) : warning 213: tag mismatch
C:\Users\Alomari\Desktop\New folder\System.pwn(323) : warning 202: number of arguments does not match definition
C:\Users\Alomari\Desktop\New folder\System.pwn(325) : warning 213: tag mismatch
C:\Users\Alomari\Desktop\New folder\System.pwn(327) : warning 202: number of arguments does not match definition
C:\Users\Alomari\Desktop\New folder\System.pwn(329) : warning 213: tag mismatch
C:\Users\Alomari\Desktop\New folder\System.pwn(331) : warning 202: number of arguments does not match definition
What happend o.o


Re: when a admin type /acmds - luke49 - 21.05.2016

Did you put new pInfo /.../ below enum PlayerInfo /.../?


Re: when a admin type /acmds - Stinged - 21.05.2016

Quote:
Originally Posted by RedRex
Посмотреть сообщение
its given me a errors Saw what i got
Код:
#define DIALOG_1
#define DIALOG_2
#define DIALOG_3
#define DIALOG_4
You're supposed to "define" something to make it replace something else.
So those should be defining id, which makes the compiler read "DIALOG_1" as 1
And if you don't understand what I mean...
Код:
#define DIALOG_1            1
A bit off topic: You misspelled "login" in your dialog title.