View Single Post
lexzor
Veteran Member
Join Date: Nov 2020
Old 07-10-2022 , 05:30   Re: [REQ] getxp for OcixCrom xp system
Reply With Quote #4

PHP Code:
#include <amxmodx>
#include <cromchat>
#include <crxranks>

new bool:bGot[MAX_PLAYERS 1];

public 
plugin_init()
{
    
register_plugin("CRXRanks: GetXP Cmd""1.0""OciXCrom")
    
register_clcmd("say /getxp""Cmd_GetXP")
    
register_clcmd("say_team /getxp""Cmd_GetXP")
    
crxranks_get_chat_prefix(CC_PREFIXcharsmax(CC_PREFIX))
}

public 
client_connect(id)
{
    
bGot[id] = false;
}

public 
Cmd_GetXP(id)
{
    if(
bGot[id] == true)
    {
      
CC_SendMessage(id"You already got your bonus.")
        return 
PLUGIN_HANDLED;
    }

    if(
get_user_flags(id) & ADMIN_LEVEL_B)
    {
        new 
iRandom random_num(50150)
        
crxranks_give_user_xp(idiRandom)
        
CC_SendMessage(id"Yay! You received &x04%i XP&x01!"iRandom)
      
bGot[id] = true;
    }
    else
    {
        
CC_SendMessage(id"You have no access to this command.")
    }

    return 
PLUGIN_HANDLED

lexzor is offline