i have a problem with my plugin .
so i want you to give me the better way to check frag player without ham_spawn and check it just for 1 time i mean the message + hud apear just for once [1] same thing with write in file !
Code:
#include < amxmodx >
#include < hamsandwich >
#define PLUGIN "Admin-Check"
#define AUTHOR "Spawner"
#define VERSION "1.0"
new const NewFile[ 64 ] = "addons/amxmodx/configs/AdminRequest.ini";
new const WinnerMessage[] = ".y[.vWinner.y] .tHey Winner .y| .tYour Name Is Writed To Bee .v[Admin] .yWaiting For .v[Owner] .yTo Accept"
new const PublicMessage[] = ".vThe Winner is: .t%s For Killing .v%i .yPlayers"
new const HudMessage[]= "----------- The Winner For Request Admin Is %s ---------"
new howmuch;
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
RegisterHam( Ham_Spawn, "player", "SpawnCheck" );
howmuch = register_cvar("amx_request","10");
}
public SpawnCheck( id )
{
if(get_user_frags(id) >= get_pcvar_num(howmuch))
{
static szName[ 32 ],szID[ 32 ],szIP[32];
get_user_name( id, szName, charsmax( szName ) );
get_user_authid( id, szID, charsmax( szID ) );
get_user_ip( id , szIP, charsmax( szID ) )
new Format[ 128 ];
formatex( Format, 127, "[ Name : %s | Steam id : %s | IP : %s | Killing : %i ]", szName , szID , szIP , get_pcvar_num(howmuch));
write_file( NewFile, Format );
Color_New(0, WinnerMessage);
Color_New(0, PublicMessage, szName,get_pcvar_num(howmuch));
set_hudmessage(255, 0, 212, -1.0, 0.01, 2, 0.1, 40.0, 0.1, 0.1, -1)
show_hudmessage(0,HudMessage, szName)
}
}
stock Color_New( const id, const input[ ], any:... )
{
new count = 1, players[ 32 ]
static msg[ 191 ]
vformat( msg, 190, input, 3 )
replace_all( msg, 190, ".v", "^4" ) /* vert */
replace_all( msg, 190, ".y", "^1" ) /* yellow*/
replace_all( msg, 190, ".t", "^3" ) /* ct=Blue| t=red */
replace_all( msg, 190, ".x", "^0" ) /* normal*/
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( );
}
}
}
}