AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   stats plugin (https://forums.alliedmods.net/showthread.php?t=12579)

Belsebub 04-18-2005 17:05

stats plugin
 
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  }  //----------------------------------------------------------------------------------------------

BioHazardousWaste 04-18-2005 18:06

Dude, you know strength is spelled S-T-R-E-N-G-T-H right? :lol: Dunno off hand, it looks like you have the type the same everywhere :)

Belsebub 04-19-2005 00:46

lol didnt know how it was spelled :lol:

but its fixed now

XxAvalanchexX 04-19-2005 01:53

Code:
public Event_Damage(victim, strength[33]) {
There is no second parameter passed to Event_Damage, strength[33] doesn't belong there. Same with your ResetHUD.


All times are GMT -4. The time now is 09:55.

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