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

Solved write_bye


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
lexzor
Veteran Member
Join Date: Nov 2020
Old 04-06-2021 , 10:00   write_bye
Reply With Quote #1

hello, i have this code
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta_util>
#include <cstrike>
#include <fun>
#include <hamsandwich>


public plugin_init()
{

    
register_event("HLTV""event_new_round""a""1=0""2=0")    
    
gmsgScoreInfo get_user_msgid("ScoreInfo");
}

    
public 
event_new_round()
{    
            new 
iPlayers[MAX_PLAYERS], iNumiPlayeriName[MAX_NAME_LENGTH][MAX_PLAYERS 1]
            
            
get_players(iPlayersiNum)
            
            for (new 
0iNumi++)
            {
                
iPlayer iPlayers[i]
                
cs_set_user_deaths(iPlayeriDeaths[i])
                
fm_set_user_frags(iPlayeriFrags[i])
                
message_begin(MSG_ALL,gmsgScoreInfo)
                
write_byte(iPlayer)
                
write_short(iFrags[i])
                
write_short(iDeaths[i])
                
write_short(0)
                
write_short(cs_get_user_team(iPlayer))
                
message_end()
                
                
get_user_name(iPlayeriName[i], charsmax(iName[]))
                
client_print_color(0print_team_default"^4[ROUND START]^1 Nume: %s | Frags: %i | Deaths: %i"iName[i], iFrags[i], iDeaths[i])
            }
            
            
client_print_color(0print_team_default"%s Echipele au fost schimbate!"iTag)
        }
    }
    
    return 
PLUGIN_CONTINUE

i get both client_print correct message in chat with correct frags and deaths, but the plugin doesn t set the frags to player. do you have some ideas in resolving this ?

Last edited by lexzor; 04-09-2021 at 15:33.
lexzor is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 04-06-2021 , 12:20   Re: write_bye
Reply With Quote #2

If the timing is wrong the game will overwrite your data unless you block the original message (assuming it's possible, I'm shit at the engine).

If you hook the event with a little console print you will be notified when it is called, for who and so on. That will probably help you moving forward.
__________________
Black Rose is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 04-06-2021 , 13:21   Re: write_bye
Reply With Quote #3

We've covered it here.

https://forums.alliedmods.net/showthread.php?t=330533
__________________
DJEarthQuake is offline
LondoN
Senior Member
Join Date: Dec 2015
Location: Roman, Romania.
Old 04-06-2021 , 16:05   Re: write_bye
Reply With Quote #4

set_msg_block(get_user_msgid("ScoreInfo"), BLOCK_SET);

/* here update scoreboard */

/* then enable it again */
__________________
LondoN is offline
lexzor
Veteran Member
Join Date: Nov 2020
Old 04-06-2021 , 19:42   Re: write_bye
Reply With Quote #5

how i enable it ? sorry i didn't "played" with this msg
lexzor is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-06-2021 , 21:39   Re: write_bye
Reply With Quote #6

Then play with it:
PHP Code:
#define BLOCK_NOT                   0
#define BLOCK_ONCE                  1
#define BLOCK_SET                   2 
__________________
Bugsy is online now
lexzor
Veteran Member
Join Date: Nov 2020
Old 04-09-2021 , 15:33   Re: write_bye
Reply With Quote #7

I used london method.

PHP Code:
else
        {    
            
set_msg_block(get_user_msgid("ScoreInfo"), BLOCK_SET);
    
            new 
iPlayers[MAX_PLAYERS], iNumiPlayer            
            get_players
(iPlayersiNum)
                    
            for (new 
0iNumi++)
            {
                
iPlayer iPlayers[i]
                
cs_set_user_deaths(iPlayeriDeaths[i])
                
fm_set_user_frags(iPlayeriFrags[i])
                
message_begin(MSG_ALL,gmsgScoreInfo)
                
write_byte(iPlayer)
                
write_short(iFrags[i])
                
write_short(iDeaths[i])
                
write_short(0)
                
write_short(cs_get_user_team(iPlayer))
                
message_end()
            }
            
            
set_msg_block(get_user_msgid("ScoreInfo"), BLOCK_NOT);
            
            
client_print_color(0print_team_default"%s Echipele au fost schimbate!"iTag)
        } 
Thank you all!
lexzor 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 10:49.


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