Raised This Month: $ Target: $400
 0% 

help for improvements on a Zombie mod


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Rodolfo
Junior Member
Join Date: Sep 2009
Old 11-25-2010 , 18:24   help for improvements on a Zombie mod
Reply With Quote #1

I'm really noob on scripting.
I've learmed scripting reading the sources of these plugins posted on this site.
It was hard to understand, but with my effort i gradually understood enough to make simple plugins.

This is my most complex plugin, it compilates exelent (i really have problems about the compilation because my coding process) and "works" playing.

But the's some erros when you play the game with bots and a bug on respawn.
the error:
Click image for larger version

Name:	erro.jpg
Views:	174
Size:	95.2 KB
ID:	78005
the bug:
Click image for larger version

Name:	BUG.jpg
Views:	175
Size:	93.5 KB
ID:	78006


<removed>
zumbi.sma


Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <core>
#include <hamsandwich>
#include <engine>
#include <cstrike>
#include <fakemeta_util>

#define PLUGIN "Damage Sound"
#define VERSION "1.0"
#define AUTHOR "Rodolfo"

#define DMG_BURN		(1<<3)

new Float: player_time[32]
new g_players[33]

public plugin_init() 
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	RegisterHam(Ham_Spawn, "player", "on_spawn", 1);
	RegisterHam(Ham_IsAlive, "player", "zombie_alive", 1);
	register_event("DeathMsg", "on_kill", "b", "2!0", "3=0", "4!0")
	RegisterHam(Ham_TakeDamage, "player", "zombie_hurt",1);
	register_event("ResetHUD","light","b");
}
public plugin_precache()
{
	
	precache_sound("zumbi_mod/madness1.wav")
	precache_sound("zumbi_mod/madness2.wav")
	precache_sound("zumbi_mod/madness3.wav")
	precache_sound("zumbi_mod/madness4.wav")
	precache_sound("zumbi_mod/madness5.wav")
	precache_sound("zumbi_mod/grito1.wav")
	precache_sound("zumbi_mod/grito2.wav")
	precache_sound("zumbi_mod/grito3.wav")
	precache_sound("zumbi_mod/grito4.wav")
	precache_sound("zumbi_mod/grito5.wav")
	
	precache_model("models/player/zumbi/zumbi.mdl")
	precache_model("models/player/zumbi_queimado/zumbi_queimado.mdl")
	precache_model("models/player/vip/vip.mdl")
}
public on_spawn(id)
{
	if(is_user_alive(id) == 1 && cs_get_user_team(id) == CS_TEAM_T)
	{
		new frags = get_user_frags(id)
		
	 	set_user_health(id,200 + 100*frags)
		cs_set_user_model(id,"zumbi")
	}
	if(is_user_alive(id) == 1 && cs_get_user_team(id) == CS_TEAM_CT)
	{
		cs_set_user_model(id,"vip")
	}
}
public zombie_alive(id)
{
	new with_knife = 0
	new weapon_name
	weapon_name = get_user_weapon(id)
	
	if(is_user_alive(id) == 1 && weapon_name == CSW_KNIFE && cs_get_user_team(id) == CS_TEAM_T)
	{
		with_knife = 1
	}
	if(is_user_alive(id) == 1 && with_knife == 0 && cs_get_user_team(id) == CS_TEAM_T)
	{
		strip_user_weapons (id)
		give_item (id,"weapon_knife")
	}
	
	static Float:time
	time = get_gametime()
	
	if(is_user_alive(id) == 1 && (time - player_time[id]) > 20 && cs_get_user_team(id) == CS_TEAM_T)
	{
		new number
		number = random_num(1,5)
		player_time[id] = time
			
		if(number == 1)
		{
			emit_sound(id,CHAN_BODY,"zumbi_mod/madness1.wav",1.0,ATTN_NORM,0, PITCH_NORM)
		}
		if(number == 2)
		{
			emit_sound(id,CHAN_BODY,"zumbi_mod/madness2.wav",1.0,ATTN_NORM,0, PITCH_NORM)
		}
		if(number == 3)
		{
			emit_sound(id,CHAN_BODY,"zumbi_mod/madness3.wav",1.0,ATTN_NORM,0, PITCH_NORM)
		}
		if(number == 4)
		{
			emit_sound(id,CHAN_BODY,"zumbi_mod/madness4.wav",1.0,ATTN_NORM,0, PITCH_NORM)
		}
		if(number == 5)
		{
			emit_sound(id,CHAN_BODY,"zumbi_mod/madness5.wav",1.0,ATTN_NORM,0, PITCH_NORM)
		}
	}
}
public on_kill()
{
	new killer,health
	killer = read_data(1)
	health = get_user_health(killer)
	
	if(is_user_alive(killer) == 1 && cs_get_user_team(killer) == CS_TEAM_T)
	{
		set_user_health(killer,health + 300)
	}
}
public zombie_hurt( id, i_Inflictor, i_Attacker, Float:f_Damage, i_DamageBits )
{
	if(is_user_alive(id) == 1 && cs_get_user_team(id) == CS_TEAM_T)
	{
		new number2
		number2 = random_num(1,5)
	
		if(number2 == 1)
		{
			emit_sound(id,CHAN_BODY,"zumbi_mod/grito1.wav",1.0,ATTN_NORM,0, PITCH_NORM)
		}
		if(number2 == 2)
		{
			emit_sound(id,CHAN_BODY,"zumbi_mod/grito2.wav",1.0,ATTN_NORM,0, PITCH_NORM)
		}
		if(number2 == 3)
		{
			emit_sound(id,CHAN_BODY,"zumbi_mod/grito3.wav",1.0,ATTN_NORM,0, PITCH_NORM)
		}
		if(number2 == 4)
		{
			emit_sound(id,CHAN_BODY,"zumbi_mod/grito4.wav",1.0,ATTN_NORM,0, PITCH_NORM)
		}
		if(number2 == 5)
		{
			emit_sound(id,CHAN_BODY,"zumbi_mod/grito5.wav",1.0,ATTN_NORM,0, PITCH_NORM)
		}
		
		
		if(i_DamageBits & DMG_BURN)
		{
			cs_set_user_model(id,"zumbi_queimado")
		}
	}
}
public light(id)
{
	g_players[id] = id
	if(cs_get_user_team(id) == CS_TEAM_T)
	{
	set_task(0.1, "refreshlight", id, g_players[id], 1, "b");
	}
}
public refreshlight(data[])
{
	new id = data[0];
	if (is_user_alive(id))
	return 1;

	new origin[3];
	new ratius = (get_user_health(id)/25)
	get_user_origin(id, origin);
	new x = origin[0];
	new y = origin[1];
	new z = origin[2];
		
	emit_light(x, y, z, ratius);
	return 0
}
public emit_light(x, y, z, ratius)
{
	message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
	write_byte(TE_DLIGHT);
	write_coord(x);
	write_coord(y);
	write_coord(z);
	write_byte (ratius);
	write_byte (120);
	write_byte (0);
	write_byte (0);
	write_byte (3);
	write_byte (0);
	message_end();
}

Last edited by Rodolfo; 11-26-2010 at 10:38. Reason: Removed .amxx file
Rodolfo is offline
 



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 11:24.


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