Raised This Month: $ Target: $400
 0% 

Fatal Error 100 cannot read from file


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
ShOgIBaRiBoA
Junior Member
Join Date: Jul 2013
Old 08-22-2013 , 16:51   Re: Fatal Error 100 cannot read from file
Reply With Quote #8

Quote:
#include < amxmodx >
#include < amxmisc >

#pragma semicolon 1

new const PLUGIN[ ] = "AMXX-Cmd";
new const VERSION[ ] = "3.1" ;
new const AUTHOR[ ] = "CreePs" ;

new const URL[ ] = "www.game-serv.co.il" ;

new cmd_DATABASE[ 64 ][ 255 ];
new concmd_DATABASE[ 64 ][ 255 ];
new Total;
new filename[ 256 ];
new cvars[ 2 ];

public plugin_init( )
{
register_plugin( PLUGIN, VERSION, AUTHOR );

register_clcmd( "say", "cmdHandleSay" );
register_clcmd( "say_team", "cmdHandleSay" );

register_concmd( "amx_reloadcmds", "read_File" );

cvars[ 0 ] = register_cvar( "amxxcmd_mode", "1" );
cvars[ 1 ] = register_cvar( "amxxcmd_adminmsg", "1" );

set_task( 250.0, "Msg", _ , _ , _, "b" );

get_configsdir( filename, sizeof( filename ) - 1 );
format( filename, sizeof( filename ) - 1, "%s/AMXX-Cmd.ini", filename );

if( ! file_exists( filename ) )
{
make_File( );
}

read_File( );
}

public cmdHandleSay( client )
{
new message[ 128 ], cmd[ 33 ], arg1[ 65 ], arg2[ 64 ], arg3[ 64 ], arg4[ 64 ], edit[ 64 ], name[ 32 ];

read_argv( 1, message, sizeof( message ) - 1 );

parse( message, cmd, sizeof( cmd ) - 1, arg1, sizeof( arg1 ) - 1, arg2, sizeof( arg2 ) - 1, arg3, sizeof( arg3 ) - 1, arg4, sizeof( arg4 ) - 1 );

remove_quotes( message );

if( cmd[ 0 ] == '/' )
{
if( equali( cmd, "/link" ) || equali( cmd, "!link" ) )
{
ColorChat( client, "Download Link^x04 v%s^x01:^x04 %s", VERSION, URL );
}
else if( equali( cmd, "/credits" ) || equali( cmd, "!credits" ) )
{
ColorChat( client, "^4%s v%s^1 plugin has made by^3 %s^1.", PLUGIN, VERSION, AUTHOR );
}
}

if( get_pcvar_num( cvars[ 0 ] ) )
{
if( is_user_admin( client ) )
{
for( new i = 0; i < Total; i++ )
{
formatex( edit, sizeof( edit ) - 1, "!%s", cmd_DATABASE[ i ] );

if( containi( cmd, edit ) == 0 )
{
get_user_name( client, name, sizeof( name ) - 1 );

replace_all( concmd_DATABASE[ i ], 63, "#", " " );

if( ! arg1[ 0 ] && ! equali( cmd ,"!pass" )
|| arg1[ 0 ] == ' ' && ! equali( cmd ,"!pass" ) )
{
arg1 = "1";
}

client_cmd( client, "^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^"", concmd_DATABASE[ i ], arg1 , arg2, arg3, arg4 );

if( get_pcvar_num( cvars[ 1 ] ) )
{
ColorChat( 0, "Admin^x04 %s ^x01 has used ^x04''^x01 %s cmd^x04 ''", name, cmd_DATABASE[ i ] );
}

return PLUGIN_HANDLED;
}
}
}
}

return PLUGIN_CONTINUE;
}

public make_File( )
{
// file example
write_file( filename, "; Example how to add new cmds:^n^n" );
write_file( filename, "; CHAT_CMD_NAME=CONSOLE_CMD_NAME^n^n; Example how NOT to add new cmds:^n; CONSOLE_CMD_NAME=CHAT_CMD_NAME^n^n^n; All cmds below", 1 );

// original amxx cmds
write_file( filename, "ct=amx_transfer^nt=amx_transfer^nspec=amx_tr ansfer^nroundtime=amx_cvar#mp_roundtime^nft=a mx_cvar#mp_freezetime", 9 );
write_file( filename, "freezetime=amx_cvar#mp_freezetime^nrevive=am x_revive^nrestart=amx_cvar#sv_restart^nrr=amx _cvar#sv_restart", 14 );
write_file( filename, "gag=amx_gag^nungag=amx_ungag^nbury=amx_bury^ nunbury=amx_unbury^nrocket=amx_rocket^nkick=a mx_kick^nban=amx_ban", 18 );
write_file( filename, "slay=amx_slay^nslap=amx_slap^nmap=amx_map^ng low=amx_glow^nnoclip=amx_noclip^ngodmode=amx_ godmode^npause=amx_pause", 25 );
write_file( filename, "heal=amx_heal^nweapon=amx_weapon^nff=amx_cva r#mp_friendlyfire^npass=amx_cvar#sv_password^ ngravity=amx_cvar#sv_gravity", 32 );
write_file( filename, "aa=amx_cvar#sv_airaccelerate^nalltalk=amx_cv ar#sv_alltalk^nrs=amx_rcon#restart^namxx=amxm odmenu^nmmenu=amx_mapmenu", 37 );
write_file( filename, "kmenu=amx_kickmenu^nbmenu=amx_banmenu^nfire= amx_fire^nspeed=amx_speed^nuberslap=amx_ubers lap^nsuperslap=amx_slay2", 42 );
write_file( filename, "unammo=amx_unammo^ndrug=amx_drug^nportal=amx _teleport^nflash=amx_flash^nvotemap=amx_votem ap^nbuytime=amx_cvar#mp_buytime", 48 );
write_file( filename, "cvar=amx_cvar^nsetmoney=amx_cvar#mp_startmon ey^nsmenu=amx_slapmenu^npmenu=amx_teammenu", 54 );
}

public read_File( )
{
if( file_exists( filename ) )
{
new line[ 128 ], leftstr[ 32 ], rightstr[ 32 ];

new file;

file = fopen( filename, "rt" );

while( file && ! feof( file ) )
{
fgets( file, line, 127 ), trim( line );

if( ! line[ 0 ] || line[ 0 ] == ' ' || line[ 0 ] == ';' )
{
continue;
}

strtok( line, leftstr, sizeof( leftstr ) - 1, rightstr, sizeof( rightstr ) - 1, '=', 1);

formatex( cmd_DATABASE[ Total ], 63, leftstr );
formatex( concmd_DATABASE[ Total ], 63, rightstr );

Total++;
}
}
}

public Msg( )
{
if( get_pcvar_num( cvars[ 0 ] ) )
{
ColorChat( 0, "This server is running^4 %s^1 plugin, versoin^4 v%s^1 by^3 %s^1.", PLUGIN, VERSION, AUTHOR );
ColorChat( 0, "To download this %s versoin say^4 /link^1 in chat.", PLUGIN );
}
}

stock ColorChat(const id, const string[], {Float, Sql, Resul,_}:...)
{
new msg[191], players[32], count = 1;

static len;
len = formatex(msg, charsmax(msg), "^x04[^x01 AMXX-Cmd^x04 ]^x01 ");
vformat(msg[len], charsmax(msg) - len, string, 3);

if(id)
players[0] = id;
else
get_players(players,count,"ch");

for (new i = 0; i < count; i++)
{
if(is_user_connected(players[i]))
{
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"),_, players[i]);
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}
ShOgIBaRiBoA 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 18:49.


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