AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Biohazard crow zombie (https://forums.alliedmods.net/showthread.php?t=273335)

alexclaudiu2003 10-17-2015 15:32

Biohazard crow zombie
 
Hello,
This is crow zombie, flying all the time if you click on space.
it is possible to make it fall if zombie recives damage ?
PHP Code:

#include <amxmodx>
#include <biohazard>
#include <hamsandwich>
#include <fakemeta_util>
#define STR_T 32
#define MAX_PLAYERS 32
#define D_ZOMBIE_NAME "Witch (Zboara)"
#define D_ZOMBIE_DESC "Jump+Mouse"
#define D_PLAYER_MODEL "models/alex/babayaga/babayaga.mdl"
#define D_CLAWS "models/3.mdl"

new g_class
new cvar_speedg_smokecvar_minillumcvar_damagecvar_delay

new Float:g_wallorigin[33][3]
new 
Float:g_nextdmg[33]
new 
Float:g_shoottime[33]
public 
plugin_init() {         
 
register_plugin("bio_crowzombie","1.2b","bipbip")
 
is_biomod_active() ? plugin_init2() : pause("ad")
}
public 
plugin_precache() {
 
precache_model(D_PLAYER_MODEL)
 
precache_model(D_CLAWS)
 
g_smoke precache_model"sprites/steam1.spr" )
}

public 
plugin_init2() {

 
g_class register_class(D_ZOMBIE_NAMED_ZOMBIE_DESC)
 if(
g_class != -1)
 {
  
set_class_data(g_classDATA_HEALTH333.0)
  
set_class_data(g_classDATA_SPEED280.0)
  
set_class_data(g_classDATA_GRAVITY0.8)
  
set_class_data(g_classDATA_REGENDLY0.3)
  
set_class_pmodel(g_classD_PLAYER_MODEL)
  
set_class_wmodel(g_classD_CLAWS)
 }
 
 
cvar_speed register_cvar("bh_zm_climbingspeed""220")
 
cvar_minillum register_cvar("bh_zm_minlight""300")
 
cvar_damage register_cvar("bh_zm_lightdamage""0")
 
cvar_delay register_cvar("bh_zm_climbdelay""0")
 
 
RegisterHam(Ham_Touch"player""cheese_player_touch"1)
 
RegisterHam(Ham_Player_PreThink"player""cheese_player_prethink"1)
 
RegisterHam(Ham_TakeDamage"player""cheese_takedamage"1)
}

public 
cheese_player_touch(idworld) {
 
 if(!
is_user_alive(id) || g_class != get_user_class(id))
  return 
HAM_IGNORED
 
 
new classname[STR_T]
 
pev(worldpev_classnameclassname, (STR_T-1))
 
 if(
equal(classname"worldspawn") || equal(classname"func_wall") || equal(classname"func_breakable"))
  
pev(idpev_origing_wallorigin[id])
 return 
HAM_IGNORED 
 
}
public 
cheese_player_prethink(id) {
 
// Player not alive or not zombie
 
if(!is_user_alive(id) || !is_user_zombie(id)) {
  return 
HAM_IGNORED
 
}
 static 
Float:test pev(idpev_light_leveltest
 
 
// Player has not our zombie class
 
if(g_class != get_user_class(id)) {
  return 
HAM_IGNORED
 
}
 static 
Float:origin[3]
 
pev(idpev_originorigin)
 
 if (
get_gametime() > g_nextdmg[id]) {
  static 
Float:lightlevelpev(id,pev_light_levellightlevel)
  
  if (
lightlevel get_pcvar_float(cvar_minillum)) { 
   
fm_fakedamage(id"light"get_pcvar_float(cvar_damage), DMG_BURN)
   
   
// do some smokes
   
message_beginMSG_BROADCASTSVC_TEMPENTITY )
   
write_byteTE_SMOKE )
   
engfunc(EngFunc_WriteCoordorigin] )
   
engfunc(EngFunc_WriteCoordorigin] )
   
engfunc(EngFunc_WriteCoordorigin] )
   
write_shortg_smoke )
   
write_byte20 )
   
write_byte10 )
   
message_end()
   
g_nextdmg[id] = get_gametime() + 1.0
  
}
 }
 
 
// from Cheap_Suit's  Upgrades Mod eXtended
 
static button button pev(idpev_button)
 if(
button IN_JUMP)
 {
  static 
Float:velocity[3]
  
velocity_by_aim(idget_pcvar_num(cvar_speed), velocity)
  
fm_set_user_velocity(idvelocity)
 } 
 
 
 return 
