Raised This Month: $12 Target: $400
 3% 

API Scripting Help Flare + Hert Bomb


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CHyCMyMpNk
Senior Member
Join Date: Jun 2008
Location: PTZ
Old 10-08-2011 , 06:26   Flare + Hert Bomb
Reply With Quote #1

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

ps: client_print - it's for test.
Attached Files
File Type: sma Get Plugin or Get Source (zp50_grenade_flare_test2.sma - 684 views - 21.0 KB)

Last edited by CHyCMyMpNk; 10-08-2011 at 06:35.
CHyCMyMpNk is offline
Send a message via ICQ to CHyCMyMpNk
artos
Senior Member
Join Date: Mar 2010
Old 10-08-2011 , 16:54   Re: Flare + Hert Bomb
Reply With Quote #2

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 ")
                } 
__________________
artos is offline
Send a message via Skype™ to artos
CHyCMyMpNk
Senior Member
Join Date: Jun 2008
Location: PTZ
Old 10-09-2011 , 05:35   Re: Flare + Hert Bomb
Reply With Quote #3

artos, is not the problem ...
problem is somewhat different, but I can not understand what.
CHyCMyMpNk is offline
Send a message via ICQ to CHyCMyMpNk
Tirant
Veteran Member
Join Date: Jul 2008
Location: Los Angeles, California
Old 10-09-2011 , 05:49   Re: Flare + Hert Bomb
Reply With Quote #4

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 ")
            } 
__________________

PM me if you're interested in buying the Credits addition for Base Builder
Battlefield Rebirth [66% done]
Call of Duty: MW2 [100% done]
Base Builder [100% done]
Tirant is offline
CHyCMyMpNk
Senior Member
Join Date: Jun 2008
Location: PTZ
Old 10-09-2011 , 06:00   Re: Flare + Hert Bomb
Reply With Quote #5

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 ?
CHyCMyMpNk is offline
Send a message via ICQ to CHyCMyMpNk
JoKeR LauGh
Veteran Member
Join Date: May 2011
Location: Malaysia
Old 10-09-2011 , 07:32   Re: Flare + Hert Bomb
Reply With Quote #6

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
__________________
Quote:
Originally Posted by addons_zz View Post
Also, just to not read `the article`, read all you find. Read and read, for ever and ever. Never stop reading.
Why? Because there is not one single universal truth which holds the meaning for everything.

Last edited by JoKeR LauGh; 10-09-2011 at 07:38.
JoKeR LauGh is offline
CHyCMyMpNk
Senior Member
Join Date: Jun 2008
Location: PTZ
Old 10-09-2011 , 07:44   Re: Flare + Hert Bomb
Reply With Quote #7

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.
CHyCMyMpNk is offline
Send a message via ICQ to CHyCMyMpNk
Dolph_Ziggler
BANNED
Join Date: Jun 2011
Old 10-09-2011 , 08:32   Re: Flare + Hert Bomb
Reply With Quote #8

CHyCMyMpNk in w_model you forget to return all value to return FMRES_IGNORED and return FMRES_SUPERCEDE, here , not tested but should work ))
Attached Files
File Type: sma Get Plugin or Get Source (zp50_grenade_flare_test2.sma - 636 views - 21.1 KB)
Dolph_Ziggler is offline
Send a message via MSN to Dolph_Ziggler
JoKeR LauGh
Veteran Member
Join Date: May 2011
Location: Malaysia
Old 10-09-2011 , 08:36   Re: Flare + Hert Bomb
Reply With Quote #9

no need to create a new CurWeapon ? o.o
__________________
Quote:
Originally Posted by addons_zz View Post
Also, just to not read `the article`, read all you find. Read and read, for ever and ever. Never stop reading.
Why? Because there is not one single universal truth which holds the meaning for everything.
JoKeR LauGh is offline
yokomo
Surprise Ascot!
Join Date: May 2010
Location: Malaysia
Old 10-09-2011 , 08:57   Re: Flare + Hert Bomb
Reply With Quote #10

**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

__________________
Team-MMG CS1.6 Servers:
✅ MultiMod -- 103.179.44.152:27016
✅ Zombie Plague -- 103.179.44.152:27015
✅ Zombie Escape -- 103.179.44.152:27017
✅ Klassik Kombat -- 103.179.44.152:27018
✅ Boss-Battle -- 103.179.44.152:27019

Last edited by yokomo; 10-09-2011 at 09:05.
yokomo is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:27.


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