Raised This Month: $ Target: $400
 0% 

Were to put the function?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Drak
Veteran Member
Join Date: Jul 2005
Old 06-28-2006 , 23:14   Were to put the function?
Reply With Quote #1

I wanted when you reach a certin XP, the array xp2lvl changes. I can't seem were to call the function to change it. Here's my current code.
Code:
#include <amxmodx> #include <amxmisc> #include <engine> #include <fun> #include <tsx> #define keysmoneymenu (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)   new money[33] new XP[33] new xp2lvl[33] public plugin_init() {     register_plugin("InterNetz","0.2.1","Cyborg")         register_event("DeathMsg","Event_Death","a","2!0")         register_clcmd("say","block_buy",-1)   register_menucmd(register_menuid("moneymenu"),keysmoneymenu,"pressedmoneymenu")     //register_clcmd("say /weapons","ShowMenu")     //register_clcmd("say /guns","ShowMenu")     register_clcmd("say /help","help")         register_cvar("sv_xploss","3")     register_cvar("sv_xpgain","8") } public client_putinserver(id) {     hud(id)     //money[id] = 0 // sets money to 0     XP[id] = 0     xp2lvl[id] = 500     loadxp(id)     loadmoney(id) } public client_disconnect(id) {     remove_task(id,0) // removes any tasks     savexp(id)     //savemoney(id) // saves peoples money into vault on disconnect } public Event_Death(id) {     new victim = read_data(2)     new weapon,attacker = get_user_attacker(victim,weapon) // gets attacker and victim     if(is_user_connected(victim)) // if connected victim loses moneycvar     XP[attacker] +=  get_cvar_num("sv_xpgain")     if(is_user_connected(attacker)) // if connected attacker gains money     XP[victim] -=  get_cvar_num("sv_xploss") // gets deathloss cvar } public hud(id) {     if(!is_user_connected(id)) {         return PLUGIN_HANDLED     }     if(is_user_alive(id) == 1) { // shows players money on their screen         new hud[256]         //new kills = get_user_frags(id)         //new health2 = get_user_health(id)         format(hud,255,"[InterNetz]^n^nMoney: $%i^nXP: %i/%i^n^n[Need help? Type /help]",moneyz[id],XP[id],xp2lvl[id])         set_hudmessage(10,10,255,0.02,-0.7,_,_,_,_,_,1) // R,G,B,x,y,effects,fxtime,holdtime,fadeintime,fadeouttime,channel         show_hudmessage(id,hud)     }     set_task(0.1,"hud",id) // loops (updates) every 0.1 seconds     return PLUGIN_HANDLED } // saves players money into vault on disconnect public savemoney(id) {     new authid[32], vaultstring[256]     get_user_authid(id,authid,31)         if(moneyz[id] > 0) {         new money[256]         num_to_str(moneyz[id],money,255)                 format(vaultstring,255,"%s=",authid)         set_vaultdata(vaultstring,money)     }     else {         format(vaultstring,255,"%s=",authid)         remove_vaultdata(vaultstring)     } } public savexp(id) {     new authid[32], vaultstring[256]     get_user_authid(id,authid,31)         if(XP[id] > 0) {         new xe[256]         num_to_str(XP[id],xe,255)                 format(vaultstring,255,"xp%s=",authid)         set_vaultdata(vaultstring,xe)     }     else {         format(vaultstring,255,"xp%s=",authid)         remove_vaultdata(vaultstring)     } } // loads players money by steam id on connect public loadmoney(id) {     new authid[32], vaultstring[256]     get_user_authid(id,authid,31)         format(vaultstring,255,"%s=",authid)         if(vaultdata_exists(vaultstring)) {         new money[256]         get_vaultdata(vaultstring,money,255)         moneyz[id] = str_to_num(money)     } } public loadxp(id) {     new authid[32], vaultstring[256]     get_user_authid(id,authid,31)         format(vaultstring,255,"xp%s=",authid)         if(vaultdata_exists(vaultstring)) {         new xe[256]         get_vaultdata(vaultstring,xe,255)         XP[id] = str_to_num(xe)     } } // Right here is when I don't know when to activate this function to change the xp2lvl public levelshow(id) {     if(XP[id] < 50)     {         xp2lvl[id] += 200         }     else if( (XP[id] >= 9000)     {         xp2lvl[id] += 400         }     else if( (XP[id] >= 7000)     {         xp2lvl[id] += 600         }     else if( (XP[id] >= 5000)     {         xp2lvl[id] += 800         }     else if( (XP[id] >= 3000)     {         xp2lvl[id] += 1000         }     else if( (XP[id] >= 1000)     {         xp2lvl[id] += 1200         }     else if( (XP[id] >= 700)     {         xp2lvl[id] += 1400         }     else     {         xp2lvl[id] += 1800     }     //set_task(0.2,"levelshow",id) // loops (updates) every 0.1 seconds     return PLUGIN_HANDLED }
Also I hate this new small tags, I can't get the code to line up!
__________________
Oh yeah

Last edited by Drak; 06-28-2006 at 23:17.
Drak is offline
Send a message via MSN to Drak
 


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 08:07.


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