[MOD] Bate Loco
#1
[MOD] Bate Loco

Descripción:
  • Es un simple y divertido mod, el objetivo es batear al equipo rival y matarlos. Cada jugador tiene un bate(knife) al golpear a un rival lo manda a volar dando el efecto de un batazo.
  • Si quieren crear mapas para el mod, simplemente deben tener vacio y/o zonas de muertes.
  • Es un mod que hice hace bastante tiempito y bueno, queria aportarlo.
Requisitos:
  • Mapas con caida y/o zonas de muerte(hay 1 solo mapa oficial del mod que lo hice como para tener uno "bl_dust_new")
Resources:
Video: Codigo:
Código PHP:
#include <amxmodx>
#include <hamsandwich>
#include <dhudmessage>
#include <cstrike>
#include <fakemeta>
#include <fun>
#include <engine>
#include <fdcc>

#define TASK_REVIVIR        3100
#define TASK_DHUDINFO         3200
//#define TASK_INVISIBILIDAD     3300
#define TASK_INMUNE         3400

new const INFOPLUGIN[3][] = { "Bate Loco""v2.0""FedeeRG4L" }

new const 
g_MdlBate[][] =

    
"models/realg4life/p_bate_loco.mdl",
    
"models/realg4life/v_bate_loco.mdl"
}

new const 
g_MdlHats[][] =

    
"models/realg4life/hats/gorra_tt.mdl",
    
"models/realg4life/hats/gorra_ct.mdl"
}

new const 
g_MdlPlayers[][] =
{
    
"models/player/bateador_tt/bateador_tt.mdl",
    
"models/player/bateador_ct/bateador_ct.mdl"
}

new const 
g_ComandosBloquear[][] =
{
    
"coverme""takepoint""holdpos""regroup""followme""takingfire""radio1""radio2""radio3""radio4",
    
"go""fallback""sticktog""getinpos""stormfront""report""vote""roger""enemyspot""needbackup"
    
"sectorclear""inposition""reportingin""getout""negative""enemydown""usp""glock""deagle""p228"
    
"elites""fn57""m3""xm1014""mp5""tmp""p90""mac10""ump45""ak47","galil""famas""sg552""m4a1"
    
"aug""scout""awp""g3sg1""sg550""m249""vest""vesthelm""flash""hegren""sgren""defuser""nvgs"
    
"shield""primammo""secammo""km45""9x19mm""nighthawk""228compact""12gauge""autoshotgun""smg""mp"
    
"c90""cv47""defender""clarion""krieg552""bullpup""magnum""d3au1""krieg550""buyammo1""buyammo2"
};

new const 
g_DeleteEntity[][] = 
{
    
"armoury_entity",
    
"func_bomb_target",
    
"func_vip_safetyzone"
    
"func_escapezone",
    
"func_hostage_rescue",
    
"func_tank"
    
"func_tankmortar",
    
"info_bomb_target"
    
"info_vip_start",
    
"info_hostage_rescue",
    
"game_player_equip",
    
"hostage_entity"
    
"monster_scientist",  
    
"player_weaponstrip"
    
"trigger_camera"
};

new const 
PREFIXBL[] = "^4[^3BateLoco^4]^1"
new g_Bateado[33]
new 
g_EntHat[33]

enum _:DATOS_ALL
{
    
VIDAS
}

new 
g_Datos[33][DATOS_ALL];

new 
g_RondaFinish
new g_ConteoRevivir[33]
new 
g_ConteoInmunidad[33]
new 
g_MaxPlayers
new gp_CvarNoKillNoName
new bool:g_PlayerInmune[33]

new 
g_RoundWinT
new g_RoundWinCT

