AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Zombie Plague Mod (https://forums.alliedmods.net/forumdisplay.php?f=126)
-   -   Subplugin Submission [ZP] Class: Frost Zombie (Can freeze human. Block fire) (https://forums.alliedmods.net/showthread.php?t=139291)

dias 09-29-2010 06:48

[ZP] Class: Frost Zombie (Can freeze human. Block fire)
 
1 Attachment(s)
Frost Zombie

This zombie class can freeze human by aiming the target
And Block Fire(+attack1 & +attack2) Of The Human

This Zombie Class Made By Excalibur.007 (Remake By me)

USE:
- Press "E" to Use Freeze

Cvar:

zp_frost_distance 400 - Distance To Freeze (Default: 400)
zp_frost_cooldown 10.0 - Time Waiting to use the next time (Default: 10.0)
zp_frost_freeze_time 5.0 - How Long To Freeze a human (Default: 5.0)


------------------ Important ------------------------------
To USE This class. You Must Use "[New Natives]Zombie Plague 4.3[v1.8]"
-> http://forums.alliedmods.net/showthread.php?t=119431
THIS IS NOT A PLUGIN. THIS IS A EDITED ZOMBIE PLAGUE 4.3 WITH NEW NATIVES

=> If you didn't Use "[New Natives]Zombie Plague 4.3[v1.8]".
You can't compile :). And can't use Frost Zombie
----------------------------------------------------------

I Tested This Class => Working

ScreenShots:
http://ca4.upanh.com/13.1007.18215232.zMM0/123.png

I made a models for Frost And hands :D:

http://ca6.upanh.com/13.1005.1821255.../untitled2.png
http://ca3.upanh.com/13.1005.18212555.ln0/untitled.png

What do you think :D

DOWNLOAD:
Frost_Zombie Player Models : http://www.mediafire.com/?e0frcdtlqvil26u
Hand: N/A

Last Update: 22/10/2010
Code:

- Fix bug "all zombie got frost"

Excalibur.007 09-29-2010 07:13

Re: [ZP] Class: Frost Zombie (Remake)
 
It's a bad idea that client_PreThink is used. Use FM_CmdStart. Like I said it's just an example of using the native.
EDIT: I see FM_CmdStart but, what I dont see anything related to my use_cmd.
EDIT2: Use get_gametime instead of set_task for cooldown.
EDIT3: Ok I see the point of FM_CmdStart. Use FM_CmdStart for IN_USE thingy dont use it on client_PreThink.

dias 09-29-2010 07:15

Re: [ZP] Class: Frost Zombie (Remake)
 
What ?.
How to fix this :-ss
-----------------------------
I Tested. It's Work very good

Ryokin 09-29-2010 07:25

Re: [ZP] Class: Frost Zombie (Remake)
 
Quote:

Originally Posted by dias (Post 1311198)
What ?.
How to fix this :-ss
-----------------------------
I Tested. It's Work very good

- replace client prethink by fm_cmdstart
- when frost human, hook a float = get_gametime, then check if ( get_gametime - hooked float <cooldown) then....

Excalibur.007 09-29-2010 07:26

Re: [ZP] Class: Frost Zombie (Remake)
 
Done.

PHP Code:

#include <amxmodx>
#include <fakemeta>
#include <zombieplague>

new const zclass_name[ ] = "Frost Zombie"
new const zclass_info[ ] = "Press E to use frost"
new const zclass_model[ ] = "frost_zombie"
new const zclass_clawmodel[ ] = "v_knife_frost.mdl"
const zclass_health 1000
const zclass_speed 240
const Float:zclass_gravity 0.5
const Float:zclass_knockback 1.0

new g_zclass_frostfrostsprite
new pcvar_distancepcvar_cooldownpcvar_freeze
new Bloqueado[33]
new 
Float:gLastUseCmd33 ]

public 
plugin_init( )
{
    
register_plugin"[ZP] Zombie Class: Frost Zombie""1.0""007" )
    
    
pcvar_distance register_cvar"zp_frost_distance""400" )
    
pcvar_cooldown register_cvar"zp_frost_cooldown""10.0" )
    
pcvar_freeze register_cvar"zp_frost_freeze_time""5.0" )
    
register_forward(FM_CmdStart"fw_Start")
}

public 
plugin_precache( )
{
    
g_zclass_frost zp_register_zombie_classzclass_namezclass_infozclass_modelzclass_clawmodelzclass_healthzclass_speedzclass_gravityzclass_knockback )
    
frostsprite precache_model"sprites/nhth1.spr" )
}

public 
zp_user_infected_postplayerinfector )
{
    if( 
zp_get_user_zombie_classplayer ) == g_zclass_frost )
    {
        
client_printplayerprint_chat"[ZP] Press E to use frost!" )
    }
}

public 
use_cmdplayer )
{
    
    if( !
is_user_aliveplayer ) || !zp_get_user_zombieplayer ) )
        return 
