 |
|
Member
|

01-01-2010
, 12:15
Re: Random Player
|
#3
|
Quote:
Originally Posted by wyrda
If you want only one player to have his health and gravity changed after that delay this is the code:
PHP Code:
#include <amxmodx> #include <fun> #include <amxmisc> new cvar_delay new Night_Stalker public plugin_init( ) { register_plugin( "Night Stalker Mod", "1.0", "Merc3y" ) register_logevent( "logevent_round_start", 2, "1=Round_Start" ) register_logevent( "logevent_round_end", 2, "1=Round_End" ) register_concmd( "amx_nightstalker", "Toggle", ADMIN_LEVEL_D, " < 1 = on | 0 = off >" ) register_cvar( "nightstalker_toggle", "0" ) cvar_delay = register_cvar( "ns_delay", "10.0" ) } public Game_Start( id ) { new players[ 32 ], num get_players( players, num, "a" ) Night_Stalker = players[ random_num( 0, num-1 ) ] if(is_user_alive(Night_Stalker)) Stats( Night_Stalker ) } public Stats( id ) { set_user_health( Night_Stalker, 250 ) set_user_gravity( Night_Stalker, 0.7 ) } public Toggle( id, level, cid ) { if ( !cmd_access( id, level, cid, 2 ) ) { return PLUGIN_HANDLED } new arg1[ 32 ] read_argv( 1, arg1, 31 ) if ( str_to_num( arg1 ) ) { set_cvar_num( "nightstalker_toggle", 1 ) server_cmd( "sv_restartround 10" ) } else { set_cvar_num( "nightstalker_toggle", 0 ) server_cmd( "sv_restartround 10" ) } return PLUGIN_HANDLED } public logevent_round_start( ) { if ( get_cvar_num( "nightstalker_toggle" ) == 1 ) { set_task( get_pcvar_float( cvar_delay ), "Game_Start" ) } } public logevent_round_end( ) { public logevent_round_end( ) { is_user_connected(Night_Stalker) { if(is_user_alive(Night_Stalker)) set_user_health( Night_Stalker, 100 ) set_user_gravity( Night_Stalker, 1.0 ) } } }
also at the end of the round if he is alive his life will be restored to 100(even I think that this is not necessary)
|
Sorry about the MaxPlayers thing. that was not the full code.
"even I think that this is not necessary" Yeah.
Haven't test the code yet. EDIT: Still instead of 1 it make all player stalker.
__________________
How I Wish That I Can Host Without Any Problem.
Last edited by Merc3y; 01-01-2010 at 12:28.
|
|
|
|