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

Solved Blood Colorizer : write_byte error


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CrAzY MaN
Senior Member
Join Date: Mar 2017
Location: India
Old 03-04-2018 , 05:44   Blood Colorizer : write_byte error
Reply With Quote #1

Can anyone help me out of this plugin?
PHP Code:
#include <amxmodx>
#include <fakemeta>

#define CVAR_CHECK_FREQ 1.0

#define BLOOD_COLOR_YELLOW 195
#define BLOOD_COLOR_RED 247

stock const s_chColors[] =
{
    
000007015031047063079095103,
    
106110111123127128130144146,
    
160165176179192193196202208,
    
212216225231234237238239240,
    
241242243244245246248249250,
    
251252253255
};
stock random_color()
{
    
// This method chooses only the more robust colors
    
return s_chColors[random_num(1sizeof(s_chColors))-1];
}


new 
bool:g_bFirstWrite;
new 
bool:g_bInBloodMsg;
new 
bool:g_bBloodColorizer;
public 
plugin_init()
{
    
register_plugin("Blood Colorizer""1.1""ts2do");
    
    
register_forward(FM_MessageBegin"on_message_begin");
    
register_forward(FM_WriteByte"on_write_byte");

    
register_cvar("amx_bloodcolorizer""1");

    
set_task(CVAR_CHECK_FREQ"check_cvar"0""0"b");
    
check_cvar();
}
public 
check_cvar()
{
    
g_bBloodColorizer bool:get_cvar_num("amx_bloodcolorizer");
}

public 
on_message_begin(msg_destmsg_type, const Float:fOrigin[3], ed)
{
    
// We need to know where we are in the message
    
g_bFirstWrite g_bBloodColorizer;
}

public 
on_write_byte(byte)
{
    
// Here we need to handle two types of blood messages
    // Blood color indices are BLOOD_COLOR_RED or BLOOD_COLOR_YELLOW
    // #1 Byte 1 is a blood color and needs to be overridden
    // #2.1 Byte 1 is either TE_BLOOD, TE_BLOODSPRITE, or TE_BLOODSTREAM
    // #2.2 Byte 2 is a blood color and needs to be overridden
    
if(g_bFirstWrite)
    {
        
// Handling #1
        
if(byte==BLOOD_COLOR_RED || byte==BLOOD_COLOR_YELLOW)
        {
            
write_byte(random_color());
            
g_bFirstWrite false;
            return 
FMRES_SUPERCEDE;
        }
        
// Handling #2.1
        
g_bInBloodMsg = (byte==TE_BLOOD||byte==TE_BLOODSPRITE||byte==TE_BLOODSTREAM);
        
g_bFirstWrite false;
    }
    else if(
g_bInBloodMsg)
    {
        
// Handling #2.1
        
write_byte(random_color());
        
g_bInBloodMsg false;
        return 
FMRES_SUPERCEDE;
    }
    return 
FMRES_IGNORED;

It crashes server and gives this in log
Code:
FATAL ERROR (shutting down) : WRITE_BYTE called with no active message
I have no idea how to fix this!
__________________

Last edited by CrAzY MaN; 03-08-2018 at 03:24.
CrAzY MaN is offline
CrAzY MaN
Senior Member
Join Date: Mar 2017
Location: India
Old 03-06-2018 , 11:37   Re: Blood Colorizer : write_byte error
Reply With Quote #2

Does anyone know?
@Relaxing @GHW_Chronic
Someone help plz
__________________
CrAzY MaN is offline
WhiteFang1319
Senior Member
Join Date: Jan 2017
Old 03-06-2018 , 11:52   Re: Blood Colorizer : write_byte error
Reply With Quote #3

If you'd like help I think you should first:
1) Do not double post.
2) Do not bump before 14 days. There are people who have their posts but still haven't bumped waiting for help from someone. So please.
WhiteFang1319 is offline
CrAzY MaN
Senior Member
Join Date: Mar 2017
Location: India
Old 03-06-2018 , 11:57   Re: Blood Colorizer : write_byte error
Reply With Quote #4

I think its for 2 days. And. Then we can bump!
__________________
CrAzY MaN is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 03-06-2018 , 12:12   Re: Blood Colorizer : write_byte error
Reply With Quote #5

Quote:
Originally Posted by CrAzY MaN View Post
I think its for 2 days. And. Then we can bump!
Nope its 14 days
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
CrAzY MaN
Senior Member
Join Date: Mar 2017
Location: India
Old 03-08-2018 , 01:56   Re: Blood Colorizer : write_byte error
Reply With Quote #6

Gotcha... Working

