Raised This Month: $ Target: $400
 0% 

[SOLVED]Winmsgs problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 05-23-2011 , 07:59   [SOLVED]Winmsgs problem
Reply With Quote #1

hi,

i tried to change the winmsgs but the problem is, the msgs willbe blocked and there is nothing to see.

PHP Code:
register_message(get_user_msgid("TextMsg"), "message_textmsg")


public 
message_textmsg( const MsgId, const MsgDest, const MsgEntity )
{    
    if(!
Catch_Enable)
    {
        return 
PLUGIN_HANDLED
    
}
    static 
message[32]
    
get_msg_arg_string(2messagecharsmax(message))
    if(
equal(message"#Terrorists_Win"))
    {
        if(!
CSTS_ARE_CATCHER)
        {
            
formatex(winmsgcharsmax(message), "%L",LANG_PLAYER,"CATCHERS_WIN")
        }
        else if(
CSTS_ARE_CATCHER)
        {
            
formatex(winmsgcharsmax(message), "%L",LANG_PLAYER,"FLEERS_WIN")
        }
    }
    else if(
equal(message"#CTs_Win"))
    {
        if(
CSTS_ARE_CATCHER)
        {
            
formatex(winmsgcharsmax(message), "%L",LANG_PLAYER,"CATCHERS_WIN")
        }
        else if (!
CSTS_ARE_CATCHER)
        {
            
formatex(winmsgcharsmax(message), "%L",LANG_PLAYER,"FLEERS_WIN")
        }
    }
    else if(
equal(message,"#Target_Saved"))
    {
        
formatex(winmsgcharsmax(message), "%L",LANG_PLAYER,"FLEERS_WIN")
    }
    else if(
equal(message,"#Hostages_Not_Rescued"))
    {
        
formatex(winmsg,charsmax(message), "%L",LANG_PLAYER,"FLEERS_WIN")
    }
        
    
set_msg_arg_string(2winmsg)
    return 
PLUGIN_HANDLED

__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 05-23-2011 , 08:39   Re: Winmsgs problem
Reply With Quote #2

Don't use PLUGIN_HANDLED if you want to change the string. Returning PLUGIN_HANDLED will block the message. You don't need to return something.
__________________
Arkshine is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 05-23-2011 , 09:12   Re: Winmsgs problem
Reply With Quote #3

Quote:
Originally Posted by Arkshine View Post
Don't use PLUGIN_HANDLED if you want to change the string. Returning PLUGIN_HANDLED will block the message. You don't need to return something.


ok but what do i have to do about :
PHP Code:
Warning: Function "message_textmsg" should return a value on line 579 
i could do it without returning the function like :

PHP Code:
public message_textmsg( const MsgId, const MsgDest, const MsgEntity )
{    
    if(
Catch_Enable)
    {
        
    static 
message[32]
    static 
winmsg[32]
    
get_msg_arg_string(2messagecharsmax(message))
    if(
equal(message"#Terrorists_Win"))
    {
        if(!
CSTS_ARE_CATCHER)
        {
            
formatex(winmsgcharsmax(message), "%L",LANG_PLAYER,"CATCHERS_WIN")
        }
        else if(
CSTS_ARE_CATCHER)
        {
            
formatex(winmsgcharsmax(message), "%L",LANG_PLAYER,"FLEERS_WIN")
        }
    }
    else if(
equal(message"#CTs_Win"))
    {
        if(
CSTS_ARE_CATCHER)
        {
            
formatex(winmsgcharsmax(message), "%L",LANG_PLAYER,"CATCHERS_WIN")
        }
        else if (!
CSTS_ARE_CATCHER)
        {
            
formatex(winmsgcharsmax(message), "%L",LANG_PLAYER,"FLEERS_WIN")
        }
    }
    else if(
equal(message,"#Target_Saved"))
    {
        
formatex(winmsgcharsmax(message), "%L",LANG_PLAYER,"FLEERS_WIN")
    }
    else if(
equal(message,"#Hostages_Not_Rescued"))
    {
        
formatex(winmsg,charsmax(message), "%L",LANG_PLAYER,"FLEERS_WIN")
    }
        
    
set_msg_arg_string(2winmsg)
}  

__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
jc980
Veteran Member
Join Date: Jan 2010
Location: God is with us...
Old 05-23-2011 , 09:18   Re: Winmsgs problem
Reply With Quote #4

try return plugin_continue.

or just write continue at the end.
__________________
jc980 is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 05-23-2011 , 09:19   Re: Winmsgs problem
Reply With Quote #5

omg. im a noob =))
damn....
how could i forget to continue it
ty
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 05-23-2011 , 09:20   Re: Winmsgs problem
Reply With Quote #6

You're not posting the full code then, because that error doesn't trigger for THAT code.

That error occurs if you have another return with a value inside your function but it's not at the end.

EDIT: or yeah, you could just use PLUGIN_CONTINUE... but it's an additional useless line.
__________________
Hunter-Digital is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 05-23-2011 , 09:26   Re: Winmsgs problem
Reply With Quote #7

Quote:
Originally Posted by Hunter-Digital View Post
You're not posting the full code then, because that error doesn't trigger for THAT code.

That error occurs if you have another return with a value inside your function but it's not at the end.

EDIT: or yeah, you could just use PLUGIN_CONTINUE... but it's an additional useless line.
we dont need the full code.
if you check my first post, i check if is mode enabled and return it in function.
if you realy need the full code i can post it but the full code is not needed.
i have only this one return in function and i have no errors when i return @ the end of function.

i know its useless but there is no other way to fix this compile error.
i know just this 2 ways to fix it and i didn't saw anything else here in forum.

continue/dont return the function ( as i posted )
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 05-23-2011 , 09:27   Re: [SOLVED]Winmsgs problem
Reply With Quote #8

Like said you don't need to return a value. So, "return" alone is enough or organize your code to not have to make a return.
__________________
Arkshine is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 05-23-2011 , 09:29   Re: [SOLVED]Winmsgs problem
Reply With Quote #9

Quote:
Originally Posted by Arkshine View Post
Like said you don't need to return a value. So, "return" alone is enough or organize your code to not have to make a return.
ty. i'll do it so. its the best way
the code willbe a littlebit larger but its so easier
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
jc980
Veteran Member
Join Date: Jan 2010
Location: God is with us...
Old 05-23-2011 , 09:30   Re: [SOLVED]Winmsgs problem
Reply With Quote #10

basically i found his answer, by browsing to some smas i have, that have the same event.

Quote:
public message_textmsg()
{
static textmsg[22]
get_msg_arg_string(2, textmsg, charsmax(textmsg))

// Game restarting, reset scores and call round end to balance the teams
if (equal(textmsg, "#Game_will_restart_in"))
{
logevent_round_end()
g_score_human = 0
g_score_zombie = 0
g_zombie_die = 0
new g_kill_reset[33]
g_kill = g_kill_reset
}
else if (equal(textmsg, "#Game_Commencing"))
{
g_startcount = 1
}
// Block round end related messages
else if (equal(textmsg, "#Hostages_Not_Rescued") || equal(textmsg, "#Round_Draw") || equal(textmsg, "#Terrorists_Win") || equal(textmsg, "#CTs_Win"))
{
return PLUGIN_HANDLED;
}

return PLUGIN_CONTINUE;
}
__________________
jc980 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 05:08.


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