The command you put in your race would be
es wcs_feed <userid> <health per second> <max health to regen to>
an example would be
event player_spawn
{
es wcs_feed event_var(userid) 3 150
}
This would allow the player (from the start of the round) to go stand over any body he wish and gain 3 health per second, until his health reached 150.
Try it out (note this is untested, though I can't see why it shan't work.)
Code
GeSHi (eventscripts):// copy all of this inside es_WCSfunctions.txt
block load
{
es_exists ex command wcs_feed
if (server_var(ex) = 0) then es_xregcmd wcs_feed wcs/WCSfunctions/wcs_feedbegin "wcs_feed - usage: es wcs_feed <userid> <health per second> <max health>"
repeat create feed_check "es_xdoblock wcs/WCSfunctions/foreach_players"
}
event player_death
{
es_getplayerlocation wcs_x wcs_y wcs_z event_var(userid)
es_xmath wcs_z + 64
es_createvectorstring wcs_location_t server_var(wcs_x) server_var(wcs_y) server_var(wcs_z)
es_keycreate wcs_locations server_var(wcs_location_t)
}
event round_start
{
repeat start feed_check
es_xkeygroupcreate wcs_locations
es_xkeygroupcreate wcs_feeding
}
event round_end
{
repeat stop feed_check
es_xkeygroupdelete wcs_locations
es_xkeygroupdelete wcs_feeding
}
block wcs_feedbegin
{
es_xgetargv wcs_uid 1
es_keycreate wcs_feeding server_var(wcs_uid)
es_xgetargv wcs_health 2
es_keysetvalue wcs_feeding server_var(wcs_uid) healthps server_var(wcs_health)
es_xgetargv wcs_health 3
es_keysetvalue wcs_feeding server_var(wcs_uid) maxhealth server_var(wcs_health)
}
block foreach_players
{
es_xforeachkey wcs_uid in wcs_feeding "es_xdoblock wcs/WCsfunctions/check_location"
}
block check_location
{
es_getplayerlocation wcs_x1 wcs_y1 wcs_z1 server_var(wcs_uid)
es_xforeachkey wcs_location_t in wcs_locations "es_xdoblock wcs/WCSfunctions/compare_locations"
}
block compare_locations
{
es_splitvectorstring wcs_x wcs_y wcs_z server_var(wcs_location_t)
es_xmathparse wcs_z "wcs_z1 - wcs_z"
es_xmathparse wcs_y "wcs_y1 - wcs_y"
es_xmathparse wcs_x "wcs_x1 - wcs_x"
ifx parse("wcs_x > -101 and wcs_x < 101") do
{
ifx parse("wcs_y > -101 and wcs_y < 101") do
{
ifx parse("wcs_z > -301 and wcs_z < 301") do
{
es_getplayerprop wcs_health server_var(wcs_uid) "CBasePlayer.m_iHealth"
es_keygetvalue wcs_regenerate wcs_feeding server_var(wcs_uid) healthps
es_xmathparse wcs_health "health_temp + wcs_regenerate"
es_keygetvalue wcs_tmp wcs_feeding server_var(wcs_uid) maxhealth
if (server_var(wcs_health) <= server_var(wcs_tmp)) do
{
es_setplayerprop server_var(wcs_uid) "CBasePlayer.m_iHealth" server_var(wcs_health)
}
else do
{
es_setplayerprop server_var(wcs_uid) "CBasePlayer.m_iHealth" server_var(wcs_tmp)
}
}
}
}
}
block unload
{
repeat stop feed_check
es_xkeygroupdelete wcs_locations
es_xkeygroupdelete wcs_feeding
}
an example of using this in a real code is...
Code:
"skill5_setting" "es_xset wcs_health 1|es_xset wcs_health 2|es_xset wcs_health 3|es_xset wcs_health 4"
"skill5_cmd" "es wcs_feed event_var(userid) server_var(wcs_health) 100"
"skill5_cmd" "es wcs_feed event_var(userid) server_var(wcs_health) 100"
Currently this will not support an effect, however I could make it support if this is popular I'll make it support effects...
-freddukes






Logged


United States