PLUGIN_HANDLED
    
    
if( get_gametime( ) - gLastUseCmdplayer ] < get_pcvar_floatpcvar_cooldown ) )
    {
        
client_printplayerprint_chat"[ZP] You need to wait for %.f0 sec. to use froze again!"get_pcvar_floatpcvar_cooldown ) - ( get_gametime( ) - gLastUseCmdplayer ] ) )
        return 
PLUGIN_HANDLED
    
}
    
    
gLastUseCmdplayer ] = get_gametime( )
    
    new 
targetbody
    get_user_aiming
playertargetbodyget_pcvar_numpcvar_distance ) )
    
    if( 
is_user_alivetarget ) && !zp_get_user_zombietarget ) )
    {
        
sprite_controlplayer )
        
zp_set_user_frozentarget)
        
Bloqueado[target] = true
        set_task
get_pcvar_floatpcvar_freeze ), "unfrozen_user"target )
    }
    else
    {
        
sprite_controlplayer )
    }
    return 
PLUGIN_HANDLED
}

public 
unfrozen_usertarget )
{
    
zp_set_user_frozentarget)
    
Bloqueado[target] = false
}

public 
te_sprayargs[ ] )
{
    
message_beginMSG_BROADCAST,SVC_TEMPENTITY )
    
write_byte120 // Throws a shower of sprites or models
    
write_coordargs] ) // start pos
    
write_coordargs] )
    
write_coordargs] )
    
write_coordargs] ) // velocity
    
write_coordargs] )
    
write_coordargs] )
    
write_shortfrostsprite // spr
    
write_byte// count
    
write_byte70 // speed
    
write_byte100 //(noise)
    
write_byte// (rendermode)
    
message_end( )
    
    return 
PLUGIN_CONTINUE
}

public 
sqrtnum )
{
    new 
div num
    
new result 1
    
while( div result )
    {
        
div = ( div result ) / 2
        result 
num div
    
}
    return 
div
}

public 
sprite_controlplayer )
{
    new 
vec]
    new 
aimvec]
    new 
velocityvec]
    new 
length
    
new speed 10
    
    get_user_origin
playervec )
    
get_user_originplayeraimvec)
    
    
velocityvec] = aimvec] - vec]
    
velocityvec] = aimvec] - vec]
    
velocityvec] = aimvec] - vec]
    
length sqrtvelocityvec] * velocityvec] + velocityvec] * velocityvec] + velocityvec] * velocityvec] )
    
velocityvec] = velocityvec] * speed length
    velocityvec
] = velocityvec] * speed length
    velocityvec
] = velocityvec] * speed length
    
    
new args]
    
args] = vec]
    
args] = vec]
    
args] = vec]
    
args] = velocityvec]
    
args] = velocityvec]
    
args] = velocityvec]
    
    
set_task0.1"te_spray"0args8"a")
    
}

public 
fw_Start(iduc_handleseed)
{
    new 
button get_uc(uc_handle,UC_Buttons)
    
    if(
Bloqueado[id] && !zp_get_user_zombie(id) && (button IN_ATTACK || button IN_ATTACK2))
        
set_uc(uc_handle,UC_Buttons,(button & ~IN_ATTACK) & ~IN_ATTACK2)
    
    if(
zp_get_user_zombie(id) && (button IN_USE))
        
use_cmd(id)


And use english inside your code. I dont understand what is "Bloqueado", as I am lazy to check using translator :P

dias 09-29-2010 07:28

Re: [ZP] Class: Frost Zombie (Remake)
 
Oh Thanks :D

Excalibur.007 09-29-2010 07:33

Re: [ZP] Class: Frost Zombie (Remake)
 
Seems you uploaded the new 1 :).
Anyway, let me tell you the previous code and the new code difference.

Previous Code:
- Checks every 0.1 sec for IN_USE pressed
- Engine & FM(Bad(A lot CPU usage), only use 1 of them)
- Uses set_task.(Many natives is used, e.g. is_user_connected, is_user_alive, e.t.c)

New Code:
- Checks ONLY when a button is pressed.
- Only FM is used.
- Only get_gametime() is used

dias 09-29-2010 07:39

Re: [ZP] Class: Frost Zombie
 
Hey. 007: do you have yahoo id ?
I need your help to make some plugins for my sv

FeAr.1337 09-29-2010 07:44

Re: [ZP] Class: Frost Zombie
 
i cant compile it :D it isnt working

dias 09-29-2010 07:49

Re: [ZP] Class: Frost Zombie
 
I told you. Use new includes file and new natives zombie plague :|.
If Use Default ZombiePlague Includes and Old Natives => You can't Compile

-----------------------------------------------------------
To USE This class. You Must Use "[New Natives]Zombie Plague 4.3[v1.8]"
-> http://forums.alliedmods.net/showthread.php?t=119431
THIS IS NOT A PLUGIN. THIS IS A EDITED ZOMBIE PLAGUE 4.3 WITH NEW NATIVES
-----------------------------------------------------------


All times are GMT -4. The time now is 15:40.

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