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(szConfigsDir, sizeof(szConfigsDir) - 1)
// again, why so big? for a filename in the configs directory, most you would need is 46
new szFilePath[46]
formatex(szFilePath, sizeof(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(id, print_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(szFilePath, 1);
// why create that in the loop? -.-
new szOutput[32], iLen;
for (new i = 0; i < iFileSize; i++)
{
read_file(szFilePath, i, szOutput, 31, iLen)
client_cmd(id, szOutput)
}
client_print(id, print_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]
__________________