AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved TE_WORLDDECAL blood ? btw (win | linux ) (https://forums.alliedmods.net/showthread.php?t=293265)

abdobiskra 01-27-2017 11:53

TE_WORLDDECAL blood ? btw (win | linux )
 
2 Attachment(s)
Hi !
i have problem in this MSG (TE_WORLDDECAL) when i hook it in FM_EmitSound.. i get the msg in windows when i tested it but in linux i see numbers ?
PHP Code:

                new aim[3], position[3];
                
get_user_origin(entityaim3); get_user_origin(entityposition0)
                if(
get_distance(aimposition) < 50)
                {
                    
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
                    
write_byte(TE_WORLDDECAL)
                    
write_coord(aim[0])
                    
write_coord(aim[1])
                    
write_coord(aim[2])
                    
write_byte(random_num(2740))
                    
//write_byte(g_Blood_Decal_Wad[random_num(0, sizeof g_Blood_Decal_Wad -1)])
                    
message_end()
                }
                return 
FMRES_SUPERCEDE

1) in windwos
2) in linux

SpannerSpammer 01-28-2017 01:03

Re: TE_WORLDDECAL blood ? btw (win | linux )
 
It could be a corrupt decals.wad file on the Linux server OR
the Linux server precaches the WAD files in a different order from
the windows one, which will screw up the decal index order.

Try this, change ->
Code:

write_byte(random_num(27, 40))
To ->
Code:

write_byte( get_decal_index( "{247" ) )
This is the first decal in the file. If you don't see the same
decal on the Linux server, then the file is corrupt.


You shouldn't be using hardcoded values for your indexes anyway.
Use an array of the actual decal names ( {blood1 ... {blood8 etc.)
then choose a random name and use get_decal_index( ) to
lookup the proper index to plug into your code.

abdobiskra 01-28-2017 09:19

Re: TE_WORLDDECAL blood ? btw (win | linux )
 
Thx for rply how i can make random string ?

this all msg what i need :
PHP Code:

/*new g_Blood_Decal_Wad[14][] = {
    
    "{blood1", 
    "{blood2", 
    "{blood3", 
    "{blood4", 
    "{blood5", 
    "{blood6", 
    "{blood7", 
    "{blood8", 
    "{bloodhand1", 
    "{bloodhand2", 
    "{bloodhand3", 
    "{bloodhand4", 
    "{bloodhand5", 
    "{bloodhand6"
}*/ 


NiHiLaNTh 01-28-2017 10:09

Re: TE_WORLDDECAL blood ? btw (win | linux )
 
Just create an array of integers and cache decal indeces on plugin_cfg.

Code:

new g_decal_index[14]

public plugin_cfg()
{
    for (new i = 0; i < sizeof g_Blood_Decal_Wad; i++)
    {
          g_decal_index[i] = get_decal_index(g_Blood_Decal_Wad[i]) // engfunc(EngFunc_DecalIndex also works...
    }
}

...

write_byte(g_decal_index[random_num(0, sizeof g_decal_index-1)])


abdobiskra 01-28-2017 10:39

Re: TE_WORLDDECAL blood ? btw (win | linux )
 
thx gold guys
the idea has become clear now
solved.


All times are GMT -4. The time now is 20:45.

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