I need help in plugin ze_gamemode_survivor
Posted: 01 Feb 2020, 11:45
Hi
i create plugin ze_gamemode_survivor, when start round game is crashed !
if u can finish plugin, not problem
just help
Warning : survivor has have high HP and gravity and speed and ultimate ammo and clip and model and blue glow and m249 weapon
i create plugin ze_gamemode_survivor, when start round game is crashed !
if u can finish plugin, not problem
just help
Warning : survivor has have high HP and gravity and speed and ultimate ammo and clip and model and blue glow and m249 weapon
- /*
- survivor is human alone is human, but all is zombies, zombie not become infect
- become damaged mean kill,
- survivor have m249 + ultimate ammo + high health + glow ... etc
- */
- #include < zombie_escape >
- #include < fun >
- #define ACCESS_ADMIN ADMIN_KICK
- // Variable
- new pcvar_chance, pcvar_health, pcvar_gravity, pcvar_speed, pcvar_glow, pcvar_weaponblock, pcvar_weapon
- // Bool
- new bool:IsSurvivor[ 33 ]
- new bool:RoundSurvivor[ 33 ]
- // Default Sound
- new SndSrv[ ] =
- {
- "zombie_escape/gamemode_survivor.wav"
- }
- new gMaxPlayers
- public plugin_init()
- {
- // Load Plugin
- register_plugin("[ ZE ] Gamemode: Survivor", "1.0", "LiZou Mapper")
- // Clcmds
- register_clcmd( "drop", "clcmd_drop" )
- register_clcmd( "ze_survivor_round", "cmdSurvivor", ACCESS_ADMIN, "< Round Survivor >" )
- // Event
- register_event( "HLTV", "EventNewRound", "a", "1=0", "2=0" )
- // Cvars
- pcvar_chance = register_cvar( "ze_survivor_chance", "10" )
- pcvar_health = register_cvar( "ze_survivor_health", "8000" )
- pcvar_gravity = register_cvar( "ze_survivor_gravity", "0.8" )
- pcvar_speed = register_cvar( "ze_survivor_speed", "265" )
- pcvar_glow = register_cvar( "ze_survivor_glow", "1" )
- pcvar_weaponblock = register_cvar( "ze_survivor_blockdrop", "1" )
- pcvar_weapon = register_cvar( "ze_survivor_weapon", "m249" )
- // More
- gMaxPlayers = get_maxplayers( )
- }
- public plugin_precache( )
- {
- precache_sound( SndSrv )
- }
- public plugin_natives( )
- {
- register_native( "ze_is_user_survivor", "_native_get_user_survivor" )
- register_native( "ze_set_user_survivor", "_native_set_user_survivor" )
- }
- public _native_get_user_survivor( iPlugin, iParams )
- {
- return IsSurvivor[ get_param( 1 ) ]
- }
- public _native_set_user_survivor( iPlugin, iParams )
- {
- SetSurvivor( get_param( 1 ) )
- }
- // Client is Connected
- public client_connect( id )
- {
- RoundSurvivor[ id ] = false
- }
- // Client is Disconnected
- public client_disconnected( id )
- {
- RoundSurvivor[ id ] = false
- }
- // Cmd Start Round Survivor
- public cmdSurvivor( id )
- {
- RoundSurvivor[ id ] = true
- }
- // New Round function
- public EventNewRound( id )
- {
- // if pcvar_chance = 1, make round survivor
- if(random_num(1, get_pcvar_num( pcvar_chance ) ) == 1 )
- {
- RoundSurvivor[ id ] = true
- }
- }
- public ze_zombie_appear( )
- {
- for( new id; id < gMaxPlayers;id++ )
- {
- if( RoundSurvivor[ id ] )
- {
- // choose one random player
- new TargetPlayer = GetRandomAlive(random_num(1, GetAliveCount()))
- // Set client survivor
- SetSurvivor( TargetPlayer )
- // start effect survivor
- EffectRoundSurvivor( )
- while( RoundSurvivor[ id ] )
- {
- // is user is not alive
- if( !is_user_alive( id ) )
- continue;
- // user is already survivor or zombies
- if( IsSurvivor[ id ] && !ze_is_user_zombie( id ) )
- continue;
- // infect remaining player into zombies
- ze_set_user_zombie( id )
- }
- }
- }
- }
- public SetSurvivor( id )
- {
- // if player alive and is survivor and is player not zombie
- if( is_user_alive( id ) && IsSurvivor[ id ] && !ze_is_user_zombie( id ) )
- {
- // Set Survivor Health
- if( get_pcvar_num( pcvar_health ) != 0 )
- {
- set_user_health( id, get_pcvar_num( pcvar_health ) )
- }
- // Set Survivor Gravity
- if( get_pcvar_num( pcvar_gravity ) != 0 )
- {
- set_user_gravity( id, get_pcvar_float( pcvar_gravity ) )
- }
- // Set Survivor Speed
- if( get_pcvar_num( pcvar_speed ) != 0 )
- {
- set_user_maxspeed( id, get_pcvar_float( pcvar_speed ) )
- }
- // Set Survivor Glow
- if( get_pcvar_num( pcvar_glow ) != 0 )
- {
- set_user_rendering( id, kRenderFxNone, 0, 0, 255, kRenderGlow, 100 )
- }
- new WpnSrv[ 64 ]
- formatex( WpnSrv, charsmax( WpnSrv ), "weapon_%s", pcvar_weapon )
- give_item( id, WpnSrv )
- // return make player is survivor
- return IsSurvivor[ id ]
- }
- return PLUGIN_HANDLED;
- }
- EffectRoundSurvivor( )
- {
- for( new id; id < gMaxPlayers ;id++ )
- {
- static LangHUD[ 64 ]
- // Message Round Survivor
- formatex( LangHUD, charsmax( LangHUD ), "%L", LANG_PLAYER, "GAMEMODE_SURVIVOR" )
- set_hudmessage( 0, 0, 255, -1.0, 0.25, 1, 6.0, 5.0, 0.1, 1.5 )
- show_hudmessage( id, LangHUD )
- // Sound Round Survivor
- client_cmd( id, "spk %s", SndSrv )
- }
- }
- public clcmd_drop( id ) {
- // Block Survivor drop weapons
- if( IsSurvivor[ id ] && get_pcvar_num( pcvar_weaponblock ) != 0 )
- {
- return PLUGIN_HANDLED;
- }
- return PLUGIN_CONTINUE;
- }
- // Get Alive Count -returns alive players number-
- GetAliveCount()
- {
- new iAlive, id
- for (id = 1; id <= gMaxPlayers; id++)
- {
- if (is_user_alive(id))
- iAlive++
- }
- return iAlive;
- }