Raised This Month: $ Target: $400
 0% 

Problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Vechta
Veteran Member
Join Date: Jun 2010
Old 08-03-2010 , 06:37   Problem
Reply With Quote #1

hey why i cant use commands like /bank or /zpstats with this code?

If i do mistake or forgot something please corrent it

plugins_init()
Code:
register_clcmd("say", "hook_say")
hook_say
Code:
public hook_say(id)
{
	// Process what he is speaking
	new chat[192]
	read_args(chat, 191)
	remove_quotes(chat)
	
	// Get his name
	new name[32]
	get_user_name(id, name, 31)

	// If he has written nothing then return
	if(equal(chat, ""))
		return PLUGIN_HANDLED
	
	// Check if he is alive
	if (is_user_alive(id))
	{
		if (!zp_get_user_zombie(id))
		{
			// He is a Human
			if (get_user_flags(id) && VIPACCES)
			{
				ColorChat(0, GREEN, "[VIP] ^x03%s^x01: ^x04%s", name, chat);
			}
		}
		
		if (zp_get_user_zombie(id))
		{
			// He is a Human
			if (get_user_flags(id) && VIPACCES)
			{
				ColorChat(0, RED, "[VIP] ^x03%s^x01: ^x04%s", name, chat);
			}
		}	
	}
	else
	{
		if (!zp_get_user_zombie(id))
		{
			// He is a Human
			if (get_user_flags(id) && VIPACCES)
			{
				ColorChat(0, GREY, "[VIP] ^x01%s^x01: ^x04%s", name, chat);
			}
		}
		
		if (zp_get_user_zombie(id))
		{
			// He is a Human
			if (get_user_flags(id) && VIPACCES)
			{
				ColorChat(0, GREY, "[VIP] ^x01%s^x01: ^x04%s", name, chat);
			}
		}
	}
	return PLUGIN_HANDLED
}
Vechta is offline
DarkGod
SourceMod DarkCrab
Join Date: Jul 2007
Location: Sweden
Old 08-03-2010 , 07:06   Re: Problem
Reply With Quote #2

return PLUGIN_HANDLED_MAIN (second case)?

It's also if(get_user_flags(id) & VIPACCESS), not &&.
__________________
DarkGod is offline
Send a message via AIM to DarkGod Send a message via MSN to DarkGod
Vechta
Veteran Member
Join Date: Jun 2010
Old 08-03-2010 , 07:19   Re: Problem
Reply With Quote #3

Quote:
Originally Posted by DarkGod View Post
return PLUGIN_HANDLED_MAIN (second case)?

It's also if(get_user_flags(id) & VIPACCESS), not &&.
fixed, but i do not think that its the bug :S

I can use commands like /rank fine but new plugins like /bank dont work
Vechta is offline
Vechta
Veteran Member
Join Date: Jun 2010
Old 08-03-2010 , 10:26   Re: Problem
Reply With Quote #4

So anyone can help me?
Vechta is offline
abdul-rehman
Veteran Member
Join Date: Jan 2010
Location: Khi, Pakistan
Old 08-03-2010 , 14:40   Re: Problem
Reply With Quote #5

