AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Need a Fix !! write_file() (https://forums.alliedmods.net/showthread.php?t=240249)

Spawner30 05-11-2014 13:11

Need a Fix !! write_file()
 
! hello again !
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 !
hope u understand me !

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( );         }     } } }

fysiks 05-11-2014 13:18

Re: Just for once
 
The forum rules require that your topic title be descriptive. Please change your topic title to describe your question or issue. If you fail to do so, you risk your threads being trashed.

Spawner30 05-11-2014 13:22

Re: Need a Fix !! write_file()
 
done !
so you'll help me now ? !

Arkshine 05-11-2014 14:12

Re: Need a Fix !! write_file()
 
Ham_Spawn should be hooked as post, and you forget the is_user_alive check in callback, then this will be called once.

Spawner30 05-11-2014 16:05

Re: Need a Fix !! write_file()
 
Quote:

Originally Posted by Arkshine (Post 2136460)
Ham_Spawn should be hooked as post, and you forget the is_user_alive check in callback, then this will be called once.

mrc/tnx ! i will give a try !


All times are GMT -4. The time now is 09:45.

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