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

Show Info


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ƒa†es™
Senior Member
Join Date: May 2009
Location: Garena
Old 06-26-2009 , 11:41   Show Info
Reply With Quote #1

Does anyone know what happen to my Show_Info it doesn't show :

PHP Code:
client_print(idprint_chat"[AMX] Say '/menu' to display AMX Menu."
Every 20 second.

PHP Code:
#include <amxmodx>
 
#define ADMIN_LEVEL ADMIN_KICK

new bool:Admin[33]
 
public 
plugin_init() 
{
 
register_plugin("Sub-Menu","1.0","ƒa†es™")
}
 
public 
client_putinserver(id)
{
        
Admin[id] = bool:(get_user_flags(id) & ADMIN_LEVEL)
        
set_task(20.0"show_info"id)
}
 
public 
show_info(id)
{
 if( 
is_user_connected(id) && Admin[id])
      return 
PLUGIN_CONTINUE

 client_print
(idprint_chat"[AMX] Say '/menu' to display AMX Menu.")
      return 
PLUGIN_CONTINUE

__________________
ƒa†es™ is offline
stupok
Veteran Member
Join Date: Feb 2006
Old 06-26-2009 , 11:45   Re: Show Info
Reply With Quote #2

Quote:
Originally Posted by ƒa†es™ View Post
Code:
#include <amxmodx>   #define ADMIN_LEVEL ADMIN_KICK new bool:Admin[33]   public plugin_init() {  register_plugin("Sub-Menu","1.0","ƒa†es™") }   public client_putinserver(id) {         Admin[id] = bool:(get_user_flags(id) & ADMIN_LEVEL)         set_task(20.0, "show_info", id) }   public show_info(id) {
 if( is_user_connected(id) && Admin[id])
      return PLUGIN_CONTINUE
 client_print(id, print_chat, "[AMX] Say '/menu' to display AMX Menu.")       return PLUGIN_CONTINUE }
__________________
stupok is offline
zacky
Senior Member
Join Date: Mar 2008
Location: Sweden
Old 06-26-2009 , 12:01   Re: Show Info
Reply With Quote #3

Try this:
PHP Code:
#include <amxmodx>
 
#define ADMIN_LEVEL ADMIN_KICK
 
public plugin_init() 
{
    
register_plugin("Sub-Menu","1.0","ƒa†es™")
}
 
public 
client_putinserver(id)
{
    
set_task(20.0"show_info"id)
}
 
public 
show_info(id)
    if (
is_user_connected(id) && get_user_flags(id) & ADMIN_LEVEL)
        
client_print(idprint_chat"[AMX] Say '/menu' to display AMX Menu."
zacky is offline
Send a message via Skype™ to zacky
ƒa†es™
Senior Member
Join Date: May 2009
Location: Garena
Old 06-26-2009 , 12:10   Re: Show Info
Reply With Quote #4

Quote:
Originally Posted by zacky View Post
Try this:
PHP Code:
#include <amxmodx>
 
#define ADMIN_LEVEL ADMIN_KICK
 
public plugin_init() 
{
    
register_plugin("Sub-Menu","1.0","ƒa†es™")
}
 
public 
client_putinserver(id)
{
    
set_task(20.0"show_info"id)
}
 
public 
show_info(id)
    if (
is_user_connected(id) && get_user_flags(id) & ADMIN_LEVEL)
        
client_print(idprint_chat"[AMX] Say '/menu' to display AMX Menu."

can't it be this way :

PHP Code:
&& get_user_flags(id) && ADMIN_LEVEL
Rather then :

PHP Code:
&& get_user_flags(id) & ADMIN_LEVEL
__________________
ƒa†es™ is offline
zacky
Senior Member
Join Date: Mar 2008
Location: Sweden
Old 06-26-2009 , 12:16   Re: Show Info
Reply With Quote #5

No it can't.
zacky is offline
Send a message via Skype™ to zacky
stupok
Veteran Member
Join Date: Feb 2006
Old 06-26-2009 , 12:17   Re: Show Info
Reply With Quote #6

&& is a boolean operator, page 109 in the pawn manual
& is a bitwise operator, page 107 in the pawn manual

They are not the same, so they are not interchangeable.
__________________
stupok is offline
ƒa†es™
Senior Member
Join Date: May 2009
Location: Garena
Old 06-26-2009 , 15:04   Re: Show Info
Reply With Quote #7

Quote:
Originally Posted by zacky View Post
Try this:
PHP Code:
#include <amxmodx>
 
#define ADMIN_LEVEL ADMIN_KICK
 
public plugin_init() 
{
    
register_plugin("Sub-Menu","1.0","ƒa†es™")
}
 
public 
client_putinserver(id)
{
    
set_task(20.0"show_info"id)
}
 
public 
show_info(id)
    if (
is_user_connected(id) && get_user_flags(id) & ADMIN_LEVEL)
        
client_print(idprint_chat"[AMX] Say '/menu' to display AMX Menu."
This mean :

PHP Code:
if (is_user_connected(id) && get_user_flags(id) & ADMIN_LEVEL
Admin is connected ?

Or

user is connected and get user flags and admin level ?

I want to show the client_print to everyone every 20 second.
__________________
ƒa†es™ is offline
zacky
Senior Member
Join Date: Mar 2008
Location: Sweden
Old 06-26-2009 , 15:06   Re: Show Info
Reply With Quote #8

Then just change this:
PHP Code:
set_task(20.0"show_info"id
to this:
PHP Code:
set_task(20.0"show_info"id__"b"
zacky is offline
Send a message via Skype™ to zacky
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 06-26-2009 , 22:37   Re: Show Info
Reply With Quote #9

Quote:
Originally Posted by ƒa†es™ View Post
This mean :
PHP Code:
if (is_user_connected(id) && get_user_flags(id) & ADMIN_LEVEL
Admin is connected ?
Or
user is connected and get user flags and admin level ?
That means that the user is connected AND the user has ADMIN_LEVEL access

also, in your first post, you're checking if the admin is connected and the variable admin on ID... if that's true, then return (finish the function...) so it can't possibly work if you are checking if the user is connected and if he is you're just closing the function with a return


for the 20 seconds to everyone thing... it's NOT a good think to add a task every time a user connects ... image what would happen after 1000 connects...

this is a better way (not the best though)
PHP Code:
#include <amxmodx>
 
#define TIME_DELAY 20.0
#define ACCESS ADMIN_KICK
#define TEXT_SAY "[AMX] Say '/menu' to display AMX Menu."
 
new g_iMaxPlayers
 
public plugin_init() 
{
    
register_plugin("Inform admins about /menu""0.1""-")
 
    
set_task(TIME_DELAY"inform"___"b")
 
    
g_iMaxPlayers get_maxplayers()
}
 
public 
inform()
{
    for(new 
id 1id <= g_iMaxPlayersid++)
    {
        if(
is_user_connected(id) && get_user_flags(id) & ACCESS)
            
client_print(idprint_chatTEXT_SAY)
    }

or if you want all players to see that... it's much more simple:
PHP Code:
#include <amxmodx>
 
#define TIME_DELAY 20.0
#define TEXT_SAY "[AMX] Say '/menu' to display AMX Menu."
 
public plugin_init() 
{
    
register_plugin("Inform about /menu""0.1""-")
 
    
set_task(TIME_DELAY"inform"0__"b")
}
 
public 
inform()
    
client_print(0print_chatTEXT_SAY
(non-tested codes... I hope I didn't got rusty )
__________________

Last edited by Hunter-Digital; 06-28-2009 at 18:32. Reason: fixed SAY_TEXT thing ^^,
Hunter-Digital is offline
ƒa†es™
Senior Member
Join Date: May 2009
Location: Garena
Old 06-27-2009 , 04:32   Re: Show Info
Reply With Quote #10

Quote:
Originally Posted by Hunter-Digital View Post
That means that the user is connected AND the user has ADMIN_LEVEL access

also, in your first post, you're checking if the admin is connected and the variable admin on ID... if that's true, then return (finish the function...) so it can't possibly work if you are checking if the user is connected and if he is you're just closing the function with a return


for the 20 seconds to everyone thing... it's NOT a good think to add a task every time a user connects ... image what would happen after 1000 connects...

this is a better way (not the best though)
PHP Code:
#include <amxmodx>
 
#define TIME_DELAY 20.0
#define ACCESS ADMIN_KICK
#define TEXT_SAY "[AMX] Say '/menu' to display AMX Menu."
 
new g_iMaxPlayers
 
public plugin_init() 
{
    
register_plugin("Inform admins about /menu""0.1""-")
 
    
set_task(TIME_DELAY"inform"___"b")
 
    
g_iMaxPlayers get_maxplayers()
}
 
public 
inform()
{
    for(new 
id 1id <= g_iMaxPlayersid++)
    {
        if(
is_user_connected(id) && get_user_flags(id) & ACCESS)
            
client_print(idprint_chatSAY_TEXT)
    }

or if you want all players to see that... it's much more simple:
PHP Code:
#include <amxmodx>
 
#define TIME_DELAY 20.0
#define TEXT_SAY "[AMX] Say '/menu' to display AMX Menu."
 
public plugin_init() 
{
    
register_plugin("Inform about /menu""0.1""-")
 
    
set_task(TIME_DELAY"inform"0__"b")
}
 
public 
inform()
    
client_print(0print_chatSAY_TEXT
(non-tested codes... I hope I didn't got rusty )
There a mistake i think ?

PHP Code:
client_print(0print_chatSAY_TEXT
It should be :

PHP Code:
client_print(0print_chatTEXT_SAY 
?
__________________
ƒa†es™ 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:18.


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