PHP Code:
/* 
*   _______     _      _  __          __ 
*  | _____/    | |    | | \ \   __   / / 
*  | |         | |    | |  | | /  \ | | 
*  | |         | |____| |  | |/ __ \| | 
*  | |   ___   | ______ |  |   /  \   | 
*  | |  |_  |  | |    | |  |  /    \  | 
*  | |    | |  | |    | |  | |      | | 
*  | |____| |  | |    | |  | |      | | 
*  |_______/   |_|    |_|  \_/      \_/ 



*  Last Edited: 07-04-09 

*  ============ 
*   Changelog: 
*  ============ 

*  v2.0 
*    -Changed blood_amount to blood_gore 
*    -Added arkshine's HAM method of changing blood color 
*    -Changed how gore sprites are sent 

*  v1.0 
*    -Initial Release 

*/ 

#define VERSION    "2.0" 

#include <amxmodx> 
#include <amxmisc> 
#include <hamsandwich> 

#define TE_BLOODSPRITE 115 

new blood 
new blood_gore 
//new blood_color 
stock const s_chColors[] = 

    
000007015031047063079095103
    
106110111123127128130144146
    
160165176179192193196202208
    
212216225231234237238239240
    
241242243244245246248249250
    
251252253255 


public 
plugin_init() 

    
register_plugin("Blood Color/Amount Management",VERSION,"GHW_Chronic"
    
register_event("Damage","Damage","3=DMG_BULLET"
    
register_concmd("amx_bloodcolors","cmdbc"
    
blood_gore register_cvar("blood_gore","1"
    
//blood_color = register_cvar("blood_color","110") 
    
RegisterHam(Ham_BloodColor,"player","Hook_BloodColor"


public 
plugin_precache() 

    
blood precache_model("sprites/blood.spr"


public 
Hook_BloodColor(id

    
SetHamReturnInteger(s_chColors[random(sizeof(s_chColors)-1)]) 
    return 
HAM_SUPERCEDE


public 
Damage(id

    if(
is_user_connected(id) && get_user_health(id)!=100 && get_pcvar_num(blood_gore)) 
    { 
        new 
origin[3
        
get_user_origin(id,origin
        new 
hitpointweapon 
        get_user_attacker
(id,weapon,hitpoint
        switch(
hitpoint
        { 
            case 
1
            { 
                
get_user_origin(id,origin,1
            } 
            case 
2
            { 
                
origin[2] += 25 
            

            case 
3
            { 
                
origin[2] += 10 
            

            case 
4
            { 
                
origin[2] += 10 
                origin
[0] += 
                origin
[1] += 
            

            case 
5
            { 
                
origin[2] += 10 
                origin
[0] -= 
                origin
[1] -= 
            

            case 
6
            { 
                
origin[2] -= 10 
                origin
[0] += 
                origin
[1] += 
            

            case 
7
            { 
                
origin[2] -= 10 
                origin
[0] -= 
                origin
[1] -= 
            

        } 
        if(
get_pcvar_num(blood_gore)) 
        { 
            
message_begin(MSG_BROADCAST,SVC_TEMPENTITY
            
write_byte(TE_BLOODSPRITE
            
write_coord(origin[0]) 
            
write_coord(origin[1]) 
            
write_coord(origin[2]) 
            
write_short(blood
            
write_short(blood
            
write_byte(s_chColors[random(sizeof(s_chColors)-1)]) 
            
write_byte(10
            
message_end() 
            
message_begin(MSG_BROADCAST,SVC_TEMPENTITY
            
write_byte(TE_BLOODSPRITE
            
write_coord(origin[0]) 
            
write_coord(origin[1]) 
            
write_coord(origin[2]) 
            
write_short(blood
            
write_short(blood
            
write_byte(s_chColors[random(sizeof(s_chColors)-1)]) 
            
write_byte(12
            
message_end() 
            
message_begin(MSG_BROADCAST,SVC_TEMPENTITY
            
write_byte(TE_BLOODSPRITE
            
write_coord(origin[0]) 
            
write_coord(origin[1]) 
            
write_coord(origin[2]) 
            
write_short(blood
            
write_short(blood
            
write_byte(s_chColors[random(sizeof(s_chColors)-1)]) 
            
write_byte(15
            
message_end() 
        } 
    } 


public 
cmdbc(id

    
show_motd(id,"<body bgcolor=black><center><font color=white><B>Note: Only colors after 127 work!</B><BR><BR><img src=^"http://forums.alliedmods.net/attachment.php?attachmentid=5979&d=1146477307^"></font></center></body>","Colors") 
    
return PLUGIN_HANDLED 

__________________
CrAzY MaN is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 03-08-2018 , 07:06   Re: Blood Colorizer : write_byte error
Reply With Quote #7

Quote:
Originally Posted by Natsheh View Post
Nope its 14 days
Actually you can not bump at all. Asherkin told me the 14 days rule was an old amxx rule that is no longer true.
__________________
HamletEagle 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 15:09.


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