#include <amxmodx>
#include <amxmisc>
#include <engine>
new CLIENT_HAPPY_MSG[] = "[AMXX] Egy admin hozzaadott a felhasznalokhoz, mostmar tudod hasznalni az AWP-t!."
new CLIENT_SAD_MSG[] = "[AMXX] Sajnalom, ezt csak egyes felhasznalok hasznalhatjak! Tovabbi infoert fordulj egy adminhoz!"
new bool:Awp_User[33]
new g_ConfigDir[64]
new g_File[64]
new PLUGIN_NAME[] = "Awp"
new PLUGIN_AUTHOR[] = "Cheap_Suit"
new PLUGIN_VERSION[] = "1.1"
public plugin_init()
{
register_plugin( PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR )
register_clcmd( "amx_awpuser", "cmd_adduser", ADMIN_BAN, "<userid> - allow a user to use an awp" )
register_event( "CurWeapon", "Event_CurWeapon", "be", "1=1" )
get_configsdir( g_ConfigDir, 63 )
format( g_File, 63, "%s/Awp_Users.ini", g_ConfigDir )
if ( !file_exists( g_File ) )
write_file( g_File, "; Awp Users by Cheap_Suit", -1 )
}
public client_putinserver( id )
{
new Authid[32]
get_user_authid( id, Authid, 31 )
new Text[32], Len = 0, Line = 0
while ( read_file( g_File, Line++, Text, 31, Len ) )
{
if ( Text[0] == ';' || !Len )
continue
if ( equal( Text, Authid, 31 ) )
{
Awp_User[id] = true
break
}
else
Awp_User[id] = false
}
}
public cmd_adduser( id, level, cid )
{
if ( !cmd_access( id, level, cid, 2 ) )
return PLUGIN_HANDLED
new Arg[64], Target
read_argv( 1, Arg, 63 )
Target = cmd_target( id, Arg, 0 )
if ( !is_user_connected( Target ) )
return PLUGIN_HANDLED
Awp_User[Target] = true
new Authid[33]
get_user_authid( Target, Authid, 32 )
new Text[33]
format( Text, 32, "%s", Authid )
write_file( g_File, Text, -1 )
new Targetname[32]
get_user_name( Target, Targetname, 31 )
console_print( id, "Added %s to the Awp User list", Targetname )
client_print( id, print_chat, CLIENT_HAPPY_MSG )
return PLUGIN_HANDLED
}
public Event_CurWeapon( id )
{
if ( !is_user_connected( id ) || !is_user_alive( id ) )
return PLUGIN_CONTINUE
new WeaponID = read_data( 2 )
if ( WeaponID != CSW_AWP || Awp_User[id] )
return PLUGIN_CONTINUE
client_cmd( id, "drop" )
set_task(0.1, "Remove_Awp")
client_print( id, print_chat, CLIENT_SAD_MSG )
return PLUGIN_CONTINUE
}
public Remove_Awp()
{
new Ent = find_ent_by_class( -1, "weaponbox" )
while( Ent > 0 )
{
new Weapon_Model[32]
entity_get_string( Ent, EV_SZ_model, Weapon_Model, 31 )
if( equal( Weapon_Model, "models/w_awp.mdl" ) )
remove_entity( Ent )
Ent = find_ent_by_class( Ent, "weaponbox" )
}
}