HAM_IGNORED
}
public 
event_infect(victimattacker) {
 
g_nextdmg[victim] = 0.0
 g_shoottime
[victim] = 0.0 
}
public 
cheese_takedamage(victiminflictorattackerFloat:damagedamagetype)
{
 if (
is_user_alive(victim)) {
  if (
g_class == get_user_class(victim)) {
   
g_shoottime[victim] = get_gametime() + get_pcvar_float(cvar_delay);
  }
 }
 return 
HAM_IGNORED
}
/*
Float:getillumination(id) {
 static Float:i ; i = float(engfunc(EngFunc_GetEntityIllum, id))
 if (i > 75.0) i = 75.0
 return (100.0 * xs_sqrt(i / 75.0));
}*/ 


Depresie 10-17-2015 16:01

Re: Biohazard crow zombie
 
This is an example, im sorry, i can't do it right now, maybe you will be able to do it following my example

Code:

new disablefly[33]

in prethink return FMRES_IGNORED if disablefly[id] = true

client_disconnect(id) { remove_task(id) }
take_damage() { disablefly(victim) = true; set_task(5.0, "reset-me", id) }

reset-me(id){ disablefly(id) = false }


alexclaudiu2003 10-21-2015 04:45

Re: Biohazard crow zombie
 
I do not know where to put the code :(

Depresie 10-21-2015 06:19

Re: Biohazard crow zombie
 
not tested, if the zombie took damage, he wont be able to fly for the next 5 seconds

PHP Code:

#include <amxmodx>
#include <biohazard>
#include <hamsandwich>
#include <fakemeta_util>
#define STR_T 32
#define MAX_PLAYERS 32
#define D_ZOMBIE_NAME "Witch (Zboara)"
#define D_ZOMBIE_DESC "Jump+Mouse"
#define D_PLAYER_MODEL "models/alex/babayaga/babayaga.mdl"
#define D_CLAWS "models/3.mdl"

new g_class
new cvar_speedg_smokecvar_minillumcvar_damagecvar_delay

new Float:g_wallorigin[33][3]
new 
Float:g_nextdmg[33]
new 
Float:g_shoottime[33]
new 
disablefly[33]

public 
plugin_init() {         
 
register_plugin("bio_crowzombie","1.2b","bipbip")
 
is_biomod_active() ? plugin_init2() : pause("ad")
}
public 
plugin_precache() {
 
precache_model(D_PLAYER_MODEL)
 
precache_model(D_CLAWS)
 
g_smoke precache_model"sprites/steam1.spr" )
}

public 
plugin_init2() {

 
g_class register_class(D_ZOMBIE_NAMED_ZOMBIE_DESC)
 if(
g_class != -1)
 {
  
set_class_data(g_classDATA_HEALTH333.0)
  
set_class_data(g_classDATA_SPEED280.0)
  
set_class_data(g_classDATA_GRAVITY0.8)
  
set_class_data(g_classDATA_REGENDLY0.3)
  
set_class_pmodel(g_classD_PLAYER_MODEL)
  
set_class_wmodel(g_classD_CLAWS)
 }
 
 
cvar_speed register_cvar("bh_zm_climbingspeed""220")
 
cvar_minillum register_cvar("bh_zm_minlight""300")
 
cvar_damage register_cvar("bh_zm_lightdamage""0")
 
cvar_delay register_cvar("bh_zm_climbdelay""0")
 
 
RegisterHam(Ham_Touch"player""cheese_player_touch"1)
 
RegisterHam(Ham_Player_PreThink"player""cheese_player_prethink"1)
 
RegisterHam(Ham_TakeDamage"player""cheese_takedamage"1)
}

public 
client_disconnect(id)
{
    
remove_task(id)
}

public 
cheese_player_touch(idworld) {
 
 if(!
is_user_alive(id) || g_class != get_user_class(id))
  return 
HAM_IGNORED
 
 
new classname[STR_T]
 
pev(worldpev_classnameclassname, (STR_T-1))
 
 if(
equal(classname"worldspawn") || equal(classname"func_wall") || equal(classname"func_breakable"))
  
pev(idpev_origing_wallorigin[id])
 return 
HAM_IGNORED 
 
}
public 
cheese_player_prethink(id) {
 
// Player not alive or not zombie
 
if(!is_user_alive(id) || !is_user_zombie(id)) {
  return 
HAM_IGNORED
 
}
 static 
Float:test pev(idpev_light_leveltest
 
 
// Player has not our zombie class
 
if(g_class != get_user_class(id)) {
  return 
HAM_IGNORED
 
}
 static 
Float:origin[3]
 
pev(idpev_originorigin)
 
 if (
get_gametime() > g_nextdmg[id]) {
  static 
Float:lightlevelpev(id,pev_light_levellightlevel)
  
  if (
lightlevel get_pcvar_float(cvar_minillum)) { 
   
fm_fakedamage(id"light"get_pcvar_float(cvar_damage), DMG_BURN)
   
   
// do some smokes
   
message_beginMSG_BROADCASTSVC_TEMPENTITY )
   
write_byteTE_SMOKE )
   
engfunc(EngFunc_WriteCoordorigin] )
   
engfunc(EngFunc_WriteCoordorigin] )
   
