I need help for the admin commands please help
#1

This is the code if you just make me a simple command with the If AdminLevel = 6 or something like this but i don't want this : if(IsPlayerAdmin(playerid)) because this is only for rcon i want it to be only for my system so if someone can help it would be great ! Thanks In advance

PHP код:
#include <a_samp>
#include <Double-O-Files_2>
#define DIALOG_REGISTER 1
#define DIALOG_LOGIN 2
#define WHITE "{FFFFFF}"
#define RED "{F81414}"
#define GREEN "{00FF22}"
enum P_ENUM
{
    
pMoney,
    
pAdmin,
    
pKills,
    
pDeaths
}
new 
PlayerInfoMAX_PLAYERS ][ P_ENUM ];
stock USER_FILE(playerid)
{
    new 
        
STR128 ],
        
P_NAMEMAX_PLAYER_NAME ];
        
    
GetPlayerNameplayeridP_NAME,  sizeof P_NAME ) );
    
formatSTRsizeof STR ), USER_FILE_PATHP_NAME);
    return
        
STR;
}
stock Load_Player_Stats(playerid)
{
    
PlayerInfoplayerid ][ pKills ] = DOF2_GetIntUSER_FILEplayerid ),"Kills"); 
    
PlayerInfoplayerid ][ pDeaths ] = DOF2_GetIntUSER_FILEplayerid ),"Deaths");
    
PlayerInfoplayerid ][ pMoney ] = DOF2_GetIntUSER_FILEplayerid ),"Money");
    
PlayerInfoplayerid ][ pAdmin ] = DOF2_GetIntUSER_FILEplayerid ),"AdminLevel");
    
GivePlayerMoney(playeridPlayerInfoplayerid ][ pMoney ]);
}
public 
OnFilterScriptInit()
{
    return 
1;
}
public 
OnFilterScriptExit()
{
    
DOF2_Exit();
    return 
1;
}
public 
OnPlayerRequestClass(playeridclassid)
{
    return 
1;
}
public 
OnPlayerConnect(playerid)
{
    if( 
DOF2_FileExists USER_FILE playerid ) ) ) 
    {
        
ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_INPUT,"Welcome.Please log-in",""WHITE"Type your "GREEN"password "WHITE"here to log-in","Log-in","Quit");
        
    }   
    else 
    {
        
ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_STYLE_INPUT,"Please register!",""WHITE"Type your "GREEN"password "WHITE"here to register.","Register","Quit");
        
    }
    return 
1;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    switch( 
dialogid 
    {
        case 
DIALOG_REGISTER
        {
            if ( !
response ) return Kickplayerid ); 
            if( 
response 
            {
                if( !
strlen inputtext ) ) return ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_INPUT,""WHITE"Welcome.Please log-in","You have entered an "RED"invalid"WHITE" password\n"WHITE"Type your "GREEN"password "WHITE"here to log-in","Log-in","Quit");
                
DOF2_CreateFileUSER_FILE playerid ), inputtext ); 
                
DOF2_SetIntUSER_FILE playerid ), "Kills"0);
                
DOF2_SetIntUSER_FILE playerid ), "Deaths"0); 
                
DOF2_SetIntUSER_FILE playerid ), "Money"1000);
                
DOF2_SetIntUSER_FILE playerid ), "AdminLevel"0);
                
DOF2_SaveFile(); 
                
SetSpawnInfoplayerid001958.331343.1215.36269.1500000);
                
SpawnPlayerplayerid ); 
                
GivePlayerMoney(playerid1000);
            }
        }
        case 
DIALOG_LOGIN
        {
            if ( !
response ) return Kickplayerid ); 
            if( 
response 
            {
                if( 
DOF2_CheckLoginUSER_FILEplayerid ), inputtext ) )   
                {
                    
Load_Player_Stats(playerid); 
                }
                else 
                {
                    
ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_INPUT,""WHITE"Login","You have entered an "RED"incorrect "WHITE"password.\n{FFFFFF}Type your "GREEN"password "WHITE"below to login.","Login","Quit");
                    
                }
                return 
1;
            }
        }
    }
    return 
1;
}
public 
OnPlayerDisconnect(playeridreason)
{
    
DOF2_SetIntUSER_FILE playerid ), "Kills"PlayerInfoplayerid ][ pKills ] ); 
    
DOF2_SetIntUSER_FILE playerid ), "Deaths"PlayerInfoplayerid ][ pDeaths ] );
    
DOF2_SetIntUSER_FILE playerid ), "Money"GetPlayerMoneyplayerid ) );
    
DOF2_SetIntUSER_FILE playerid ), "AdminLevel"PlayerInfoplayerid ][ pAdmin ] );
    
DOF2_SaveFile();
    return 
1;
}
public 
OnPlayerDeath(playeridkilleridreason

    if( 
killerid != INVALID_PLAYER_ID )
    {
        
PlayerInfoplayerid ][ pKills ] ++;
    }
    
PlayerInfoplayerid ][ pDeaths ] ++;
    return 
1;

Reply
#2

You need first command to make admin..

PHP код:
if(PlayerInfo[playerid][pAdmin] < 1
example for zcmd:
PHP код:
COMMAND:test(playerid,params[]) //change 'test' to your command name
{
    if(
PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid,COLOR_WHITE,"You are not Admin."); //This is what you wont
    
{
              
//
    
}
    return 
1;

Reply
#3

Quote:
Originally Posted by MonkStudio
Посмотреть сообщение
You need first command to make admin..

PHP код:
if(PlayerInfo[playerid][pAdmin] < 1
example for zcmd:
PHP код:
COMMAND:test(playerid,params[]) //change 'test' to your command name
{
    if(
PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid,COLOR_WHITE,"You are not Admin."); //This is what you wont
    
{
              
//
    
}
    return 
1;

Those { and } after if are useless since you used return
Reply
#4

Thank you guys so much i know how to convert to strcmp i only needed to replace if(IsPlayerAdmin(playerid)) with if(PlayerInfo[playerid][pAdmin] < 1) and worked !! Thanks
Reply
#5

I got one more question how to make a /makeadmin cmd in strcmp if you can help it will ROCK thanks in advance again and sorry for those question they may be easy for you but im ne to scripting soon ill release my DM gamemode thats why i need /makeadmin in stcmp i need it to be able to make ppl between 1-2nd level
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)