AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Healing Totem (https://forums.alliedmods.net/showthread.php?t=99502)

Vertricus 08-06-2009 06:26

Healing Totem
 
This is standard piece of code of healing totem which is in polish version of diablomod.
Quote:

public Effect_Healing_Totem_Think(ent)
{
new id = pev(ent,pev_owner)
new totem_dist = 300
new amount_healed = player_b_heal[id]

//We have emitted beam. Apply effect (this is delayed)
if (pev(ent,pev_euser2) == 1)
{
new Float:forigin[3], origin[3]
pev(ent,pev_origin,forigin)
FVecIVec(forigin,origin)

//Find people near and damage them
new entlist[513]
new numfound = find_sphere_class(0,"player",totem_dist+0.0,e ntlis t,512,forigin)

for (new i=0; i < numfound; i++)
{
new pid = entlist[i]

if (get_user_team(pid) != get_user_team(id))
continue


if (is_user_alive(pid) && get_user_health(pid) + amount_healed < race_heal[player_class[pid]]+player_strength[pid]*2)
set_user_health(pid,get_user_health(pid)+amou nt_he aled)
else
set_user_health(pid,race_heal[player_class[pid]]+player_strength[pid]*2)
}


set_pev(ent,pev_euser2,0)
set_pev(ent,pev_nextthink, halflife_time() + 1.5)

return PLUGIN_CONTINUE
}


//Entity should be destroyed because livetime is over
if (pev(ent,pev_ltime) < halflife_time() || !is_user_alive(id))
{
remove_entity(ent)
return PLUGIN_CONTINUE
}



//If this object is almost dead, apply some render to make it fade out
if (pev(ent,pev_ltime)-2.0 < halflife_time())
set_rendering ( ent, kRenderFxNone, 255,255,255, kRenderTransAlpha, 100 )



new Float:forigin[3], origin[3]
pev(ent,pev_origin,forigin)
FVecIVec(forigin,origin)



//Find people near and give them health
message_begin( MSG_BROADCAST, SVC_TEMPENTITY, origin );
write_byte( TE_BEAMCYLINDER );
write_coord( origin[0] );
write_coord( origin[1] );
write_coord( origin[2] );
write_coord( origin[0] );
write_coord( origin[1] + totem_dist );
write_coord( origin[2] + totem_dist );
write_short( sprite_white );
write_byte( 0 ); // startframe
write_byte( 0 ); // framerate
write_byte( 10 ); // life
write_byte( 10 ); // width
write_byte( 255 ); // noise
write_byte( 255 ); // r, g, b
write_byte( 100 ); // r, g, b
write_byte( 100 ); // r, g, b
write_byte( 128 ); // brightness
write_byte( 5 ); // speed
message_end();

//Time till we apply totems effect

set_pev(ent,pev_euser2,1)
set_pev(ent,pev_nextthink, halflife_time() + 0.5)


return PLUGIN_CONTINUE

}

I'm trying to edit this totem.
I don't want that it's heal player's which has player_item_id[id] != 17.
Quote:

if (is_user_alive(pid) && player_item_id[id] != 17 && get_user_health(pid) + amount_healed < race_heal[player_class[pid]]+player_strength[pid]*2)
set_user_health(pid,get_user_health(pid)+amou nt_he aled)
else
set_user_health(pid,race_heal[player_class[pid]]+player_strength[pid]*2)
}
I add it here but I know that id=id of owner the totem.
Can someone help me and say what I must write
Quote:

&& player_item_id[id] != 17
there?:D

Arkshine 08-06-2009 06:33

Re: Healing Totem
 
Quote:

there?
Why don't you test yourself for such little modification ? The code seems right though.

Vertricus 08-06-2009 06:40

Re: Healing Totem
 
:) I test it! =]
But it's doesn't work, cause id = id player which is owner of totem. But this player can't have item with id = 17, because he have item with different id which let him to have totem.


All times are GMT -4. The time now is 18:29.

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