engfunc(EngFunc_WriteCoordorigin] )
   
write_shortg_smoke )
   
write_byte20 )
   
write_byte10 )
   
message_end()
   
g_nextdmg[id] = get_gametime() + 1.0
  
}
 }
 
 
// from Cheap_Suit's  Upgrades Mod eXtended
 
static button button pev(idpev_button)
 if(!
disablefly[id] && (button IN_JUMP))
 {
  static 
Float:velocity[3]
  
velocity_by_aim(idget_pcvar_num(cvar_speed), velocity)
  
fm_set_user_velocity(idvelocity)
 } 
 
 
 return 
HAM_IGNORED
}
public 
event_infect(victimattacker) {
 
g_nextdmg[victim] = 0.0
 g_shoottime
[victim] = 0.0 
}
public 
cheese_takedamage(victiminflictorattackerFloat:damagedamagetype)
{
 if (
is_user_alive(victim)) {
  if (
g_class == get_user_class(victim)) 
  {
    
g_shoottime[victim] = get_gametime() + get_pcvar_float(cvar_delay);
    
disablefly[victim] = true
    set_task
(5.0"reset-me"victim)
  }
 }
 return 
HAM_IGNORED
}

public 
reset-me(id)
{
    
disablefly[id] = false
}
/*
Float:getillumination(id) {
 static Float:i ; i = float(engfunc(EngFunc_GetEntityIllum, id))
 if (i > 75.0) i = 75.0
 return (100.0 * xs_sqrt(i / 75.0));
}*/ 


alexclaudiu2003 10-21-2015 07:12

Re: Biohazard crow zombie
 
Error on compile
//// bio_crowzombie.sma
// C:\Users\Public\servers\HLDS\cstrike\addons\a mxmodx\scripting\bio_crowzombie.
sma(134) : error 001: expected token: ";", but found "-"
// C:\Users\Public\servers\HLDS\cstrike\addons\a mxmodx\scripting\bio_crowzombie.
sma(144) : warning 203: symbol is never used: "reset"
//
// 1 Error.
// Could not locate output file compiled\bio_crowzombie.amx (compile failed).
//
// Compilation Time: 0,42 sec
// ----------------------------------------

Depresie 10-21-2015 07:30

Re: Biohazard crow zombie
 
public reset-me(id) --> public resetme(id)
set_task(5.0, "reset-me", id) --> set_task(5.0, "resetme", id)

alexclaudiu2003 10-21-2015 07:50

Re: Biohazard crow zombie
 
I do not know where to put :(

Depresie 10-21-2015 14:42

Re: Biohazard crow zombie
 
........

just search for the lines posted in the left side, and change them into the line from the right side

alexclaudiu2003 10-21-2015 14:56

Re: Biohazard crow zombie
 

//// crow.sma
// C:\Users\Public\servers\HLDS\cstrike\addons\a mxmodx\scripting\crow.sma(128) : error 017: undefined symbol "id"
// 1 Error.
// Could not locate output file compiled\crow.amx (compile failed).
// Compilation Time: 0,47 sec

SkumTomteN 10-22-2015 11:38

Re: Biohazard crow zombie
 
Try this, Cant compile since i dont have biohazard, but it should work fine.

Use DISABLE_TIME to control how long its gonna be deactivated.

PHP Code:

#include <amxmodx>
#include <biohazard>
#include <hamsandwich>
#include <fakemeta_util>

#define DISABLE_TIME 2.0
#define STR_T 32
#define MAX_PLAYERS 32
#define D_ZOMBIE_NAME "Witch (Zboara)"
#define D_ZOMBIE_DESC "Jump+Mouse"
#define D_PLAYER_MODEL "models/alex/babayaga/babayaga.mdl"
#define D_CLAWS "models/3.mdl"

new g_class
new cvar_speedg_smokecvar_minillumcvar_damagecvar_delay

new Float:g_wallorigin[33][3]
new 
Float:g_nextdmg[33]
new 
Float:g_shoottime[33]
new 
bool:g_bCantFly[33]

public 
plugin_init() {         
    
register_plugin("bio_crowzombie","1.2b","bipbip")
    
is_biomod_active() ? plugin_init2() : pause("ad")
}
public 
plugin_precache() {
    
precache_model(D_PLAYER_MODEL)
    
precache_model(D_CLAWS)
    
g_smoke precache_model"sprites/steam1.spr" )
}

