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

Is This Well Done?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
#8 SickneSS
BANNED
Join Date: Sep 2008
Location: Here
Old 05-26-2010 , 10:21   Is This Well Done?
Reply With Quote #1

Doesn't works for me
PHP Code:
//Global
new pFreezetime;

//Init 
    
pFreezetime get_cvar_pointer("mp_freezetime");
    
    
register_clcmd("say","hookSay");

public 
hookSay(id) {

      if(
get_pcvar_float(pFreezetime) <= 0)
      {
             
client_print(id,print_chat,"Chat is blocked");
             return 
PLUGIN_HANDLED;
      }
      else
             return 
PLUGIN_CONTINUE;

      return 
PLUGIN_HANDLED;

#8 SickneSS is offline
Send a message via MSN to #8 SickneSS Send a message via Skype™ to #8 SickneSS
Xellath
Veteran Member
Join Date: Dec 2007
Location: Sweden
Old 05-26-2010 , 10:32   Re: Is This Well Done?
Reply With Quote #2

What is mp_freezetime set to?
__________________
Achievements API - a simple way for you to create your OWN custom achievements!
Xellath is offline
#8 SickneSS
BANNED
Join Date: Sep 2008
Location: Here
Old 05-26-2010 , 11:08   Re: Is This Well Done?
Reply With Quote #3

Quote:
Originally Posted by Xellath View Post
What is mp_freezetime set to?
if mp_freezetime are more than 0,players can chat,if not,block the chat.
#8 SickneSS is offline
Send a message via MSN to #8 SickneSS Send a message via Skype™ to #8 SickneSS
Mxnn
Veteran Member
Join Date: Aug 2009
Location: AT MY HOME
Old 05-26-2010 , 12:07   Re: Is This Well Done?
Reply With Quote #4

You are hooking say with the last PLUGIN_HANDLED


Try this
PHP Code:
public hooksay(id) {
if (
get_pcvar_float(pFreezeTime) <= 0) {
            
client_print(idprint_chat"Chat is blocked")
            return 
PLUGIN_HANDLED
}

return 
PLUGIN_CONTINUE

Mxnn is offline
Brreaker
Senior Member
Join Date: Oct 2009
Location: Constanta, Romania
Old 05-26-2010 , 12:10   Re: Is This Well Done?
Reply With Quote #5

Wrong. <= it's not greater or equal, it's the exact opposite...
This would be correct:

PHP Code:
public hooksay(id) {
if (
get_pcvar_float(pFreezeTime) > 0.0) {
            
client_print(idprint_chat"Chat is blocked")
            return 
PLUGIN_HANDLED
}

return 
PLUGIN_CONTINUE

__________________
There are 10 kinds of people.Those who understand binary, and those who don't.
Also, for those who understand binary, there is a donation tab too!
No steam || PM support!
Brreaker is offline
Send a message via MSN to Brreaker Send a message via Yahoo to Brreaker
#8 SickneSS
BANNED
Join Date: Sep 2008
Location: Here
Old 05-26-2010 , 12:13   Re: Is This Well Done?
Reply With Quote #6

I'll try,thanks
#8 SickneSS is offline
Send a message via MSN to #8 SickneSS Send a message via Skype™ to #8 SickneSS
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 05-26-2010 , 12:25   Re: Is This Well Done?
Reply With Quote #7

Brreaker you are wrong. He said he wants it to allow chat if mp_freezetime is "more than 0". Your code will do the exact opposite.

#8 SickneSS: the code from your first post works fine.
__________________
Impossible is Nothing
Sylwester is offline
Brreaker
Senior Member
Join Date: Oct 2009
Location: Constanta, Romania
Old 05-26-2010 , 12:30   Re: Is This Well Done?
Reply With Quote #8

Sorry, I misunderstood
Why don't you just use:
PHP Code:
if(!get_pcvar_float(pFreezeTime)) // if the value is 0
    
return PLUGIN_HANDLED;
else 
// else if is greater than 0, allow chat.
    
return PLUGIN_CONTINUE
__________________
There are 10 kinds of people.Those who understand binary, and those who don't.
Also, for those who understand binary, there is a donation tab too!
No steam || PM support!

Last edited by Brreaker; 05-26-2010 at 12:40.
Brreaker is offline
Send a message via MSN to Brreaker Send a message via Yahoo to Brreaker
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 05-26-2010 , 12:40   Re: Is This Well Done?
Reply With Quote #9

It's not freezetime < 0, but freezetime <= 0 (with "mp_freezetime 0" it will return true).
__________________
Impossible is Nothing
Sylwester is offline
unnyquee
Senior Member
Join Date: Jun 2009
Location: Constanta, Romania
Old 05-26-2010 , 12:44   Re: Is This Well Done?
Reply With Quote #10

PHP Code:
#include <amxmodx>

new g_pFreezeTime;


public 
plugin_init()
{
      
register_plugin("O""M""G");

      
g_pFreezeTime get_cvar_pointer("mp_freezetime");

      
register_clcmd("say""ClientCommand_Say");
}

public 
ClientCommand_Say(iClient)
{
      if(
get_pcvar_num(g_cFreezeTime) <= 0)
      {
            
client_print(iClientprint_chat"* Chat is blocked!");

            return 
PLUGIN_HANDLED;
      }

      return 
PLUGIN_CONTINUE;

Not tested, though.

When do you want to block the chat?
After the freezetime passes or if the 'mp_freezetime' cvar value is lower / equal to 0?
__________________
unnyquee 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 20:43.


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