Raised This Month: $ Target: $400
 0% 

Optimizing


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 10-06-2009 , 11:47   Optimizing
Reply With Quote #1

Oh no its xpaw here

PHP Code:
#include <amxmodx>

new g_pTimelimit;
new 
g_szMapname32 ];
new 
bool:g_bSawMotd33 ];

public 
plugin_init( ) {
    
register_plugin"MOTD System""1.0""xPaw" );
    
    if( !
file_exists"motd.txt" ) )
        
pause"ad" );
    
    
g_pTimelimit get_cvar_pointer"mp_timelimit" );
    
    
get_mapnameg_szMapname31 );
    
    
register_dictionary"timeleft.txt" );
    
    
register_messageget_user_msgid"MOTD" ), "MessageMOTD" );
}

public 
client_connectid )
    
g_bSawMotdid ] = false;

public 
MessageMOTD( const MsgId, const MsgDest, const id ) {
    if( 
g_bSawMotdid ] )
        return 
PLUGIN_CONTINUE;
    
    new 
szText128 ], szName40 ], bSet;
    
get_msg_arg_string2szText127 );
    
    if( 
containszText"%username%" ) != ) {
        
get_user_nameidszName31 );
        
replaceszText127"%username%"szName );
        
        
bSet true;
    }
    
    if( 
containszText"%servname%" ) != ) {
        
get_user_name0szName39 );
        
replaceszText127"%servname%"szName );
        
        
bSet true;
    }
    
    if( 
containszText"%currmap%" ) != ) {
        
replaceszText127"%currmap%"g_szMapname );
        
        
bSet true;
    }
    
    if( 
containszText"%timeleft%" ) != ) {
        if( 
get_pcvar_floatg_pTimelimit ) ) {
            new 
iTimeleft get_timeleft( );
            
            
formatexszName39"%d:%02d"iTimeleft 60iTimeleft 60 );
        } else
            
formatexszName39"%L"LANG_PLAYER"NO_T_LIMIT" );
        
        
replaceszText127"%timeleft%"szName );
        
        
bSet true;
    }
    
    if( 
bSet )
        
set_msg_arg_string2szText );
    
    if( 
get_msg_arg_int) == )
        
g_bSawMotdid ] = true;
    
    return 
PLUGIN_CONTINUE;

Any changes / suggestions?
__________________
xPaw is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 10-06-2009 , 12:31   Re: Optimizing
Reply With Quote #2

Shouldn't contain() not return -1 instead of 1?
__________________
hleV is offline
Old 10-06-2009, 12:31
Exolent[jNr]
This message has been deleted by Exolent[jNr]. Reason: hleV -.-
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 10-06-2009 , 12:32   Re: Optimizing
Reply With Quote #3

EDIT: Woops i just noticed what i typed 1 instead of -1. -_-
__________________
xPaw 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 22:35.


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