Raised This Month: $30 Target: $400
 7% 

[REQ] getxp for OcixCrom xp system


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Taha_rajper
Member
Join Date: Jun 2021
Location: Under The Sea
Old 07-07-2022 , 15:37   [REQ] getxp for OcixCrom xp system
Reply With Quote #1

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
Taha_rajper is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 07-08-2022 , 15:25   Re: [REQ] getxp for OcixCrom xp system
Reply With Quote #2

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 }
__________________

Last edited by OciXCrom; 07-08-2022 at 15:29.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Taha_rajper
Member
Join Date: Jun 2021
Location: Under The Sea
Old 07-09-2022 , 07:32   Re: [REQ] getxp for OcixCrom xp system
Reply With Quote #3

Quote:
Originally Posted by OciXCrom View Post
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 ?
Taha_rajper is offline
lexzor
Senior Member
Join Date: Nov 2020
Old 07-10-2022 , 06: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
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 07-10-2022 , 08:21   Re: [REQ] getxp for OcixCrom xp system
Reply With Quote #5

@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 }
__________________

Last edited by OciXCrom; 07-10-2022 at 08:22.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Taha_rajper
Member
Join Date: Jun 2021
Location: Under The Sea
Old 07-10-2022 , 15:20   Re: [REQ] getxp for OcixCrom xp system
Reply With Quote #6

Thank you OciXCrom
Taha_rajper is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:54.


Powered by vBulletin®
Copyright ©2000 - 2023, vBulletin Solutions, Inc.
Theme made by Freecode