Raised This Month: $12 Target: $400
 3% 

Help / Support [HELP] Convert to ZP 5.0


Post New Thread Reply   
 
Thread Tools Display Modes
Depresie
Veteran Member
Join Date: Nov 2013
Old 12-04-2014 , 09:45   Re: [HELP] Convert to ZP 5.0
Reply With Quote #11

doesn't work.. nevermind i think the whole code is not good...
Depresie is offline
wicho
Veteran Member
Join Date: Feb 2012
Location: GuateAmala
Old 12-04-2014 , 19:57   Re: [HELP] Convert to ZP 5.0
Reply With Quote #12

yes, the code is not good, if I have time I'll try to make a new version..

P.S: try the code of abdul..

PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <fun>
#include <zombieplague>
#include <cs_player_models_api>  

// The mutated zombie's model ( only models folder name is required and the model must be in models/player/ )
new const model_mutate[] = "zombiemutate"

// The mutated zombie's v_model 
new const model_mutatehands[] = "models/zombiemutate/zombiemutatehands.mdl"

// Only use wave sounds bcoz they can only be properly emitted
new const sound_mutate[] = "sound/zombiemutate/mutating.wav"

// Cvar pointers
new cvar_maxzombiescvar_healthcvar_percentg_max_playercvar_healthreward

public plugin_init()
{
    
register_plugin("[ZP] Addon: Zombie Mutation""1.0""@bdul!")
    
    
cvar_health =       register_cvar("zp_mutate_health""300"// Minimum Amount of health a zombie needs to mutate (have a chance to)
    
cvar_maxzombies =   register_cvar("zp_mutate_maxzombies""3"// Last "x" zombies have a chance to mutate.
    
cvar_percent =      register_cvar("zp_mutate_chance""10"// 1 in "x"
    
cvar_healthreward register_cvar("zp_mutate_health_reward""3000"// Amount of health rewarded to the mutated zombie
    
    
RegisterHam(Ham_Killed"player""ham_killed_post"1)
    
RegisterHam(Ham_Spawn"player""ham_player_spawn_post"1)
    
    
g_max_player get_maxplayers()
    
// Dont use deathmsg if you are including hamsandwich because ham_killed is better
    //register_event("Event_DeathMsg", "DeathMsg", "a")
}

public 
plugin_precache()
{
    new 
buffer[256]
    
    
// Format the model's path and then precache it
    
formatex(buffer255"models/player/%s/%s.mdl"model_mutatemodel_mutate)
    
precache_model(buffer)

    
precache_model(model_mutatehands)
    
    
// Precache our sound (must be wav)
    
precache_sound(sound_mutate)
}

// You need to check in all these forwards for the last zombies to mutate
public ham_player_spawn_post()     check_for_zombie()
public 
ham_killed_post()         check_for_zombie()
public 
client_disconnect(id)         check_for_zombie()
public 
zp_user_humanized_post(idunusedcheck_for_zombie()

check_for_zombie()
{
    
// Get the actual zombies count
    
if ((zp_get_zombie_count() - zp_get_nemesis_count()) <= get_pcvar_num(cvar_maxzombies))
    {
        static 
id
        
for (id 1id <= g_max_playerid++)
        {
            if (!
zp_get_user_zombie(id) || (get_user_health(id) < get_pcvar_num(cvar_health)))
                continue;
            
            if (
random_num(1get_pcvar_num(cvar_percent)) == 1)
                
set_task(2.0"mutate_user"id)
            
            
// This is necassary to make the loop continue
            
continue;
        }
    }
}

public 
mutate_user(id)
{
    
// Changing models rapidly can result in SVC_BAD kicks so its better to change it once only
     
cs_set_player_model(idmodel_mutate)

    
// Set v_model 
    
set_pev(idpev_viewmodel2model_mutatehands)
    
    
// Set his health
    
set_user_health(idget_user_health(id) + get_pcvar_num(cvar_healthreward))
    
    
// Emit sound is used so that only near by players are informed of the mutation
    
emit_sound(idCHAN_VOICEsound_mutate1.0ATTN_NORM0PITCH_NORM)


Last edited by wicho; 12-04-2014 at 23:55.
wicho is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:18.


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