Description:
*
* Description: For each kill you gain experience为 points (xp).
* After reaching a certain amount of xp, you level up.
* With each level you get more HP (Healthpoints) at
* the beginning of a round. You start at level 0 with 100 HP.
*
* Level: HP:
* 0 100
* 1 120
* 2 135
* 3 145
* 4 150
*
* You will get a bonus for difficult kills:
*
* Sort of kill: XP you gain:
* 为 normal kill 10
* 为 Headshot 15
* 为 grenade kill 25
* 为 knifekill 40
*
* I think that's all you need to know and I hope you'll enjoy it.
********************************************* ********************************************* ********/
#include <amxmodx>
#include <fun>
// =============================================
new xp[33]
new level[33]
// =============================================
public event_deathmsg() // Event called when a deathmessage is displayed
{
new killer = read_data(1)
new victim = read_data(2)
new wpn[32]
read_data(4,wpn,31)
// Don't do anything if it's a suicide or TK
if ( !killer || killer==victim || get_user_team(killer)==get_user_team(victim) )
{
return PLUGIN_CONTINUE
}
// Do the following if it's a normal kill
else
{
if (killer)
{
set_hudmessage(255,255,255,0.3, 0.53, 0, 3.0, 6.0, 0.5, 0.15, 3)
// Xp Bonus
if ( equal(wpn,"knife") )
{
xp[killer] += 40
}
else if ( equal(wpn,"grenade") )
{
xp[killer] += 25
}
else if (read_data(3))
{
xp[killer] += 15
}
else
{
xp[killer] += 10
}
// End of the xp bonus
if (xp[killer] <= 49)
{
level[killer] = 0
show_hudmessage(killer," <Happyhero>: %d / 50 ^n Level: %d ^n Now you are Soldier,Health: 100" , xp[killer] , level[killer] )
}
else if ( (xp[killer] > 49) && (xp[killer] < 100) )
{
level[killer] = 1
show_hudmessage(killer," <Happyhero>: %d / 100 ^n Level: %d ^n Congratulations you promote to Monitor,Health: 120" , xp[killer] , level[killer] )
}
else if ( (xp[killer] > 99) && (xp[killer] < 150) )
{
level[killer] = 2
show_hudmessage(killer," <Happyhero>: %d / 150 ^n Level: %d ^n Congratulations you promote to Long,Health: 135" , xp[killer] , level[killer] )
}
else if ( (xp[killer] > 149) && (xp[killer] < 200) )
{
level[killer] = 3
show_hudmessage(killer," <Happyhero>: %d / 200 ^n Level: %d ^n Congratulations you promote to The company commander,Health: 145" , xp[killer] , level[killer] )
}
else if ( (xp[killer] > 199) && (xp[killer] < 250) )
{
level[killer] = 4
show_hudmessage(killer," <Happyhero>: %d / 250 ^n Level: %d ^n Congratulations you promote to The battalion commander,Health: 165" , xp[killer] , level[killer] )
}
else if ( (xp[killer] > 249) && (xp[killer] < 300) )
{
level[killer] = 5
show_hudmessage(killer," <Happyhero>: %d / 300 ^n Level: %d ^n Congratulations you promote to Colonel,Health: 195" , xp[killer] , level[killer] )
}
else if ( (xp[killer] > 299) && (xp[killer] < 350) )
{
level[killer] = 6
show_hudmessage(killer," <Happyhero>: %d / 350 ^n Level: %d ^n Congratulations you promote to Brigade major,Health: 205" , xp[killer] , level[killer] )
}
else if ( (xp[killer] > 349) && (xp[killer] < 400) )
{
level[killer] = 7
show_hudmessage(killer," <Happyhero>: %d / 400 ^n Level: %d ^n Congratulations you promote to Teachers,Health: 235" , xp[killer] , level[killer] )
}
else if ( (xp[killer] > 449) && (xp[killer] < 500) )
{
level[killer] = 8
show_hudmessage(killer," <Happyhero>: %d / 500 ^n Level: %d ^n Congratulations you promote to Captain,Health: 265" , xp[killer] , level[killer] )
}
else if (xp[killer] > 499)
{
level[killer] = 9
show_hudmessage(killer," You killed a lot,to be loved,to be the General!. ^n <Happyhero>: %d ^n 你的终极Health is: 1000" , xp[killer] )
}
}
}
return PLUGIN_CONTINUE
}
// =============================================
public eNewRound(id)
{
set_hudmessage(255,255,255,0.3, 0.53, 0, 3.0, 6.0, 0.5, 0.15, 3)
if (level[id] == 0)
{
show_hudmessage(id," <Happyhero>: %d / 50 ^n Your level为 Soldier: %d ^n Now you are Soldier,no killers,Health: 100" , xp[id] , level[id] )
set_user_health(id, 100)
}
else if (level[id] == 1)
{
show_hudmessage(id," <Happyhero>: %d / 100 ^n Your level is Monitor: %d ^n Now your Health: 120" , xp[id] , level[id] )
set_user_health(id, 120)
}
else if (level[id] == 2)
{
show_hudmessage(id," <Happyhero>: %d / 150 ^n Your level is Long: %d ^n Now your Health: 135" , xp[id] , level[id] )
set_user_health(id, 135)
}
else if (level[id] == 3)
{
show_hudmessage(id," <Happyhero>: %d / 200 ^n Your level is The company commander: %d ^n Now your Health: 145" , xp[id] , level[id] )
set_user_health(id, 145)
}
else if (level[id] == 4)
{
show_hudmessage(id," <Happyhero>: %d / 250 ^n Your level is The battalion commander: %d ^n Now your Health: 165" , xp[id] , level[id] )
set_user_health(id, 165)
}
else if (level[id] == 5)
{
show_hudmessage(id," <Happyhero>: %d / 300 ^n Your level is colonel: %d ^n Now your Health: 195" , xp[id] , level[id] )
set_user_health(id, 195)
}
else if (level[id] == 6)
{
show_hudmessage(id," <Happyhero>: %d / 350 ^n Your level is Brigade major: %d ^n Now your Health: 205" , xp[id] , level[id] )
set_user_health(id, 205)
}
else if (level[id] == 7)
{
show_hudmessage(id," <Happyhero>: %d / 400 ^n Your level is Teachers: %d ^n Now your Health: 235" , xp[id] , level[id] )
set_user_health(id, 235)
}
else if (level[id] ==
{
show_hudmessage(id," <Happyhero>: %d / 500 ^n Your level is Captain: %d ^n Now your Health: 265" , xp[id] , level[id] )
set_user_health(id, 265)
}
else if (level[id] == 9)
{
show_hudmessage(id,"Now you are <Happyhero> Commander: %d ^n You have been General,Gain the final Health 1000" , xp[id])
set_user_health(id, 1000)
}
}
// =============================================
public plugin_init()
{
register_plugin("earn_health_mod","1.0","amok ")
register_event("DeathMsg","event_deathmsg","a ")
register_event("RoundTime", "eNewRound", "bc")
}
---------------------------------------------------------------------
First of all, I download this code from a Chinese website.
I changed a little, but it also works, can be change to amxx.
The only thing make me confused is this plugin can't save database,
next time i reconnect or change the map , we must play once more.
No upgrade, no experience saved and loaded.
So, I hope some friends can help me to add some code to this .sma ,
in order to make sure we can continue last played database save and loaded.
Besides, I was wondering for a register plugin like this picture and go with this amxx, all request are in annex files. I think that's a good combining.please Check here and post to me.thanks.
So , I am a Chinese, to be your friend , and to be waiting for you!
[email protected]