public plugin_init()
{
    
register_plugin(INFOPLUGIN[0], INFOPLUGIN[1], INFOPLUGIN[2])

    
RegisterHam(Ham_Killed"player""Forward_PlayerKilled" );
    
RegisterHam(Ham_TraceAttack"player""Forward_PlayerTraceAttack")
    
RegisterHam(Ham_Spawn"player""Forward_PlayerSpawn"1)

    
register_event("CurWeapon""Current_Weapon""be""1=1""2=29")
    
register_event("Money""Evento_Money""b");
    
register_event ("SendAudio" "Evento_RoundWinT" "a" "2&%!MRAD_terwin");
    
register_event ("SendAudio" "Evento_RoundWinCT" "a" "2&%!MRAD_ctwin");

    
register_logevent("EventRoundStart"2"0=World triggered""1=Round_Start")
    
register_logevent("EventRoundEnd"2"1=Round_End")

    
register_touch("weaponbox""player""Block_Pickear_Armas");

    
register_forward(FM_ClientKill"Forward_ClientKill")

    for(new 
0sizeof(g_ComandosBloquear); i++)
        
register_clcmd(g_ComandosBloquear[i], "Cmd_Block");

    
gp_CvarNoKillNoName register_cvar("bl_nokill_noname""1")

    
g_MaxPlayers get_maxplayers()

    new 
Entity = -1

    while ( ( 
Entity find_ent_by_classEntity"armoury_entity" ) ) ) 
    { 
        
remove_entityEntity ); 
    }
}

public 
plugin_precache()
{
    static 
i
    
    
for(0sizeof(g_MdlBate); i++)
        
precache_model(g_MdlBate[i])

    for(
0sizeof(g_MdlPlayers); i++)
        
precache_model(g_MdlPlayers[i])

    for(
0sizeof(g_MdlHats); i++)
        
precache_model(g_MdlHats[i])
}

public 
client_putinserver(id)
{
    
g_Datos[id][VIDAS] = 2
    set_task
(5.0"DhudInfo"id+TASK_DHUDINFO,_,_"b")
}

public 
client_disconnect(id)
{
    if(
pev_valid(g_EntHat[id]))
    {
        
engfunc(EngFunc_RemoveEntityg_EntHat[id]);
    }

    
g_PlayerInmune[id] = false
    
    remove_task
(id TASK_REVIVIR)
    
remove_task(id TASK_DHUDINFO)
    
remove_task(id)
}

public 
Forward_PlayerKilled(VictimaAtacanteshouldgib)
{
    if(!
is_user_connected(Atacante) && g_Bateado[Victima])
    {
        static 
Nombre_Atacante[32], Nombre_Victima[32]

        
get_user_name(g_Bateado[Victima], Nombre_Atacantecharsmax(Nombre_Atacante))
        
get_user_name(VictimaNombre_Victimacharsmax(Nombre_Victima))

        
SetHamParamEntity(2g_Bateado[Victima]);
        
FDCC(g_Bateado[Victima], TEAM_COLOR"%s Mataste a ^4%s ^1de un bataso."PREFIXBLNombre_Victima)
        
FDCC(VictimaTEAM_COLOR"%s El bateador ^4%s ^1te ha matado de un bataso."PREFIXBLNombre_Atacante)
    }

    
set_task(1.0"RevivirPlayer"Victima+TASK_REVIVIR__"b")

    
g_ConteoRevivir[Victima] = 5
    g_Bateado
[Victima] = false;
}

public 
EventRoundStart()
{
    
g_RondaFinish 0

    
for(new id 1id <= g_MaxPlayersid++)
    {
    
//    if(!is_user_alive(id)) 
    //        return;
            
        
g_Datos[id][VIDAS] = 2
        
//FDCC(id, TEAM_COLOR, "%s Tenes 2 vidas.", PREFIXBL)
    
}
}

public 
EventRoundEnd()
{
    for(new 
id 1id <= g_MaxPlayersid++)
    {
    
//    if(!is_user_alive(id)) 
    //        return;
            
        
g_Datos[id][VIDAS] = 2
        
//FDCC(id, TEAM_COLOR, "%s Tenes 2 vidas.", PREFIXBL)
    
}

    
g_RondaFinish 1
}

public 
Evento_RoundWinT()
{
    
g_RoundWinT++
}

public 
Evento_RoundWinCT()
{
    
g_RoundWinCT++
}

