AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Zombie Plague Mod (https://forums.alliedmods.net/forumdisplay.php?f=126)
-   -   API Scripting Help Flare + Hert Bomb (https://forums.alliedmods.net/showthread.php?t=169050)

CHyCMyMpNk 10-08-2011 06:26

Flare + Hert Bomb
 
1 Attachment(s)
Why it dosn't work ? -

v_ , w_ model for flare & heart bomb

PHP Code:

    switch (pev(entityPEV_NADE_TYPE))
    {
        case 
NADE_TYPE_FLARE// Flare
        
{
            {
                }
                
// Light it up!
                
if(pev(entityPEV_NADE_TYPE) == NADE_TYPE_FLARE)
                    
flare_lighting(entityduration)
                    
client_print(idprint_chat"[ZP] Light Flare "

// Light it up! - dosn't work too :cry:

ps: client_print - it's for test.

artos 10-08-2011 16:54

Re: Flare + Hert Bomb
 
PHP Code:

// Light it up!
                
if(pev(entityPEV_NADE_TYPE) == NADE_TYPE_FLARE)
                    
flare_lighting(entityduration)
                    
client_print(idprint_chat"[ZP] Light Flare "

Replace with:

PHP Code:

// Light it up!
                
if(pev(entityPEV_NADE_TYPE) == NADE_TYPE_FLARE)
                {
                    
flare_lighting(entityduration)
                    
client_print(idprint_chat"[ZP] Light Flare ")
                } 


CHyCMyMpNk 10-09-2011 05:35

Re: Flare + Hert Bomb
 
artos, is not the problem ...
problem is somewhat different, but I can not understand what.

Tirant 10-09-2011 05:49

Re: Flare + Hert Bomb
 
You need to check your brackets. Look at the pawn guides in the tutorial section.

PHP Code:

    switch (pev(entityPEV_NADE_TYPE))
    {
        case 
NADE_TYPE_FLARE// Flare
        
{
            {
                }
                
// Light it up!
                
if(pev(entityPEV_NADE_TYPE) == NADE_TYPE_FLARE)
                    
flare_lighting(entityduration)
                    
client_print(idprint_chat"[ZP] Light Flare "

Change to

PHP Code:

    switch (pev(entityPEV_NADE_TYPE))
    {
        case 
NADE_TYPE_FLARE// Flare
        
{
            
// Light it up!
            
if(pev(entityPEV_NADE_TYPE) == NADE_TYPE_FLARE)
            {
                
flare_lighting(entityduration)
                
client_print(idprint_chat"[ZP] Light Flare ")
            } 


CHyCMyMpNk 10-09-2011 06:00

Re: Flare + Hert Bomb
 
ok, I do it but still not working & why in this section works?)

PHP Code:

        case NADE_TYPE_HEART// Heart
        
{
            if(
pev(entityPEV_NADE_TYPE) == NADE_TYPE_HEART)
                
antidote_explode(entity)
                
client_print(idprint_chat"[ZP] Expl Heart ")
        } 

and why models dont work ?

JoKeR LauGh 10-09-2011 07:32

Re: Flare + Hert Bomb
 
PHP Code:

first from all make a new const. new const flare_model_v[] = "models/v_heart.mdl" 

then precache
PHP Code:

public plugin_precache()
{
precache_model(flare_model_v)


then make the pev v_ and p_ model ...
PHP Code:

public EventCurWeapon(id)
{
    if(
g_hasbomb[id])
    {
        if(
get_user_weapon(id) == CSW_SMOKEGRENADE)
        {
            
set_pev(idpev_viewmodel2flare_model_v)
            
set_pev(idpev_weaponmodel2flare_model_p)
        }
    }


make sure you include fakemeta , fakemeta and hamsandwich FTW

CHyCMyMpNk 10-09-2011 07:44

Re: Flare + Hert Bomb
 
open plugin...

model should be changed here, but it dont replace -

PHP Code:

public zp_fw_core_cure_post(idattacker)
{
    
// Set custom grenade model
    
if (has_flare[id])
    {
        
cs_set_player_view_model(idCSW_SMOKEGRENADEg_model_grenade_flare_v)
        
client_print(idprint_chat"[ZP] model Flare")
    }
    if (
has_heart[id])
    {
        
cs_set_player_view_model(idCSW_SMOKEGRENADEg_model_grenade_heart_v)
        
client_print(idprint_chat"[ZP] model Flare")
    }


p_ model work fine, v_ & w_ dont.

Dolph_Ziggler 10-09-2011 08:32

Re: Flare + Hert Bomb
 
1 Attachment(s)
CHyCMyMpNk in w_model you forget to return all value to return FMRES_IGNORED and return FMRES_SUPERCEDE, here , not tested but should work ))

JoKeR LauGh 10-09-2011 08:36

Re: Flare + Hert Bomb
 
no need to create a new CurWeapon ? o.o

yokomo 10-09-2011 08:57

Re: Flare + Hert Bomb
 
**Edit**
Sorry i didn't notice your sma.

Your main problem is:
PHP Code:

// Forward Set Model
public fw_SetModel(entity, const model[])
{
    
// We don't care
    
if (strlen(model) < 8)
        return 
FMRES_IGNORED
    
    
// Narrow down our matches a bit
    
if (model[7] != 'w' || model[8] != '_')
        return 
FMRES_IGNORED
    
    
// Get damage time of grenade
    
static Float:dmgtime
    pev
(entitypev_dmgtimedmgtime)
    
    
// Grenade not yet thrown
    
if (dmgtime == 0.0)
        return 
FMRES_IGNORED
    
    
new owner pev(entitypev_owner)

    
// Grenade's owner is zombie?
    
if (zp_core_is_zombie(owner))
        return 
FMRES_IGNORED
    
    
// Smoke Grenade
    
if (model[9] == 's' && model[10] == 'm')
    {
        if (
has_flare[owner])
        {
            
// Build flare's color
            
static rgb[3]
            switch (
get_pcvar_num(cvar_grenade_flare_color))
            {
                case 
0// white
                
{
                    
rgb[0] = 255 // r
                    
rgb[1] = 255 // g
                    
rgb[2] = 255 // b
                
}
                case 
1// red
                
{
                    
rgb[0] = random_num(50,255// r
                    
rgb[1] = // g
                    
rgb[2] = // b
                
}
                case 
2// green
                
{
                    
rgb[0] = // r
                    
rgb[1] = random_num(50,255// g
                    
rgb[2] = // b
                
}
                case 
3// blue
                
{
                    
rgb[0] = // r
                    
rgb[1] = // g
                    
rgb[2] = random_num(50,255// b
                
}
                case 
4// random (all colors)
                
{
                    
rgb[0] = random_num(50,200// r
                    
rgb[1] = random_num(50,200// g
                    
rgb[2] = random_num(50,200// b
                
}
                case 
5// random (r,g,b)
                
{
                    switch (
random_num(13))
                    {
                        case 
1// red
                        
{
                            
rgb[0] = random_num(50,255// r
                            
rgb[1] = // g
                            
rgb[2] = // b
                        
}
                        case 
2// green
                        
{
                            
rgb[0] = // r
                            
rgb[1] = random_num(50,255// g
                            
rgb[2] = // b
                        
}
                        case 
3// blue
                        
{
                            
rgb[0] = // r
                            
rgb[1] = // g
                            
rgb[2] = random_num(50,255// b
                        
}
                    }
                }
            }

            
// Give it a glow
            
fm_set_rendering(entitykRenderFxGlowShellrgb[0], rgb[1], rgb[2], kRenderNormal16);
            
            
// And a colored trail
            
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
            
write_byte(TE_BEAMFOLLOW// TE id
            
write_short(entity// entity
            
write_short(g_trailSpr// sprite
            
write_byte(10// life
            
write_byte(10// width
            
write_byte(rgb[0]) // r
            
write_byte(rgb[1]) // g
            
write_byte(rgb[2]) // b
            
write_byte(200// brightness
            
message_end()
            
            
// Set grenade type on the thrown grenade entity
            
set_pev(entityPEV_NADE_TYPENADE_TYPE_FLARE)
            
            
// Set flare color on the thrown grenade entity
            
set_pev(entityPEV_FLARE_COLORrgb)

            
engfunc EngFunc_SetModelentityg_model_grenade_flare_w )
            
client_print(ownerprint_chat"[ZP] model Flare W")
            
has_flare[owner] = false
            
            
return FMRES_SUPERCEDE
        
}

        if (
has_heart[owner])
        {
            
fm_set_rendering(entitykRenderFxGlowShell2551280kRenderNormal16)
            
            
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
            
write_byte(TE_BEAMFOLLOW// TE id
            
write_short(entity// entity
            
write_short(g_trailSpr// sprite
            
write_byte(10// life
            
write_byte(10// width
            
write_byte(255// r
            
write_byte(0// g
            
write_byte(0// b
            
write_byte(200// brightness
            
message_end()
            
            
set_pev(entityPEV_NADE_TYPENADE_TYPE_HEART)
            
engfunc EngFunc_SetModelentityg_model_grenade_heart_w)
            
client_print(ownerprint_chat"[ZP] model Heart W")
            
//has_heart[owner] = false
            
            
return FMRES_SUPERCEDE
        
}
    }
    
    return 
FMRES_IGNORED




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

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