public 
plugin_init2() {
    
    
g_class register_class(D_ZOMBIE_NAMED_ZOMBIE_DESC)
    if(
g_class != -1)
    {
        
set_class_data(g_classDATA_HEALTH333.0)
        
set_class_data(g_classDATA_SPEED280.0)
        
set_class_data(g_classDATA_GRAVITY0.8)
        
set_class_data(g_classDATA_REGENDLY0.3)
        
set_class_pmodel(g_classD_PLAYER_MODEL)
        
set_class_wmodel(g_classD_CLAWS)
    }
    
    
cvar_speed register_cvar("bh_zm_climbingspeed""220")
    
cvar_minillum register_cvar("bh_zm_minlight""300")
    
cvar_damage register_cvar("bh_zm_lightdamage""0")
    
cvar_delay register_cvar("bh_zm_climbdelay""0")
    
    
RegisterHam(Ham_Touch"player""cheese_player_touch"1)
    
RegisterHam(Ham_Player_PreThink"player""cheese_player_prethink"1)
    
RegisterHam(Ham_TakeDamage"player""cheese_takedamage"1)
}

public 
cheese_player_touch(idworld) {
    
    if(!
is_user_alive(id) || g_class != get_user_class(id))
        return 
HAM_IGNORED
    
    
new classname[STR_T]
    
pev(worldpev_classnameclassname, (STR_T-1))
    
    if(
equal(classname"worldspawn") || equal(classname"func_wall") || equal(classname"func_breakable"))
        
pev(idpev_origing_wallorigin[id])
    return 
HAM_IGNORED 
    
}
public 
cheese_player_prethink(id) {
    
// Player not alive or not zombie
    
if(!is_user_alive(id) || !is_user_zombie(id)) {
        return 
HAM_IGNORED
    
}
    static 
Float:test pev(idpev_light_leveltest
    
    
// Player has not our zombie class
    
if(g_class != get_user_class(id)) {
        return 
HAM_IGNORED
    
}
    static 
Float:origin[3]
    
pev(idpev_originorigin)
    
    if (
get_gametime() > g_nextdmg[id]) {
        static 
Float:lightlevelpev(id,pev_light_levellightlevel)
        
        if (
lightlevel get_pcvar_float(cvar_minillum)) { 
            
fm_fakedamage(id"light"get_pcvar_float(cvar_damage), DMG_BURN)
            
            
// do some smokes
            
message_beginMSG_BROADCASTSVC_TEMPENTITY )
            
write_byteTE_SMOKE )
            
engfunc(EngFunc_WriteCoordorigin] )
            
engfunc(EngFunc_WriteCoordorigin] )
            
engfunc(EngFunc_WriteCoordorigin] )
            
write_shortg_smoke )
            
write_byte20 )
            
write_byte10 )
            
message_end()
            
g_nextdmg[id] = get_gametime() + 1.0
        
}
    }
    
    
// from Cheap_Suit's  Upgrades Mod eXtended
    
static button button pev(idpev_button)
    if(
button IN_JUMP && !g_bCantFly[id])
    {
        static 
Float:velocity[3]
        
velocity_by_aim(idget_pcvar_num(cvar_speed), velocity)
        
fm_set_user_velocity(idvelocity)
    } 
    
    
    return 
HAM_IGNORED
}
public 
event_infect(victimattacker) {
    
g_nextdmg[victim] = 0.0
    g_shoottime
[victim] = 0.0 
}
public 
cheese_takedamage(victiminflictorattackerFloat:damagedamagetype)
{
    if (
is_user_alive(victim)) 
    {
        if (
g_class == get_user_class(victim)) 
        {
            
g_shoottime[victim] = get_gametime() + get_pcvar_float(cvar_delay);
            
            
g_bCantFly[victim] = true;
            
            
set_task(DISABLE_TIME"Reset"victim)
        }
    }
    return 
HAM_IGNORED
}
public 
Reset(idg_bCantFly[id] = false



All times are GMT -4. The time now is 22:13.

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