Raised This Month: $ Target: $400
 0% 

stats plugin


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Belsebub
Senior Member
Join Date: Feb 2005
Location: Sweden
Old 04-18-2005 , 17:05   stats plugin
Reply With Quote #1

im working on a plugin that lets you choose 5 stat points, and different stats give different things

but the damage thing doesn't work with strength

the *100.0 for 1 strength is just for testing

Code:
//----------------------------------------------------------------------------------------------  #include <amxmodx>  #include <amxmisc>  #include <engine>  #include <fun>  //----------------------------------------------------------------------------------------------  // VARIABLES  new constitution[33]  new strength[33]  new pointsleft[33]  new msgtext  //----------------------------------------------------------------------------------------------  public plugin_init()  {     register_plugin("Stats", "1.0", "Belsebub")     register_menucmd(register_menuid("Stats Menu"), 1023, "ActionMenu")     register_clcmd("say /statsmenu", "ShowMenu", -1, "Shows The stats menu")     register_clcmd("say_team /statsmenu", "ShowMenu", -1, "Shows The stats menu")     register_event("ResetHUD", "Event_Resethud", "b")     register_event("Damage", "Event_Damage", "b", "2!0")     msgtext = get_user_msgid("StatusText")  }  //----------------------------------------------------------------------------------------------  public ShowMenu(id)  {     if (pointsleft[id] == 0) {         client_print(id, print_center, "[AMXX] You Have 0 Stat Points Left.")         return PLUGIN_CONTINUE     }     new szMenuBody[256]     new keys     new len = format( szMenuBody, 255, "Stats Menu:^nPoints Left:%i^n",pointsleft[id] )     len += format( szMenuBody[len], 255-len, "^n\w1. Constitution (%i)",constitution[id] )     len += format( szMenuBody[len], 255-len, "^n\w2. Strength (%i)", strength[id] )     len += format( szMenuBody[len], 255-len, "^n\w3. Nothing" )     len += format( szMenuBody[len], 255-len, "^n\w4. Nothing" )     len += format( szMenuBody[len], 255-len, "^n\w5. Exit" )     keys = (1<<0|1<<1|1<<2|1<<3|1<<4)     show_menu( id, keys, szMenuBody, -1 )     return PLUGIN_CONTINUE  }  //----------------------------------------------------------------------------------------------  public ActionMenu(id, key)  {     switch(key)     {         case 0:         {             constitution[id]++             pointsleft[id]--             set_user_health(id, get_user_health (id) + 10)             set_task ( 0.1, "ShowMenu", id )         }         case 1:         {             strength[id]++             pointsleft[id]--             set_task ( 0.1, "ShowMenu", id )         }         case 2:         {             set_task ( 0.1, "ShowMenu", id )         }         case 3:         {             set_task ( 0.1, "ShowMenu", id )         }         case 4:         {             return PLUGIN_CONTINUE         }     }     ShowHUD(id)     return PLUGIN_CONTINUE  }  //----------------------------------------------------------------------------------------------  public Event_Resethud(id, constitution[33])  {     switch(constitution[id])     {         case 1:         {             set_user_health(id, 110)             return PLUGIN_CONTINUE         }         case 2:         {             set_user_health(id, 120)             return PLUGIN_CONTINUE         }         case 3:         {             set_user_health(id, 130)             return PLUGIN_CONTINUE         }         case 4:         {             set_user_health(id, 140)             return PLUGIN_CONTINUE         }         case 5:         {             set_user_health(id, 150)             return PLUGIN_CONTINUE         }     }     return PLUGIN_CONTINUE  }  //----------------------------------------------------------------------------------------------  public client_connect(id)  { constitution[id] = 0 strength[id] = 0 pointsleft[id] = 5  }  //----------------------------------------------------------------------------------------------  public Event_Damage(victim, strength[33]) {     new weapon, bodypart, attacker =get_user_attacker(victim,weapon,bodypart)     new damage = read_data(2)     if (attacker == 0)     return PLUGIN_CONTINUE     if (attacker == victim && weapon == 0)     return PLUGIN_CONTINUE     switch(strength[attacker])     {         case 1:         {             damage = floatround(float(damage)* 100.0)             return PLUGIN_CONTINUE         }         case 2:         {             damage = floatround(float(damage)* 1.4)             return PLUGIN_CONTINUE         }         case 3:         {             damage = floatround(float(damage)* 1.6)             return PLUGIN_CONTINUE         }         case 4:         {             damage = floatround(float(damage)* 1.8)             return PLUGIN_CONTINUE         }         case 5:         {             damage = floatround(float(damage)* 2.0)             return PLUGIN_CONTINUE         }     }     return PLUGIN_CONTINUE  }  //----------------------------------------------------------------------------------------------  public ShowHUD(id)  {     new HUD[51]     format(HUD, 50, "Constitution: %i Strength: %i", constitution[id], strength[id])     message_begin(MSG_ONE, msgtext, {0,0,0}, id)     write_byte(0)     write_string(HUD)     message_end()     return  }  //----------------------------------------------------------------------------------------------
Belsebub is offline
 


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 09:55.


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