Raised This Month: $209 Target: $400
 52% 

API Scripting Help [HELP] Zombie CLASS TO BUY


Post New Thread Reply   
 
Thread Tools Display Modes
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 09-26-2014 , 11:04   Re: [HELP] Zombie CLASS TO BUY
Reply With Quote #11

Alright, I'll fix it. ;)
__________________
Problem with ZP?
ZP Helper!

Last edited by zmd94; 09-26-2014 at 11:04.
zmd94 is offline
SnowFake
Senior Member
Join Date: Oct 2012
Old 09-26-2014 , 11:53   Re: [HELP] Zombie CLASS TO BUY
Reply With Quote #12

TY ! ><
SnowFake is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 09-27-2014 , 01:20   Re: [HELP] Zombie CLASS TO BUY
Reply With Quote #13

Sorry, I have tried but failed. Maybe, you can just lower the cost to buy the zombie. Then, make it for a map. ;)

Just edit the value 9000 in this line:
PHP Code:
g_buy_zombie zp_register_extra_item("Buy Zombie"9000ZP_TEAM_HUMAN ZP_TEAM_ZOMBIE
__________________
Problem with ZP?
ZP Helper!
zmd94 is offline
smoka
Member
Join Date: Aug 2010
Old 10-08-2014 , 12:59   Re: [HELP] Zombie CLASS TO BUY
Reply With Quote #14

Can i have this sort of plugin but for single round ? asked for this while ago and now by accident i found this
PHP Code:
#include <amxmodx>
#include <zombieplague>
#include <fakemeta>
#include <engine>
#include <fun>
#include <hamsandwich>
#include <zp50_class_zombie>
/*                      L4D Tank Zombie
                by x[L]eoNNN
    
    #Description :
    
        this is a Zombie Class of Famous Game, "L4d" with the ability to throw rocks at enemies,
        either killing him, infecting taking life, etc. (controlled by a cvar)
    
    #Cvars :
    
        zp_tank_rockspeed 700 // Rock Speed Launched by Tank
        zp_tank_rockdamage 70 // damage done by the rock
        zp_tank_rockreward 1 // Ammo Pack's Reward by touching the enemy with the rock
        zp_tank_rockmode 1 // Rock Mode :
                    1 = Take Damage
                    2 = Killing
                    3 = Infect
                    4 = Bad Aim
        zp_tank_rock_energynesesary 20 // energy nesesary to launch a rock

    #Changelog :
    
        v1.0: public release
        v1.1: print messages changed to hudmessages (for spam), fix time reload bug,add effect touching rock
        v1.2: fix a survivor bugs', To break an entity "func_breakable" when the rock touches the entity, 
              fix a problem with logs : native error : get_user_origin.
*/
new const zombieclass3_name[] = "Tank"
new const zombieclass3_info[] = "Lunch rocks and knock people"
new const zombieclass3_models[][] = { "l4d_tank" }
new const 
zombieclass3_clawmodels[][] = { "models/zombie_plague/v_tank.mdl" }
const 
zombieclass3_health 3000
const Float:zombieclass3_speed 0.97
const Float:zombieclass3_gravity 1.0
const Float:zombieclass3_knockback 0.5

new g_L4dTank

new g_trailSpriterockmodel
new g_trail[] = "sprites/xbeam3.spr"
new rock_model[] = "models/rockgibs.mdl"
new rock_model2[] = "models/rockgibs.mdl"
new tank_rocklaunch[] = "zombie_plague/tank_rocklaunch.wav"


new g_power[33]

new 
cvar_rock_damagecvar_rock_rewardcvar_rockmodecvar_rockEnergyNesesarycvar_rock_speedcvar_reloadpower
new cvar_powercvar_height

public plugin_init()
{
    
register_plugin("[ZP] Zombie Class: L4D Tank Zombie""1.2""x[L]eoNNN"
    
    
RegisterHam(Ham_TakeDamage"player""OnTakeDamagePost"1)
    
register_touch("rock_ent","*","RockTouch")
    
register_forward(FM_CmdStart"CmdStart" )
    
    
cvar_rock_speed register_cvar("zp_tank_rockspeed""700")
    
cvar_rock_damage register_cvar("zp_tank_rockdamage""70")
    
cvar_rock_reward register_cvar("zp_tank_rockreward""1")
    
cvar_rockmode register_cvar("zp_tank_rockmode""1")
    
cvar_rockEnergyNesesary register_cvar("zp_tank_rock_energynesesary""20")
    
cvar_reloadpower register_cvar("zp_tank_reload_power""1")
    
    
cvar_power register_cvar("zp_tank_knife_power","1000")
    
cvar_height register_cvar("zp_tank_knife_height","500")


public 
plugin_precache()
{
    new 
index
    g_L4dTank 
zp_class_zombie_register(zombieclass3_namezombieclass3_infozombieclass3_healthzombieclass3_speedzombieclass3_gravity)
    
zp_class_zombie_register_kb(g_L4dTankzombieclass3_knockback)
    for (
index 0index sizeof zombieclass3_modelsindex++)
    
zp_class_zombie_register_model(g_L4dTankzombieclass3_models[index])
    for (
index 0index sizeof zombieclass3_clawmodelsindex++)
    
zp_class_zombie_register_claw(g_L4dTankzombieclass3_clawmodels[index])
    
g_trailSprite precache_model(g_trail)
    
rockmodel precache_model(rock_model)
    
precache_sound(tank_rocklaunch)
}
    
public 
zp_user_infected_post idinfector )
{
             if (
zp_get_user_zombie_class(id) == g_L4dTank)
             {
        
print_chatColor(id"\g[ZP]\n You Are A \gL4D Tank\n, You Cant Launch Rock With \tIN_USE [+E]"
        
g_power[id] = get_pcvar_num(cvar_rockEnergyNesesary)
        
set_task(get_pcvar_float(cvar_reloadpower), "power1"id__"b")
             }
}  

public 
CmdStart( const id, const uc_handlerandom_seed )
{
    if(!
is_user_alive(id))
        return 
FMRES_IGNORED;
    
    if(!
zp_get_user_zombie(id) || zp_get_user_nemesis(id))
        return 
FMRES_IGNORED;
        
    new 
button pev(idpev_button)
    new 
oldbutton pev(idpev_oldbuttons)
    
    if (
zp_get_user_zombie(id) && (zp_get_user_zombie_class(id) == g_L4dTank))
    
    if(
oldbutton IN_USE && !(button IN_USE))
    {
        if(
g_power[id] >= get_pcvar_num(cvar_rockEnergyNesesary))
        {
            
MakeRock(id)
            
emit_sound(idCHAN_STREAMtank_rocklaunchVOL_NORMATTN_NORM0PITCH_NORM)
            
g_power[id] = 0
        
}
        else
        {
            
set_hudmessage(255000.00.606.03.0)
            
show_hudmessage(id"[ZP] Energy Nesesary To Launch Rock [%d] || You Energy [%d]"get_pcvar_num(cvar_rockEnergyNesesary), g_power[id])
        }
            
    }    
    
    return 
FMRES_IGNORED
}

public 
power1(id)
{
    
g_power[id] += 1
    
    
if( g_power[id] > get_pcvar_num(cvar_rockEnergyNesesary) )
    {
        
g_power[id] = get_pcvar_num(cvar_rockEnergyNesesary)
    }
}

public 
RockTouchRockEntTouched )
{
    if ( !
pev_valid RockEnt ) )
        return
        
    static Class[ 
32 ]
    
entity_get_stringTouchedEV_SZ_classname, Class, charsmax( Class ) )
    new 
Float:origin[3]
        
    
pev(Touched,pev_origin,origin)
    
    if( 
equal( Class, "player" ) )
        if (
is_user_alive(Touched))
        {
            if(!
zp_get_user_zombie(Touched))
            {
                new 
TankKiller entity_get_edictRockEntEV_ENT_owner )
                
                switch(
get_pcvar_num(cvar_rockmode))
                {
                    case 
1// Health
                    
{
                        new 
iHealth get_user_health(Touched)

                        if( 
iHealth >= && iHealth <= get_pcvar_num(cvar_rock_damage))
                        {
                            
ExecuteHamBHam_KilledTouchedTankKiller)
                            
print_chatColor(TankKiller"\g[ZP]\n You Receive \t%d\n Ammo Packs To Reach a Rock a Enemy"get_pcvar_num(cvar_rock_reward))
                            
zp_set_user_ammo_packs(TankKillerzp_get_user_ammo_packs(TankKiller) + get_pcvar_num(cvar_rock_reward))
                        }
                        else
                        {
                            
set_user_health(Touchedget_user_health(Touched) - get_pcvar_num(cvar_rock_damage))
                            
print_chatColor(TankKiller"\g[ZP]\n You Receive \t%d\n Ammo Packs To Reach a Rock a Enemy"get_pcvar_num(cvar_rock_reward))
                            
zp_set_user_ammo_packs(TankKillerzp_get_user_ammo_packs(TankKiller) + get_pcvar_num(cvar_rock_reward))
                        }
                    }
                    case 
2// Kill
                    
{
                        if(
zp_get_user_survivor(Touched))
                            return
                                
                        
ExecuteHamBHam_KilledTouchedTankKiller)
                        
zp_set_user_ammo_packs(TankKillerzp_get_user_ammo_packs(TankKiller) + get_pcvar_num(cvar_rock_reward))
                        
print_chatColor(TankKiller"\g[ZP]\n You Receive \t%d\n Ammo Packs To Reach a Rock a Enemy"get_pcvar_num(cvar_rock_reward))
                    }
                    case 
3//infect
                    
{
                        if(
zp_get_user_survivor(Touched))
                            return
                            
                        
zp_infect_user(TouchedTankKiller11)
                        
print_chatColor(TankKiller"\g[ZP]\n You Receive \t%d\n Ammo Packs To Reach a Rock a Enemy"get_pcvar_num(cvar_rock_reward))
                        
zp_set_user_ammo_packs(TankKillerzp_get_user_ammo_packs(TankKiller) + get_pcvar_num(cvar_rock_reward))

                    }
                    case 
4//BadAim
                    
{
                        new 
Float:vec[3] = {100.0,100.0,100.0}
                        
                        
entity_set_vector(Touched,EV_VEC_punchangle,vec)  
                        
entity_set_vector(Touched,EV_VEC_punchangle,vec)
                        
entity_set_vector(Touched,EV_VEC_punchangle,vec
                        
                        
print_chatColor(TankKiller"\g[ZP]\n You Receive \t%d\n Ammo Packs To Reach a Rock a Enemy"get_pcvar_num(cvar_rock_reward))
                        
zp_set_user_ammo_packs(TankKillerzp_get_user_ammo_packs(TankKiller) + get_pcvar_num(cvar_rock_reward))
                        
set_task(1.50"EndVictimAim"Touched)
                    }
                }
            }
        }
        
    if(
equal(Class, "func_breakable") && entity_get_int(TouchedEV_INT_solid) != SOLID_NOT)
        
