AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [SOLVED] user_kill Problem (https://forums.alliedmods.net/showthread.php?t=156822)

dFF 05-12-2011 15:17

[SOLVED] user_kill Problem
 
Error:
Code:

New message started when msg '83' has not been sent yet
Code:
PHP Code:

#include <amxmodx>
#include <cstrike>

new g_iMsgSayText

public plugin_init() 
{
    
g_iMsgSayText get_user_msgid"SayText" )
    
    
register_messageget_user_msgid"TextMsg" ), "Message_HostageText" )
}

public 
Message_HostageTextmsg_idmsg_destid )
{
    static 
szChannel64 ]
    
get_msg_arg_string2szChannelcharsmaxszChannel ) )
    
    if( 
equalszChannel"#Hostages_Not_Rescued" ) )
    {
        
SlayTeamCS_TEAM_CT"Slay!!!" )
        
        return 
PLUGIN_HANDLED
    
}
    
    return 
PLUGIN_CONTINUE
}

public 
SlayTeamCsTeams:iTeam , const szMessage[] )
{
    new 
iPlayers[32], iNumidi
    get_players
(iPlayersiNum"a")
    
    for( 
0iNumi++ )
    {
        
id iPlayers]
        if( 
cs_get_user_team(id) == iTeam )
        {
            
user_kill(id1)
            
            
ColorChat(idszMessage)
        }
    }
}

ColorChatid, const fmt[ ], any:... )
{        
    static 
szMsg192 ], MSG_TARGET
    
    szMsg
] = 0x04
    
    vformat
szMsg], charsmaxszMsg ), fmt)
    
    
MSG_TARGET id MSG_ONE_UNRELIABLE MSG_ALL
    
    message_begin
MSG_TARGETg_iMsgSayText, .player id )
    {
        
write_byteid id )
        
write_stringszMsg )
    }
    
message_end()


Tried to check If player connected and doesn't work! What is the problem ?

Tested on cs_assault ; Windows.

jimaway 05-12-2011 17:22

Re: user_kill Problem
 
not sure but

PHP Code:

message_beginMSG_TARGETg_iMsgSayText, .player id )
    {
        
write_byteid id )
        
write_stringszMsg )
    }
    
message_end() 

->
PHP Code:

message_beginMSG_TARGETg_iMsgSayText, .player id )
write_byteid id )
write_stringszMsg )
message_end() 


Exolent[jNr] 05-13-2011 01:57

Re: user_kill Problem
 
Quote:

Originally Posted by jimaway (Post 1468204)
not sure but

PHP Code:

message_beginMSG_TARGETg_iMsgSayText, .player id )
    {
        
write_byteid id )
        
write_stringszMsg )
    }
    
message_end() 

->
PHP Code:

message_beginMSG_TARGETg_iMsgSayText, .player id )
write_byteid id )
write_stringszMsg )
message_end() 


No, that doesn't matter.

The issue is that return PLUGIN_HANDLED blocks the message ending so when you show the chat message it gives that error.

Hunter-Digital 05-13-2011 02:02

Re: user_kill Problem
 
So if he removes the return it'll work ? O.o I thought if you send any message while in another message hook you get that error...

Still, you could just register_event() and filter the type there...
Code:

register_event("TextMsg", "event_HostagesNotRescued", "a", "2=#Hostages_Not_Rescued")
And in the event_HostagesNotRescued() function you just slay the CTs and print the message.

EDIT: Hmm, actually yeah, I also send a screenfade message while in textmsg in my jctf mod and no errors there... and I guess if I block it, it'll crash xD

Exolent[jNr] 05-13-2011 02:03

Re: user_kill Problem
 
Quote:

Originally Posted by Hunter-Digital (Post 1468396)
So if he removes the return it'll work ?

It's worked for me before.

dFF 05-13-2011 06:10

Re: user_kill Problem
 
Thanks guys for replies! Problem solved.


All times are GMT -4. The time now is 04:29.

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