Raised This Month: $ Target: $400
 0% 

[HELP] Give XP Question


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 11-11-2011 , 19:27   [HELP] Give XP Question
Reply With Quote #1

Sup folks,

I'm creating a XP Mode and i would like to add a pcvar wich adds XP to my current XP. I would like to ask how to make the pcvar like and wich function i have to use, once i know how to add the pcvar and wich function i should use, it's easy

PHP Code:
iPlayerXP[id] += get_pcvar_num(NUM HERE
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 11-11-2011 , 19:46   Re: [HELP] Give XP Question
Reply With Quote #2

Code:
new g_pCvarAddXP public plugin_init( ) {      g_pCvarAddXP = register_cvar( "amx_addxp" , "100" ) // value } /* Use iPlayerXP[ index ] += get_pcvar_num( g_pCvarAddXP ) */
Devil259 is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 11-11-2011 , 20:55   Re: [HELP] Give XP Question
Reply With Quote #3

k thanks, but wich public function?
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Chaato
Senior Member
Join Date: Jun 2011
Location: C://Windows/Arg/MyHome
Old 11-12-2011 , 02:04   Re: [HELP] Give XP Question
Reply With Quote #4

other forms
PHP Code:


/*---------------------With "define"----------------------*/

#define EXP 100

public plugin_init()
{
    
register_pluginPluginNamePluginVersionPluginAutor )
    
    
}

iPlayerindex ] += EXP

/*-------------------------------------------------------------------*/

/*---------------------With "variable"----------------------*/


new gCvarExp;

public 
plugin_init()
{
    
register_pluginPluginNamePluginVersionPluginAutor )
    
    
gCvarExp register_cvar"amx_winexp""100" )
}

iPlayerindex ] += get_pcvar_numgCvarExp )


/*-------------------------------------------------------------------*/
/*---------------------With "number"----------------------*/

public plugin_init()
{
    
register_pluginPluginNamePluginVersionPluginAutor )
    
    
gCvarExp register_cvar"amx_winexp""100" )
}

iPlayerindex ] += 100

/*-------------------------------------------------------------------*/ 
__________________
[LaserMines] - Creador & Porcentaje de vida: Click Me
Chaato is offline
Send a message via MSN to Chaato Send a message via Skype™ to Chaato
Erox902
Veteran Member
Join Date: Jun 2009
Location: Never Never Land
Old 11-12-2011 , 07:45   Re: [HELP] Give XP Question
Reply With Quote #5

Quote:
Originally Posted by Napoleon_be View Post
k thanks, but wich public function?
That is up to you not us. We have not even seen your code, were not psychic you know :/
And you don't really need to make a function to add it, just give it like the examples show at the specific event you want to give someone it.
Erox902 is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 11-12-2011 , 11:09   Re: [HELP] Give XP Question
Reply With Quote #6

Okay, thanks everyone.

I've done it like this just with a concmd:
PHP Code:
public XPGive(iPlayerlevelcid) {
    if(!
cmd_access(iPlayerlevelcid3)) {
        return 
PLUGIN_HANDLED
    
}
    static 
arg[35]
    
read_argv(1argcharsmax(arg))
    
    new 
target cmd_target(iPlayerargCMDTARGET_NO_BOTS)
    if(!
target) {
        return 
PLUGIN_HANDLED
    
}
    
    
read_argv(2argcharsmax(arg))
    new 
XP str_to_num(arg)
    
    if(
XP <= 0) {
        
console_print(iPlayer"You need to add more XP Points!")
        if(
XP 0) {
            
console_print(iPlayer"Value must be greater than 0, else user xp_removexp")
        }
        return 
PLUGIN_HANDLED
    
}
    if(
XP 9999999) {
        
console_print(iPlayer"Value is too big to add!")
    }
    
    
iPlayerXP[target] += XP
    
    
static szName[2][32];
    
get_user_name(iPlayerszName[0], charsmax(szName[]))
    
get_user_name(targetszName[1], charsmax(szName[]))
    
    
ColorChat(0GREEN"%s^x03 %s^x01 gave^x03 %s^x04 %i^x01 XP Points!"iPrefixszName[0], szName[1], XP)
    
    static 
iSteamid[2][35]
    
get_user_authid(iPlayeriSteamid[0], charsmax(iSteamid[]))
    
get_user_authid(targetiSteamid[1], charsmax(iSteamid[]))
    
    return 
PLUGIN_HANDLED

__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Reply



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 14:27.


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