AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   help for improvements on a Zombie mod (https://forums.alliedmods.net/showthread.php?t=143849)

Rodolfo 11-25-2010 18:24

help for improvements on a Zombie mod
 
3 Attachment(s)
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:
Attachment 78005
the bug:
Attachment 78006


<removed>
Attachment 78007


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();
}


Exolent[jNr] 11-26-2010 00:53

Re: help for improvements on a Zombie mod
 
You are not allowed to post .amxx files.

Rodolfo 11-26-2010 10:33

Re: help for improvements on a Zombie mod
 
Quote:

Originally Posted by Exolent[jNr] (Post 1356827)
You are not allowed to post .amxx files.

So can you help me fix those problems?


All times are GMT -4. The time now is 11:24.

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