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

[POST] Message Type


Post New Thread Reply   
 
Thread Tools Display Modes
Nextra
Veteran Member
Join Date: Apr 2008
Location: Germany
Old 02-11-2009 , 16:08   Re: [POST] Message Type
Reply With Quote #11

As I said, this is your right as the author and I absolutely won't be mad at you.

It is just a suggestion for improvement and as I'm capable of implementing these things by myself it is perfectly fine with me if you don't add them.
__________________
In Flames we trust!

Last edited by Nextra; 03-17-2009 at 15:51.
Nextra is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-12-2009 , 01:22   Re: [POST] Message Type
Reply With Quote #12

PHP Code:
public hook_say_cmdid )
{
    if ( 
get_pcvar_num gPluginOn )  == )
    {
        
client_printidprint_chat"%L"id"MESSAGE_DISABLED" );
        return 
PLUGIN_HANDLED;
    } 
This is a major error, it will completly block the chat when cvar is 0, you should either return PLUGIN_CONTINUE, either perform this check after the prefix check.

Also, you should declare :
new name [ 32 ];
new said[ 256 ];
after the prefix check, so those vars won't be created each time a player use chat.

if( !is_user_alive( id ) || get_user_team( id ) == 3 )
-> i think you don't need to check the team here, as a spectator can't be alive ;)

Also, when you send a message to every players, you don't need to loop through them, just use message_begin(MSG_BROADCAST, gMessageSayText), and all connected players will see the msg
As other members have suggested, would be an half plugin to not implement dead/alive/team messages, and IMO an antiflood is a must (and easy to do), but that's up to you to make it or not.
If you implement that, then you will have to loop trhough all players and filter them.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
tuty
Veteran Member
Join Date: Jul 2008
Location: UK
Old 02-12-2009 , 06:36   Re: [POST] Message Type
Reply With Quote #13

i will edit the plugin.. tanks for sugestions


EDIT:

Code:
     PHP Code:
     
