Raised This Month: $ Target: $400
 0% 

Admin Listen Optimization


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
tcPane
Senior Member
Join Date: Sep 2010
Old 09-09-2012 , 13:06   Admin Listen Optimization
Reply With Quote #1

Hello,
can u optimize me this code?

PHP Code:

#include <amxmodx> 
#include <amxmisc> 
#include <engine> 

#define PLUGIN "Admin Listen"
#define VERSION "2.3x"

new Count[32][32], g_Voice_Status[2

public 
plugin_modules()
{
    
require_module("engine")  


public 
plugin_init()

       
register_plugin(PLUGINVERSION"/dev/ urandom"
       
       
register_event("SayText""CatchSay""b"
       
     
register_srvcmd("amx_voice""VoiceStatus")


public 
CatchSay(id

      new 
Reciever read_data(0
        new 
Sender   read_data(1)  
        new 
Message[151], Channel[151], SenderName[32

        if(
is_running("cstrike")) 
        { 
        
read_data(2Channel150
        
read_data(4Message150
        
get_user_name(SenderSenderName31
    } 
    else 
    { 
        
read_data(2Message150
    } 
    
    
Count[Sender][Reciever] = 1           

    
if(Sender == Reciever
     {       
        new 
Players[32
        new 
PlayerCount get_playersnum()  
        
get_players(PlayersPlayerCount"c"
        
          for(new 
0PlayerCounti++)  
        { 
            if(
get_user_flags(Players[i]) & ADMIN_IMMUNITY
            {      
                        if(
Count[Sender][Players[i]] != 1
                        {               
                              
message_begin(MSG_ONEget_user_msgid("SayText"), { 00}, Players[i]) 
                    
write_byte(Sender)  
                    
                    if(
is_running("cstrike")) 
                    { 
                                    
write_string(Channel
                                    
write_string(SenderName
                    }
                    
                              
write_string(Message
                              
message_end() 
                } 
            } 
            
            
Count[Sender][Players[i]] = 0
         

    } 


public 
VoiceStatus()

    
read_argv(1g_Voice_Status1
    
       new 
Players[32
       new 
PlayerCount get_playersnum() 
    
get_players(PlayersPlayerCount"c"
    
    for(new 
0PlayerCounti++) 
    { 
        if((
get_user_flags(Players[i]) & ADMIN_IMMUNITY))
        {          
            if(
equal(g_Voice_Status"0")) 
            {
                
set_speak(Players[i], 0
            }
            if(
equal(g_Voice_Status"1")) 
            {
                
set_speak(Players[i], 4
            }
        } 
    } 


public 
client_infochanged(id

       if((
get_user_flags(id) & ADMIN_IMMUNITY) && equal(g_Voice_Status"1")) set_speak(id4


public 
client_connect(id

       if((
get_user_flags(id) & ADMIN_IMMUNITY) && equal(g_Voice_Status"1")) set_speak(id4

Thank you.
tcPane is offline
 



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 08:20.


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