AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Create shield entity to block damage?! (https://forums.alliedmods.net/showthread.php?t=148007)

HoLLyWooD 01-17-2011 02:02

Create shield entity to block damage?!
 
1 Attachment(s)
Hi! That entity trying to make a shield for the player.

Is a model of the shield (attached below).

I have the server will be the VIP players. Each round they will get a shield. This panel will have 500-700 to block the loss of life and in the back until the break. Upon receipt of damage or destruction of the shield should be given a sound yet.

Who is able to help? The task will be interesting and useful for beginners who read the topic. I myself have recently started working with the objects themselves.

Here is my code to create a shield:
but it just hangs the shield on the back of the player without blocking the damage and not getting hit.
PHP Code:

public set_vip_shield(id){
    
usr_shield[id] = engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_target"));
    
set_pev(usr_shield[id], pev_classname"vip_shield")
    
set_pev(usr_shield[id], pev_movetypeMOVETYPE_FOLLOW)
    
set_pev(usr_shield[id], pev_solid1)
    
set_pev(usr_shield[id], pev_aimentid)
    
set_pev(usr_shield[id], pev_health,100)
    
set_pev(usr_shield[id], pev_rendermodekRenderNormal)
    
engfunc(EngFunc_SetModelusr_shield[id], vip_shield)


I do not know how to do that until the shield on his back, the damage got a shield.

Well the mud as a shield destroyed = (

HoLLyWooD 01-17-2011 02:50

Re: Create shield entity to block damage?!
 
Maybe this can be done using RegisterHam (Ham_TakeDamage, ..?

But i dont know how do it!?(

Flipper_SPb 01-17-2011 04:11

Re: Create shield entity to block damage?!
 
Something like that

PHP Code:


#include <hamsandwich>

public plugin_init()
{
    
RegisterHam(Ham_TakeDamage"player""fw_TakeDamage")
}


public 
fw_TakeDamage(victiminflictorattackerFloat:damagedamage_type)
{
    if(
is_user_alive(victim) && cs_get_user_vip(victim))
        return 
HAM_SUPERCEDE
    
return HAM_IGNORED



HoLLyWooD 01-17-2011 04:13

Re: Create shield entity to block damage?!
 
Thank you =)
Myself know such an option. Otherwise, do not like? Work with the loss for entity?

HoLLyWooD 01-17-2011 04:15

Re: Create shield entity to block damage?!
 
I have not used it because I want to make a zone blocking - only where the shield.


All times are GMT -4. The time now is 02:06.

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