Try this maybe it will work:
Code:
public hook_say(id) {     // Process what he is speaking     new chat[192]     read_args(chat, 191)     remove_quotes(chat)         // Get his name     new name[32]     get_user_name(id, name, 31)     // If he has written nothing then return     if(equal(chat, ""))         return PLUGIN_CONTINUE         // Check if he is alive     if (is_user_alive(id))     {         if (!zp_get_user_zombie(id))         {             // He is a Human             if (get_user_flags(id) && VIPACCES)             {                 ColorChat(0, GREEN, "[VIP] ^x03%s^x01: ^x04%s", name, chat);             }         }                 if (zp_get_user_zombie(id))         {             // He is a Human             if (get_user_flags(id) && VIPACCES)             {                 ColorChat(0, RED, "[VIP] ^x03%s^x01: ^x04%s", name, chat);             }         }       }     else     {         // He is a Human         if (get_user_flags(id) && VIPACCES)         {             ColorChat(0, GREY, "[VIP] ^x01%s^x01: ^x04%s", name, chat);         }     }     return PLUGIN_CONTINUE }
__________________

My Plugins For ZP

Inactive due to College and Studies
abdul-rehman is offline
Send a message via Yahoo to abdul-rehman Send a message via Skype™ to abdul-rehman
Vechta
Veteran Member
Join Date: Jun 2010
Old 08-03-2010 , 14:44   Re: Problem
Reply With Quote #6

Quote:
Originally Posted by abdul-rehman View Post
Try this maybe it will work:
Code:
public hook_say(id) {     // Process what he is speaking     new chat[192]     read_args(chat, 191)     remove_quotes(chat)         // Get his name     new name[32]     get_user_name(id, name, 31)     // If he has written nothing then return     if(equal(chat, ""))         return PLUGIN_CONTINUE         // Check if he is alive     if (is_user_alive(id))     {         if (!zp_get_user_zombie(id))         {             // He is a Human             if (get_user_flags(id) && VIPACCES)             {                 ColorChat(0, GREEN, "[VIP] ^x03%s^x01: ^x04%s", name, chat);             }         }                 if (zp_get_user_zombie(id))         {             // He is a Human             if (get_user_flags(id) && VIPACCES)             {                 ColorChat(0, RED, "[VIP] ^x03%s^x01: ^x04%s", name, chat);             }         }       }     else     {         // He is a Human         if (get_user_flags(id) && VIPACCES)         {             ColorChat(0, GREY, "[VIP] ^x01%s^x01: ^x04%s", name, chat);         }     }     return PLUGIN_CONTINUE }
Thanks, i'll test... (What did you changed xD)

PS: I looked at your Human chat code

Last edited by Vechta; 08-03-2010 at 14:47.
Vechta is offline
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 08-03-2010 , 15:17   Re: Problem
Reply With Quote #7

if (get_user_flags(id) && VIPACCES) should be if (get_user_flags(id) & VIPACCES) .
__________________
You can do anything you set your mind to, man.

Devil259 is offline
Vechta
Veteran Member
Join Date: Jun 2010
Old 08-04-2010 , 09:30   Re: Problem
Reply With Quote #8

Quote:
Originally Posted by Devil259 View Post
if (get_user_flags(id) && VIPACCES) should be if (get_user_flags(id) & VIPACCES) .
I know that, but it dont help my bug :S
Vechta is offline
aaarnas
Veteran Member
Join Date: Jun 2008
Location: Lithuania
Old 08-04-2010 , 10:08   Re: Problem
Reply With Quote #9

The most simple way of chat messages is this:
PHP Code:
public plugin_init() {
    
register_plugin("say /bank""call_function")
}

public 
call_function(id) {
        
    
// This will be called when you put in to the chat command /bank.

In previous scripts you haven't checked if player typed correct message. If you hooking say command, function will be called always, when everyone types something into chat.
__________________
My plugins:
[ZP] ZM_VIP (v2.0.0 is comming. v1.9.1 BETA is out!)

aaarnas is offline
Vechta
Veteran Member
Join Date: Jun 2010
Old 08-04-2010 , 10:14   Re: Problem
Reply With Quote #10

Quote:
Originally Posted by aaarnas View Post
The most simple way of chat messages is this:
PHP Code:
public plugin_init() {
    
register_plugin("say /bank""call_function")
}

public 
call_function(id) {
        
    
// This will be called when you put in to the chat command /bank.

In previous scripts you haven't checked if player typed correct message. If you hooking say command, function will be called always, when everyone types something into chat.
I do not understand what you mean with the first code :S

The bank is a other sub plugin not included in the chat plugin :S
Vechta 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 00:14.


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