Jump to content

Recommended Posts

Posted
mp.events.addCommand('AnyCommandToMakeTheMasterAdmin', (player) => {
    player.data.adminMaster = true
    player.outputChatBox(`Logged as Admin Master`)
})

mp.events.addCommand('setadminlevel', (player, fullText, targetID, targetLevel) => {
    if(!player.data.adminMaster){
        player.outputChatBox(`You are not logged in as admin master`)
        return
    }
    targetLevel = parseInt(targetLevel)
    if(isNaN(targetLevel) || targetLevel < 0 || targetLevel > 3){
        player.outputChatBox(`You didn't set a correct level! /setadminlevel [level 0-3]`)
        return
    }
    targetID = parseInt(targetID)
    if(isNaN(targetID)){
        player.outputChatBox(`You didn't enter a correct player ID`)
        return
    }
    const sourcePlayer = mp.players.at(targetID)
    if(!sourcePlayer){
        player.outputChatBox(`This player is not logged`)
        return
    }
    sourcePlayer.data.admin = targetLevel
    sourcePlayer.outputChatBox(`You are now a level ${targetLevel} admin`)
})

mp.events.addCommand('ban', (player, targetID) => {
    if(player.data.admin < 1){
        player.outputChatBox(`You cannot use this command`)
        return
    }
    targetID = parseInt(targetID)
    if(isNaN(targetID)){
        player.outputChatBox(`You didn't enter a correct player ID! /ban [id]`)
        return
    }
    const sourcePlayer = mp.players.at(targetID)
    if(!sourcePlayer){
        player.outputChatBox(`This player is not logged`)
        return
    }
    sourcePlayer.ban('Banned.')
    sourcePlayer.outputChatBox(`You have been banned from this server`)
})

I use something like this
You can put any command as a password and become admin master, as much as the ban list and admin level should be saved in a database

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...