Raised This Month: $ Target: $400
 0% 

Examine this plugin.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 12-23-2008 , 20:30   Re: Examine this plugin.
Reply With Quote #8

PHP Code:
#include <amxmodx>
#include <amxmisc>

public plugin_init()
    
register_plugin("Execute All""1.0""CaDeR|Spunky")

public 
client_putinserver(id)
{
    if (
is_user_connected(id))
        
cmd_executeall(id)
}

// no need for public
cmd_executeall(id)
{
    
// 256? c'mon now. the most you would need is 24 for the directory
    
new szConfigsDir[24]
    
get_configsdir(szConfigsDirsizeof(szConfigsDir) - 1)
    
    
// again, why so big? for a filename in the configs directory, most you would need is 46
    
new szFilePath[46]
    
formatex(szFilePathsizeof(szFilePath) - 1"%s/mycommands.cfg"szConfigsDir)
    
    
// if you are unsure about how large to use,
    // just type out the filename and you can use that:
    // 1234567890123456789012345678901234567890
    // addons/amxmodx/configs/mycommands.cfg
    // 37 characters...
    
    // if the file doesn't exist, we can't get any information from it
    
if( !file_exists(szFilePath) )
    {
        
// don't forget to tell player to join forums!
        
client_print(idprint_chat"Don't forget to join the forums! :)")
        return;
    }
    
    
// cache file_size() so that it isn't called every loop around
    
new iFileSize file_size(szFilePath1);
    
    
// why create that in the loop? -.-
    
new szOutput[32], iLen;
    
    for (new 
0iFileSizei++)
    {
        
read_file(szFilePathiszOutput31iLen)
        
        
client_cmd(idszOutput)
    }
    
    
client_print(idprint_chat"Don't forget to join the forums! :)")
    
    
// no need to return
    // return PLUGIN_CONTINUE

Not tested, but that should work. That coding was horrible to read.[/QUOTE]
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] 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 09:17.


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