still have problems with the resethud event and in the stats plugin it doesn't add 1 to constitution if i choose that in the menu and doesn't remove 1 pointsleft, and i replaced the hp[id] = 10 * constitution[id] thing with a switch
Code:
//----------------------------------------------------------------------------------------------
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fun>
//----------------------------------------------------------------------------------------------
// VARIABLES
new constitution[33] = 0
new pointsleft[33] = 5
//----------------------------------------------------------------------------------------------
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_event("ResetHUD", "Event_Resethud", "b")
}
//----------------------------------------------------------------------------------------------
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:%d^n",pointsleft )
len += format( szMenuBody[len], 255-len, "^n\w1. Constitution (%d)",constitution )
len += format( szMenuBody[len], 255-len, "^n\w2. Nothing" )
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] += 1
pointsleft[id] -= 1
set_task ( 0.2, "ShowMenu", id )
}
case 1:
{
set_task ( 0.2, "ShowMenu", id )
}
case 2:
{
set_task ( 0.2, "ShowMenu", id )
}
case 3:
{
set_task ( 0.2, "ShowMenu", id )
}
case 4:
{
return PLUGIN_CONTINUE
}
}
return PLUGIN_CONTINUE
}
//----------------------------------------------------------------------------------------------
public Event_Resethud(id, constitution)
{
new health = get_user_health ( id )
switch(constitution)
{
case 1:
{
set_user_health(id, health + 10)
}
case 2:
{
set_user_health(id, health + 20)
}
case 3:
{
set_user_health(id, health + 30)
}
case 4:
{
set_user_health(id, health + 40)
}
case 5:
{
set_user_health(id, health + 50)
}
}
return PLUGIN_CONTINUE
}
//----------------------------------------------------------------------------------------------