Raised This Month: $ Target: $400
 0% 

Skills For Xp Based Mod


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
purple_pixie
Veteran Member
Join Date: Jun 2007
Location: Winchester, England
Old 09-20-2007 , 08:46   Re: Skills For Xp Based Mod
Reply With Quote #2

Don't ask for PM's / emails, the forum isn't just so you get help.
If someone else found your thread, looking for exactly the same answers, they want to see the answers, not "I've send you a PM of exactly what you need to know" :-D

Step one is to work out when the skills are required.

e.g. HP/Armour - on spawn
regen - starts on spawn, should get called every few seconds.
speed - changes whenever weapon changes.

I'll show you the examples you posted:
Code:
#include <amxmodx> #include <amxmisc> #include <fun> #include <cstrike> // we include fun and cstrike, because it has useful functions // like setting a user's health and armour respectively #define TASK_REGEN 999 // this is sort of like a variable, only it is constant. // we use it to identify the "regen" task (tasks need an id) new curweapon[33] ; // stores the current weapon for each player // to check if they have changed it. public plugin_init() {     register_plugin("XP Plugin", "1.0", "Me")     register_event("ResetHUD","on_spawn","be")     // this is called on spawn, and a few other places     // "b" means "only hook if this is sent to just one player"     // "e" means "only if the player is alive"         register_clcmd("fullupdate","on_fullupdate")     // this *should* also call ResetHUD,     // we hook it so that it doesn't.         register_event("CurWeapon","on_weaponevent","be")     // hook the "weapon" event.     // this is called on shooting, and on change weapon } public on_fullupdate(id) {     return PLUGIN_HANDLED ; } public on_spawn(id) {     // give the user 50 extra health     set_user_health(id,150)         // and 100 points of armour + a helmet     cs_set_user_armor(id,100,CS_ARMOR_VESTHELM)         // and reduce their gravity to half     set_user_gravity(id,0.5)         // and in 5 seconds, call the on_regen function     set_task(5.0,"on_regen",TASK_REGEN+id) } public on_weaponevent(id) {     new dummy ;     // a "dummy" variable - we don't care what happens to it, we just need one to call the next function     new tempweapon = get_user_weapon(id,dummy,dummy)     // get their current weapon     if ( tempweapon != curweapon[id] )     {         // if they have changed weapon         curweapon[id] = tempweapon         // store their new weapon                 set_user_maxspeed(id,(get_user_maxspeed(id)*1.5))         // and give them a 50% speed increase.     } } public on_regen(id) {     // here, we take away the constant part of the task's id ( 999 )     // and are left with just the player id     // (the task id is 999 + player's id )     if ( id > TASK_REGEN )         id -= TASK_REGEN ;     // don't regen dead people !     if ( !is_user_alive(id) )         return ;         // give user 5 hp     set_user_health(id,get_user_health(id)+5)         // and do it again in 5 seconds     set_task(5.0,"on_regen",TASK_REGEN+id) }
Also, check out the Scripting Tutorials for the XP Mod tutorial.

Last edited by purple_pixie; 09-20-2007 at 08:50.
purple_pixie is offline
 



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 16:04.


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