public 
RevivirPlayer(id)
{            
    
id -= TASK_REVIVIR
    
    
if(g_RondaFinish)
        return 
PLUGIN_HANDLED
    
    
if(g_Datos[id][VIDAS] == 0)
    {
        
FDCC(idTEAM_COLOR"%s Ya no podras ser revivido, No tienes vidas."PREFIXBL)
        
remove_task(id+TASK_REVIVIR)
        return 
PLUGIN_HANDLED
    
}
    
    
g_ConteoRevivir[id]--
    
    
set_hudmessage(02550, -1.0, -1.003.01.0)
    
show_hudmessage(id"Seras revivido en %d segundos"g_ConteoRevivir[id])

    if(!
g_ConteoRevivir[id])
    {
        static 
szRedszGreenszBlue

        
switch(get_user_team(id))
        {
            case 
1szRed 250,     szGreen 20,     szBlue 10
            
case 2szRed 10,     szGreen 20,     szBlue 250
        
}

        
g_Datos[id][VIDAS] -= 1
            
        FDCC
(idTEAM_COLOR"%s Fuiste Revivido, Tenes una vida menos."PREFIXBL)
        
g_PlayerInmune[id] = true
        ExecuteHamB
(Ham_CS_RoundRespawnid);
        
ScreenFade(id5.0szRedszGreenszBlue120)
        
set_task(1.0"PlayerInmune"id+TASK_INMUNE__"b")
        
set_user_rendering(idkRenderFxGlowShellszRedszGreenszBluekRenderTransAlpha20)
        
g_ConteoInmunidad[id] = 5
        g_ConteoRevivir
[id] = 0
        set_user_godmode
(id1)
        
        
remove_task(id+TASK_REVIVIR)
    
        return 
PLUGIN_HANDLED
    
}

    return 
PLUGIN_HANDLED
}

public 
PlayerInmune(id)
{
    
id -= TASK_INMUNE
    
    g_ConteoInmunidad
[id]--
    
    
set_hudmessage(02550, -1.0, -1.003.01.0)
    
show_hudmessage(id"Tu inmunidad termina en %d segundos"g_ConteoInmunidad[id])
    
    if(!
g_ConteoInmunidad[id])
    {
        
set_hudmessage(02550, -1.0, -1.003.01.0)
        
show_hudmessage(id"TU INMUNIDAD SE ACABO")
        
set_user_godmode(id0)
        
set_user_rendering(id)
        
give_item(id "weapon_knife")
        
g_PlayerInmune[id] = false
        remove_task
(id+TASK_INMUNE)
        
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_HANDLED
}

public 
Evento_Money(id)
{
    
set_pdata_int(id1150);
        
    
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("Money"), _id);
    
write_long(0);
    
write_byte(1); 
    
message_end();
}