public hook_say_cmd( id ) { if ( get_pcvar_num ( gPluginOn ) == 0 ) { client_print( id, print_chat, "%L", id, "MESSAGE_DISABLED" ); return PLUGIN_HANDLED; }
This is a major error, it will completly block the chat when cvar is 0, you should either return PLUGIN_CONTINUE, either perform this check after the prefix check. Also, you should declare : new name [ 32 ]; new said[ 256 ]; after the prefix check, so those vars won't be created each time a player use chat. if( !is_user_alive( id ) || get_user_team( id ) == 3 ) -> i think you don't need to check the team here, as a spectator can't be alive ;) Also, when you send a message to every players, you don't need to loop through them, just use message_begin(MSG_BROADCAST, gMessageSayText), and all connected players will see the msg As other members have suggested, would be an half plugin to not implement dead/alive/team messages, and IMO an antiflood is a must (and easy to do), but that's up to you to make it or not. If you implement that, then you will have to loop trhough all players and filter them.
1. with MSG_BROADCAST it show double message....
2. This is a major error, it will completly block the chat when cvar is 0, you should either return PLUGIN_CONTINUE : wrong, it only block that message with /POST prefix.... the simple message without post prefix is not blocked!
3. if( !is_user_alive( id ) || get_user_team( id ) == 3 ) : yeah but if is spec it show the money message on spec
4. Also, you should declare new name [ 32 ], new said[ 256 ]; after the prefix check, so those vars won't be created each time a player use chat. (done)

Note:
I want to show messages, but if plugin is disabled or money is not enough, i want to block that message with /POST prefix..

EX: If is plugin disabled or i dont have enough money, i want to show to player that message and block the message with /POST prefix
I dont want to show If is plugin disabled or i dont have enough money something like that
:
Code:
You dont have .. sorry...
<name>:/POST ddd
just only


Code:
You dont have .. sorry...
(and block that message)
__________________

Last edited by tuty; 02-12-2009 at 07:17.
tuty is offline
Send a message via ICQ to tuty Send a message via AIM to tuty
anakin_cstrike
Veteran Member
Join Date: Nov 2007
Location: Romania
Old 02-12-2009 , 10:30   Re: [POST] Message Type
Reply With Quote #14

You're flooding with those '^^'
__________________

anakin_cstrike is offline
tuty
Veteran Member
Join Date: Jul 2008
Location: UK
Old 02-12-2009 , 10:37   Re: [POST] Message Type
Reply With Quote #15

Quote:
Originally Posted by anakin_cstrike View Post
You're flooding with those '^^'


grrr........
__________________
tuty is offline
Send a message via ICQ to tuty Send a message via AIM to tuty
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-12-2009 , 11:57   Re: [POST] Message Type
Reply With Quote #16

Quote:
Originally Posted by tuty View Post
1. with MSG_BROADCAST it show double message....
Bacause you loop trhough all players, just send the message once, see example :
PHP Code:
       else
     {
     
/*        for(new i = 1; i <= gMaxPlayers; i++)
              {

                 if(!is_user_connected(i))
                        continue;*/
                
                 
message_begin(MSG_BROADCASTgMessageSayText);
                 
write_byte(id);
                 
write_string(Buffer);
                 
message_end();
         
//    }
        

Quote:
Originally Posted by tuty View Post
2. This is a major error, it will completly block the chat when cvar is 0, you should either return PLUGIN_CONTINUE, either perform this check after the prefix check.
: wrong, it only block that message with /POST prefix.... the simple message without post prefix is not blocked!
Because now you perform the prefix check in first, it wasn't the case previously, that's why i suggested you to perform it first ^^

Quote:
Originally Posted by tuty View Post
3. if( !is_user_alive( id ) || get_user_team( id ) == 3 ) : yeah but if is spec it show the money message on spec
Just perfom the "alive check" before the "money check" ^^
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 02-13-2009 at 00:30.
ConnorMcLeod is offline
tuty
Veteran Member
Join Date: Jul 2008
Location: UK
Old 02-12-2009 , 13:24   Re: [POST] Message Type
Reply With Quote #17

got it ... now updating.. thx
__________________
tuty is offline
Send a message via ICQ to tuty Send a message via AIM to tuty
tuty
Veteran Member
Join Date: Jul 2008
Location: UK
Old 02-13-2009 , 08:02   Re: [POST] Message Type
Reply With Quote #18

UPDATED a bit... used cstrike module ^^
__________________
tuty is offline
Send a message via ICQ to tuty Send a message via AIM to tuty
anakin_cstrike
Veteran Member
Join Date: Nov 2007
Location: Romania
Old 02-13-2009 , 10:13   Re: [POST] Message Type
Reply With Quote #19

PHP Code:
new money cs_get_user_money(id);
    if(
money get_pcvar_num(gMessageCost))
    {
        
client_print(idprint_chat"%L"id"DONT_HAVE_MONEY");
        return 
PLUGIN_HANDLED;
    }
    
color_print(0"^x01[%s]^x04 [ %s ]: [ %s ]", (get_user_team(id) == 1) ? "T" "CT" namesaid);
    
cs_set_user_money(idmoney get_pcvar_num(gMessageCost)); 
You can optimizate this creating a variable instead of geting cvar value twice.
Something lke this
PHP Code:
new cost get_pcvar_num(gMessageCost);
if(
money cost )
// ...
cs_set_user_money(idmoney cost); 
EDIT:
Quote:
if(!equal(check_prefix, "/POST", 5))
return PLUGIN_CONTINUE;
Change to 'equali' so people can write with tiny letters.

Quote:
if(get_pcvar_num(gPluginOn) == 0)
Can be
PHP Code:
if( !get_pcvar_num(gPluginOn)) 
I haven't used 'replace' function very often, but i think this should be:
PHP Code:
replace(said255"/POST """);
// ->
replace(said255check_prefix""); 
because you checked if 'check_prefiix' is equal to "/POST".

It will be better if you don't put this part:
Quote:
if(!is_user_alive(id))
{
client_print(id, print_chat, "%L", id, "NOT_ALIVE");
return PLUGIN_HANDLED;
}
PS: look what connor said
__________________


Last edited by anakin_cstrike; 02-13-2009 at 10:21.
anakin_cstrike is offline
tuty
Veteran Member
Join Date: Jul 2008
Location: UK
Old 02-13-2009 , 10:59   Re: [POST] Message Type
Reply With Quote #20

Quote:
Originally Posted by anakin_cstrike View Post
PHP Code:
new money cs_get_user_money(id);
    if(
money get_pcvar_num(gMessageCost))
    {
        
client_print(idprint_chat"%L"id"DONT_HAVE_MONEY");
        return 
PLUGIN_HANDLED;
    }
    
color_print(0"^x01[%s]^x04 [ %s ]: [ %s ]", (get_user_team(id) == 1) ? "T" "CT" namesaid);
    
cs_set_user_money(idmoney get_pcvar_num(gMessageCost)); 
You can optimizate this creating a variable instead of geting cvar value twice.
Something lke this
PHP Code:
new cost get_pcvar_num(gMessageCost);
if(
money cost )
// ...
cs_set_user_money(idmoney cost); 
EDIT:
Change to 'equali' so people can write with tiny letters.

Can be
PHP Code:
if( !get_pcvar_num(gPluginOn)) 
I haven't used 'replace' function very often, but i think this should be:
PHP Code:
replace(said255"/POST """);
// ->
replace(said255check_prefix""); 
because you checked if 'check_prefiix' is equal to "/POST".

It will be better if you don't put this part:
PS: look what connor said


Thanks for suggestions but i dont want to write a post message death players ^^.
And i dont want to use equali.. just equal ;) i want to write with big letters..
__________________
tuty is offline
Send a message via ICQ to tuty Send a message via AIM to tuty
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 03:10.


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