force_use(RockEntTouched)
        
    
remove_entity(RockEnt)
    
    if(!
is_user_alive(Touched))
        return
        
    static 
origin1[3]
    
get_user_origin(Touchedorigin1)
    
    
message_begin(MSG_BROADCAST,SVC_TEMPENTITYorigin1);
    
write_byte(TE_BREAKMODEL); 
    
write_coord(origin1[0]);  
    
write_coord(origin1[1]);
    
write_coord(origin1[2] + 24); 
    
write_coord(16); 
    
write_coord(16); 
    
write_coord(16); 
    
write_coord(random_num(-50,50)); 
    
write_coord(random_num(-50,50)); 
    
write_coord(25);
    
write_byte(10); 
    
write_short(rockmodel); 
    
write_byte(10); 
    
write_byte(25);
    
write_byte(0x01); 
    
message_end();
}

public 
EndVictimAim(Touched)
{
    new 
Float:vec[3] = {-100.0,-100.0,-100.0}
    
entity_set_vector(Touched,EV_VEC_punchangle,vec)  
    
entity_set_vector(Touched,EV_VEC_punchangle,vec)
    
entity_set_vector(Touched,EV_VEC_punchangle,vec)
}

public 
MakeRock(id)
{
            
    new 
Float:Origin[3]
    new 
Float:Velocity[3]
    new 
Float:vAngle[3]

    new 
RockSpeed get_pcvar_num(cvar_rock_speed)

    
entity_get_vector(idEV_VEC_origin Origin)
    
entity_get_vector(idEV_VEC_v_anglevAngle)

    new 
NewEnt create_entity("info_target")

    
entity_set_string(NewEntEV_SZ_classname"rock_ent")

    
entity_set_model(NewEntrock_model2)

    
entity_set_size(NewEntFloat:{-1.5, -1.5, -1.5}, Float:{1.51.51.5})

    
entity_set_origin(NewEntOrigin)
    
entity_set_vector(NewEntEV_VEC_anglesvAngle)
    
entity_set_int(NewEntEV_INT_solid2)

    
entity_set_int(NewEntEV_INT_rendermode5)
    
entity_set_float(NewEntEV_FL_renderamt200.0)
    
entity_set_float(NewEntEV_FL_scale1.00)

    
entity_set_int(NewEntEV_INT_movetype5)
    
entity_set_edict(NewEntEV_ENT_ownerid)

    
velocity_by_aim(idRockSpeed  Velocity)
    
entity_set_vector(NewEntEV_VEC_velocity ,Velocity)

    
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
    
write_byte(TE_BEAMFOLLOW
    
write_short(NewEnt
    
write_short(g_trailSprite
    
write_byte(10
    
write_byte(10
    
write_byte(255
    
write_byte(0
    
write_byte(0
    
write_byte(200
    
message_end()
    
    return 
PLUGIN_HANDLED
}

public 
CSBot_Init(id)
{
    
RegisterHamFromEntity(Ham_TakeDamageid"OnTakeDamagePost"1)
}

public 
OnTakeDamagePost(victiminflictorattacker/*, Float:damage, dmgtype*/)
{
    
    if(
victim == attacker) return HAM_IGNORED//self damage
    
if(inflictor != attacker) return HAM_IGNORED//prevent from other damage like bazooka, tripmine we need knife damage only
    
if(!is_user_connected(attacker)) return HAM_IGNORED//non-player damage
    
if(get_user_weapon(attacker) != CSW_KNIFE) return HAM_IGNORED//current weapon is not knife

    
    
if(!zp_get_user_zombie_class(victim) == g_L4dTank && zp_get_user_zombie_class(attacker) == g_L4dTank)
    {
        static 
Float:fVelocity[3]
        
velocity_by_aim(attackerget_pcvar_num(cvar_power), fVelocity)
        
fVelocity[2] = get_pcvar_float(cvar_height)
        
set_pev(victimpev_velocityfVelocity)
    }
    
    return 
HAM_IGNORED;
}

stock print_chatColor(const id,const input[], any:...)
{
    new 
msg[191], players[32], count 1;
    
vformat(msg,190,input,3);
    
replace_all(msg,190,"\g","^4");// green
    
replace_all(msg,190,"\n","^1");// normal
    
replace_all(msg,190,"\t","^3");// team
    
    
if (idplayers[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();
    }

smoka is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 10-08-2014 , 20:25   Re: [HELP] Zombie CLASS TO BUY
Reply With Quote #15

Do you want to modify this zombie class into extra item that can only be used in one round only?

In next round, if the player want to use this zombie class, he will have to buy it again?
__________________
Problem with ZP?
ZP Helper!

Last edited by zmd94; 10-08-2014 at 20:25.
zmd94 is offline
smoka
Member
Join Date: Aug 2010
Old 10-09-2014 , 04:32   Re: [HELP] Zombie CLASS TO BUY
Reply With Quote #16

yes thats what exactly i want
smoka is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 10-09-2014 , 04:57   Re: [HELP] Zombie CLASS TO BUY
Reply With Quote #17

Just try below. ;)
Attached Files
File Type: sma Get Plugin or Get Source (l4d_tank_zombie.sma - 324 views - 10.6 KB)
__________________
Problem with ZP?
ZP Helper!

Last edited by zmd94; 10-09-2014 at 06:15.
zmd94 is offline
smoka
Member
Join Date: Aug 2010
Old 10-09-2014 , 05:04   Re: [HELP] Zombie CLASS TO BUY
Reply With Quote #18

Welcome to the AMX Mod X 1.76-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team
PHP Code:
ErrorInvalid symbol name "" on line 18
Error
Invalid function or declaration on line 20
Error
Undefined symbol "g_itemid_L4dTank" on line 50
Error
Undefined symbol "g_trailSprite" on line 62
Error
Undefined symbol "rockmodel" on line 63
Error
Undefined symbol "g_itemid_L4dTank" on line 69
Error
Undefined symbol "rockmodel" on line 241
Error
Number of arguments does not match definition on line 241
Error
Undefined symbol "g_trailSprite" on line 293
Warning
Tag mismatch on line 319
Warning
Symbol is never used"" on line 347 
cant compile after your edit compiled it with little edit no "," new g_L4dTank after
new g_itemid_L4dTank
PS it does not work shows in the buy menu purchsing it but nothing happens, except losing the ammo

Last edited by smoka; 10-09-2014 at 05:17.
smoka is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 10-09-2014 , 06:15   Re: [HELP] Zombie CLASS TO BUY
Reply With Quote #19

Sorry, my fault.

I have updated the previous code. ;)

https://forums.alliedmods.net/showpo...9&postcount=17
__________________
Problem with ZP?
ZP Helper!
zmd94 is offline
smoka
Member
Join Date: Aug 2010
Old 10-09-2014 , 09:21   Re: [HELP] Zombie CLASS TO BUY
Reply With Quote #20

it works, but not the way i expected to work, i expected once you buy this you will turn into the zombie anyway you can help me to do that to work like buy nemesis/surv etc

Last edited by smoka; 10-09-2014 at 10:01.
smoka is offline
Reply


Thread Tools
Display Modes

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 09:05.


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