public 
DhudInfo(id
{
    
id -= TASK_DHUDINFO
    
    
static Name_Spect[32];
    
    new 
Spect
    
    
if(!is_user_alive(id))
    {
        
Spect pev(idpev_iuser2);
        
get_user_name(SpectName_Spectcharsmax(Name_Spect))
        
        if(!
Spect)
        {
            
set_dhudmessage(255255250, -1.00.0418.00.85.0);
            
show_dhudmessage (id"BATE LOCO")

            
set_dhudmessage(2502000, -1.00.1018.00.85.0);
            
show_dhudmessage (id"ANTI-TERRORISTAS [ %d ] | [ %d ] TERRORISTAS^n[ VIDAS: %d/2 ]"g_RoundWinCTg_RoundWinTg_Datos[id][VIDAS]);
        }
        else
        {
            
set_dhudmessage(255255250, -1.00.1418.00.85.0);
            
show_dhudmessage (id"BATE LOCO^nEspecteando a JUGADOR: %s"Name_Spect)

            
set_dhudmessage(2502000, -1.00.2218.00.85.0);
            
show_dhudmessage (id"ANTI-TERRORISTAS [ %d ] | [ %d ] TERRORISTAS^n[ VIDAS: %d/2 ]"g_RoundWinCTg_RoundWinTg_Datos[Spect][VIDAS]);
        }
    }
    else
    {
        
set_dhudmessage(255255250, -1.00.0418.00.85.0);
        
show_dhudmessage (id"BATE LOCO")

        
set_dhudmessage(2502000, -1.00.1018.00.85.0);
        
show_dhudmessage (id"ANTI-TERRORISTAS [ %d ] | [ %d ] TERRORISTAS^n[ VIDAS: %d/2 ]"g_RoundWinCTg_RoundWinTg_Datos[id][VIDAS]);
    }
    return 
PLUGIN_HANDLED
}

public 
Forward_UserInfoChanged(id,buffer
{    
    if(!
is_user_connected(id))
        return 
FMRES_IGNORED;
    
    new 
name[32];
    new 
newname[32];
    
    
get_user_name(idnamecharsmax(name));
    
engfunc(EngFunc_InfoKeyValuebuffer"name"newnamecharsmax(newname));
    
    if(
get_pcvar_num(gp_CvarNoKillNoName))
    {
        if(!
equal(name,newname))
        {
            
engfunc(EngFunc_SetClientKeyValueidbuffer"name"name);
            
client_cmd(id"name ^"%s^""name);
            
            
FDCC(idTEAM_COLOR"%s El cambio de tag esta deshabilitado."PREFIXBL);
            return 
FMRES_IGNORED;
        }
    }
    return 
FMRES_IGNORED;
}

public 
Forward_ClientKill(id)
{
    if(!
is_user_alive(id))
        return 
FMRES_IGNORED

    
if(get_pcvar_num(gp_CvarNoKillNoName))
    {
        
FDCC(idTEAM_COLOR"%s No podes suicidarte en estos momentos"PREFIXBL)
        return 
FMRES_SUPERCEDE
    
}
    return 
FMRES_IGNORED;
}

public 
Forward_PlayerTraceAttack(VictimaAtacantefloat:damageFloat:direction[3], tracebits)
{
    if(!
is_user_alive(Atacante) || g_PlayerInmune[Victima])
    {
        return 
HAM_IGNORED;
    }

    static 
Team_ATeam_V

    Team_A 
get_user_team(Atacante)
    
Team_V get_user_team(Victima)

    if(
Team_A == && Team_V == || Team_A == && Team_V == 2)
    {
        return 
HAM_IGNORED;
    }

    new 
Float:push[3], Float:velocity[3];
    
entity_get_vector(VictimaEV_VEC_velocityvelocity)
    
create_velocity_vector(VictimaAtacantepush);
    
push[0] += velocity[0];
    
push[1] += velocity[1];
    
entity_set_vector(VictimaEV_VEC_velocitypush);
    
g_Bateado[Victima] = Atacante;

    return 
HAM_SUPERCEDE;
}

public 
Forward_PlayerSpawn(id)
{
    if(!
is_user_alive(id))
        return 
HAM_IGNORED

    strip_user_weapons
(id)

    
g_ConteoRevivir[id] = 0
    
    
if(!g_PlayerInmune[id])
    {
        static 
szRedszGreenszBlue

        
switch(get_user_team(id))
        {
            case 
1szRed 250,     szGreen 20,     szBlue 10
            
case 2szRed 10,     szGreen 20,     szBlue 250
        
}

        
//strip_user_weapons(id)
        
set_task(1.0"PlayerInmune"id+TASK_INMUNE__"b")
        
ScreenFade(id6.0szRedszGreenszBlue120)
        
set_user_rendering(idkRenderFxGlowShellszRedszGreenszBluekRenderTransAlpha20)
        
g_ConteoInmunidad[id] = 6
        set_user_godmode
(id1)
        
remove_task(id+TASK_REVIVIR)
    }
    else
    {
        
//strip_user_weapons(id)
        
give_item(id "weapon_knife")
        
remove_task(id+TASK_REVIVIR)
    }

    switch(
get_user_team(id))
    {
        case 
1:
        {
            
cs_set_user_model(id"bateador_tt")

            if(
pev_valid(g_EntHat[id]))
            {
                
engfunc(EngFunc_RemoveEntityg_EntHat[id]);
            }

            
g_EntHat[id] = engfunc(EngFunc_CreateNamedEntity,  engfunc(EngFunc_AllocString"info_target"));
                
            
            set_pev
(g_EntHat[id], pev_movetypeMOVETYPE_FOLLOW);
            
set_pev(g_EntHat[id], pev_aimentid);
            
engfunc(EngFunc_SetModelg_EntHat[id], g_MdlHats[0]);
        }
        case 
2:
        {
            
cs_set_user_model(id"bateador_ct")

            if(
pev_valid(g_EntHat[id]))
            {
                
engfunc(EngFunc_RemoveEntityg_EntHat[id]);
            }

            
g_EntHat[id] = engfunc(EngFunc_CreateNamedEntity,  engfunc(EngFunc_AllocString"info_target"));
                
            
            set_pev
(g_EntHat[id], pev_movetypeMOVETYPE_FOLLOW);
            
set_pev(g_EntHat[id], pev_aimentid);
            
engfunc(EngFunc_SetModelg_EntHat[id], g_MdlHats[1]);
        }
    }

    switch(
random_num(015))
    {
        case 
3912:
        {
            
FDCC(idTEAM_COLOR"%s MiniMOD ^4BATE LOCO^1 creado por: ^4%s ^1- version: ^4%s^1."PREFIXBLINFOPLUGIN[2], INFOPLUGIN[1])
        }
    }
    return 
HAM_IGNORED 
}

public 
Current_Weapon(id)
{
    if(!
is_user_alive(id))
        return 
PLUGIN_CONTINUE
        
    
if(get_user_weapon(id) == CSW_KNIFE )
    {
        
set_pev(idpev_viewmodel2g_MdlBate[1])
        
set_pev(idpev_weaponmodel2g_MdlBate[0])
    }

    return 
PLUGIN_CONTINUE
}

public 
Block_Pickear_Armas(wpnid)
{
    return 
PLUGIN_HANDLED;
}

public 
pfn_spawn(ent)
{
    if(!
is_valid_ent(ent))
        return 
PLUGIN_CONTINUE;

    static 
classname[32];
    
entity_get_string(entEV_SZ_classnameclassnamecharsmax(classname));

    for(new 
0sizeof(g_DeleteEntity); i++)
    {
        if(
equal(classnameg_DeleteEntity[i]))
        {
            
remove_entity(ent);
            return 
PLUGIN_HANDLED;
        }
    }

    return 
PLUGIN_CONTINUE;
}

public 
Cmd_Block(id)
{
    return 
PLUGIN_HANDLED;
}

stock create_velocity_vector(victimattackerFloat:velocity[3])
{
    if(!
is_user_alive(victim) || !is_user_alive(attacker))
        return 
0;

    new 
Float:vicorigin[3];
    new 
Float:attorigin[3];
    
entity_get_vector(victim   EV_VEC_origin vicorigin);
    
entity_get_vector(attacker EV_VEC_origin attorigin);

    new 
Float:origin2[3];
    
origin2[0] = vicorigin[0] - attorigin[0];
    
origin2[1] = vicorigin[1] - attorigin[1];

    new 
Float:largestnum 0.0;

    if(
floatabs(origin2[0]) > largestnum)
        
largestnum floatabs(origin2[0]);
    if(
floatabs(origin2[1]) > largestnum)
        
largestnum floatabs(origin2[1]);

    
origin2[0] /= largestnum;
    
origin2[1] /= largestnum;

    
velocity[0] = ( origin2[0] * (100.0 3000) ) / entity_range(victimattacker);
    
velocity[1] = ( origin2[1] * (100.0 3000) ) / entity_range(victimattacker);
    if(
velocity[0] <= 20.0 || velocity[1] <= 20.0)
        
velocity[2] = random_float(400.0575.0);

    return 
1;
}

stock ScreenFade(plrFloat:fDurationredgreenbluealpha)
{
    new 
plr plr get_maxplayers();
    if( !
)
    {
        return 
0;
    }
    
    message_begin
(plr MSG_ONE MSG_ALLget_user_msgid"ScreenFade"), {000}, plr);
    
write_short(floatround(4096.0 fDurationfloatround_round));
    
write_short(floatround(4096.0 fDurationfloatround_round));
    
write_short(4096);
    
write_byte(red);
    
write_byte(green);
    
write_byte(blue);
    
write_byte(alpha);
    
message_end();
    
    
return 1;

Responder
#2
¡Muy Divertido!
Responder
#3
Se ve bastante lindo
“Quien te quiere en su vida, volverá a buscarte”
Qué frase más estúpida
Porque quien te quiere en su vida, jamás se iría.
Responder
#4
Lindo aporte. Mario
Cita:Cruzadas incompletas en penínsulas desiertas. Feel like a sir
Responder


Salto de foro:


Usuarios navegando en este tema: 1 invitado(s)