Raised This Month: $32 Target: $400
 8% 

Gib Death 2.1


Post New Thread Reply   
 
Thread Tools Display Modes
Nextra
Veteran Member
Join Date: Apr 2008
Location: Germany
Old 10-25-2009 , 06:13   Re: Gib Death 1.4
Reply With Quote #11

You could use lookup tables instead of doing that huge switch statement.

PHP Code:
new gcvarmaterial[33]
enum GIBS
{
    
HGIBS 1,
    
GGIBS,
    
WGIBS,
    
MGIBS,
    
CGIBS,
    
CEGIBS,
    
COGIBS,
    
RGIBS,
    
BGIBS,
    
GAGIBS,
    
BOGIBS
}

new 
gibtypes[GIBS]

public 
plugin_precache()
{
    
gibtypes[HGIBS] = precache_model("models/hgibs.mdl")
    
gibtypes[GGIBS] = precache_model("models/glassgibs.mdl")
    
gibtypes[WGIBS] = precache_model("models/woodgibs.mdl")
    
gibtypes[MGIBS] = precache_model("models/metalplategibs.mdl")
    
gibtypes[CGIBS] = precache_model("models/cindergibs.mdl")
    
gibtypes[CEGIBS] = precache_model("models/ceilinggibs.mdl")
    
gibtypes[COGIBS] = precache_model("models/computergibs.mdl")
    
gibtypes[RGIBS] = precache_model("models/rockgibs.mdl")
    
gibtypes[BGIBS] = precache_model("models/bookgibs.mdl")
    
gibtypes[GAGIBS] = precache_model("models/garbagegibs.mdl")
    
gibtypes[BOGIBS] = precache_model("models/bonegibs.mdl")
}

new 
byte[6] = {000x010x080x020x04}

public 
gib_death(pl,Float:fOrigin[3])
{
    new 
origin[3]
    
FVecIVec(fOrigin,origin)
    
    
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
    
write_byte(TE_BREAKMODEL)
    
write_coord(origin[0])
    
write_coord(origin[1])
    
write_coord(origin[2] + 24)
    
write_coord(16)
    
write_coord(16)
    
write_coord(16)
    
write_coord(random_num(-50,50))
    
write_coord(random_num(-50,50))
    
write_coord(25)
    
write_byte(10)
    
    new 
gibvalue clamp(get_pcvar_num(gcvar),0,11)
    
    if(!
gibvalue)
    {
        new 
rand random_num(1,11)
        
        
write_short(gibtypes[GIBS:rand])
        
material[pl] = rand
    
}
    else
    {
        
write_short(gibtypes[GIBS:gibvalue])
        
material[pl] = gibvalue
    
}
    
    
write_byte(14)
    
write_byte(30)
    
    
write_byte(byte[material[pl]])
    
    
message_end()

__________________
In Flames we trust!

Last edited by Nextra; 10-30-2009 at 10:31.
Nextra is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-25-2009 , 06:33   Re: Gib Death 1.4
Reply With Quote #12

From HLSDK :

Code:
// Break Model Defines #define BREAK_TYPEMASK  0x4F #define BREAK_GLASS     0x01 #define BREAK_METAL     0x02 #define BREAK_FLESH     0x04 #define BREAK_WOOD      0x08 #define BREAK_SMOKE     0x10 #define BREAK_TRANS     0x20 #define BREAK_CONCRETE  0x40 #define BREAK_2         0x80
__________________
Arkshine is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 10-25-2009 , 08:59   Re: Gib Death 1.4
Reply With Quote #13

When I tested Nextra's way, after a few kills the game crashes and shows this message:
Code:
 
New message started when msg '23' has not been sent yet
__________________
<VeCo> is offline
alias_retaer
Member
Join Date: Jul 2009
Old 10-25-2009 , 12:42   Re: Gib Death 1.4
Reply With Quote #14

<VeCo> you won you a crab
hope to see it approve xix
//Do you understand ho I am?
alias_retaer is offline
Nextra
Veteran Member
Join Date: Apr 2008
Location: Germany
Old 10-25-2009 , 17:32   Re: Gib Death 1.4
Reply With Quote #15

There could be a problem with the byte array, I was thinking of that when writing but I'm not sure about that. But the upper part should work fine.
__________________
In Flames we trust!
Nextra is offline
zbot1600
Junior Member
Join Date: May 2009
Location: urope, Belorus, Minsk
Old 10-27-2009 , 05:22   Re: Gib Death 1.4
Reply With Quote #16

Great plugin!
mb add cvar to change gib model??
zbot1600 is offline
Send a message via ICQ to zbot1600
papyrus_kn
Senior Member
Join Date: Feb 2009
Location: Bulgaria
Old 10-27-2009 , 05:26   Re: Gib Death 1.4
Reply With Quote #17

Quote:
Originally Posted by zbot1600 View Post
mb add cvar to change gib model??
Quote:
Originally Posted by <VeCo>
CVARs:
gib_type 0/1/2/3/4/5/6/7/8/9/10/11 - select gib material
0 - random
1 - flesh
2 - glass
3 - wood
4 - metal
5 - cinder block
6 - ceiling tile
7 - computer
8 - rocks
9 - books
10 - garbage
11 - bones
__________________
papyrus_kn is offline
Send a message via Skype™ to papyrus_kn
zbot1600
Junior Member
Join Date: May 2009
Location: urope, Belorus, Minsk
Old 10-27-2009 , 08:08   Re: Gib Death 1.4
Reply With Quote #18

No, I do not mean it
In mapping is a function func_breakable for objects. it has options:

Material type - type of material.
Gib model - the path to the model (*. mdl), which will be used in the form of fragments.
zbot1600 is offline
Send a message via ICQ to zbot1600
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 10-27-2009 , 10:02   Re: Gib Death 1.4
Reply With Quote #19

Quote:
Originally Posted by Nextra View Post
There could be a problem with the byte array, I was thinking of that when writing but I'm not sure about that. But the upper part should work fine.
And now... the part of the code for the material will be as in the old version?
__________________
<VeCo> is offline
Nextra
Veteran Member
Join Date: Apr 2008
Location: Germany
Old 10-27-2009 , 10:59   Re: Gib Death 1.4
Reply With Quote #20

Try it.
__________________
In Flames we trust!
Nextra is offline
Reply



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 06:00.


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