AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   [REQ] getxp for OcixCrom xp system (https://forums.alliedmods.net/showthread.php?t=338476)

Taha_rajper 07-07-2022 14:37

[REQ] getxp for OcixCrom xp system
 
Hello, I Need A Plugin When A Admin With flag "n" [ADMIN_LEVEL_B] Type /getxp it Gives Him xp Between 50-150

I'm Using OcixCrom Xp System

Ty

OciXCrom 07-08-2022 14:25

Re: [REQ] getxp for OcixCrom xp system
 
Code:
#include <amxmodx> #include <cromchat> #include <crxranks> 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_PREFIX, charsmax(CC_PREFIX)) } public Cmd_GetXP(id) {     if(get_user_flags(id) & ADMIN_LEVEL_B)     {         new iRandom = random_num(50, 150)         crxranks_give_user_xp(id, iRandom)         CC_SendMessage(id, "Yay! You received &x04%i XP&x01!", iRandom)     }     else     {         CC_SendMessage(id, "You have no access to this command.")     }     return PLUGIN_HANDLED }

Taha_rajper 07-09-2022 06:32

Re: [REQ] getxp for OcixCrom xp system
 
Quote:

Originally Posted by OciXCrom (Post 2783364)
Code:
#include <amxmodx> #include <cromchat> #include <crxranks> 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_PREFIX, charsmax(CC_PREFIX)) } public Cmd_GetXP(id) {     if(get_user_flags(id) & ADMIN_LEVEL_B)     {         new iRandom = random_num(50, 150)         crxranks_give_user_xp(id, iRandom)         CC_SendMessage(id, "Yay! You received &x04%i XP&x01!", iRandom)     }     else     {         CC_SendMessage(id, "You have no access to this command.")     }     return PLUGIN_HANDLED }

Can you make it only once per map ?

lexzor 07-10-2022 05:30

Re: [REQ] getxp for OcixCrom xp system
 
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



OciXCrom 07-10-2022 07:21

Re: [REQ] getxp for OcixCrom xp system
 
@lexzor - Re-joining the server will allow for the command to be used again.

Code:
#include <amxmodx> #include <cromchat> #include <crxranks> #if !defined MAX_AUTHID_LENGTH     const MAX_AUTHID_LENGTH = 64 #endif #if !defined MAX_PLAYERS     const MAX_PLAYERS = 32 #endif new Trie:g_tPlayers new g_szAuthId[MAX_PLAYERS][MAX_AUTHID_LENGTH] 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_PREFIX, charsmax(CC_PREFIX))     g_tPlayers = TrieCreate() } public plugin_end() {     TrieDestroy(g_tPlayers) } public client_authorized(id) {     get_user_authid(id, g_szAuthId[id], charsmax(g_szAuthId[])) } public Cmd_GetXP(id) {     if(!TrieKeyExists(g_tPlayers, g_szAuthId[id]))     {         if(get_user_flags(id) & ADMIN_LEVEL_B)         {             new iRandom = random_num(50, 150)             crxranks_give_user_xp(id, iRandom)             CC_SendMessage(id, "Yay! You received &x04%i XP&x01!", iRandom)             TrieSetCell(g_tPlayers, g_szAuthId[id], true)         }         else         {             CC_SendMessage(id, "You have no access to this command.")         }     }     else     {         CC_SendMessage(id, "You can only use this command once per map!")     }     return PLUGIN_HANDLED }

Taha_rajper 07-10-2022 14:20

Re: [REQ] getxp for OcixCrom xp system
 
Thank you OciXCrom


All times are GMT -4. The time now is 14:39.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.