Welcome Soldier.



[ APORTE ] Scout Revolution

Sky^^ Sin conexión
User
#1
Les dejo este código que armé hace bastante, es una Scout mejorada, dispara mas rápido, al atacar crea un efecto droga en la victima y lanza un rayo láser en cada disparo, la velocidad de disparo se cambia desde aquí:

Código PHP:
<?php 
gCvarVelocidadDisparo
= register_cvar("wd_velocidad_disparo", "0.1");

Los colores del rayo láser se configuran desde aquí:
Código PHP:
<?php 
const LaserWeapon = 0;
const
LaserWeapon1 = 255;
const
LaserWeapon2 = 255;
Son colores RGB.

Si mal no recuerdo el efecto droga funcionaba algunas veces, tal vez mas tarde mejore un poco el código y arreglo sus problemas ^^

Código:
Código PHP:
<?php 
/* ===========================================================================​================ */

#include <amxmodx>
#include <cstrike>
#include <fakemeta>
#include <fun>
#include <hamsandwich>

new const RegisterPlugin[][] = { "Weapon Drug", "1.0", "Skylar" };

/* ===========================================================================​================ */

#define weapon_drug "weapon_scout"
#define CSW_DRUG CSW_SCOUT

new bool: gWeaponDrug[33];
new
Trie:gClassSprite;
new
gLaser;
new
gCvarVelocidadDisparo;
new const
gModelWeapon[] = "models/WeaponDrug/vWeaponDrug.mdl";

const
LaserWeapon = 0;
const
LaserWeapon1 = 255;
const
LaserWeapon2 = 255;

public
plugin_precache()
{
   gClassSprite = TrieCreate();
   
   TrieSetCell
(gClassSprite, "worldspawn", 1);
   TrieSetCell(gClassSprite, "player", 1);
   
   precache_model
(gModelWeapon);
   gLaser = engfunc(EngFunc_PrecacheModel, "sprites/laserbeam.spr");
}

public
plugin_init()
{
   register_plugin(RegisterPlugin[0], RegisterPlugin[1], RegisterPlugin[2]);
   
   register_concmd
("get_drug", "SetDrug");
   
   register_event
("HLTV", "event_RoundStart", "a", "1=0", "2=0");
   
   RegisterHam
(Ham_TakeDamage, "player", "ham_TakeDamage");
   RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_scout", "ham_PrimaryAttack", 1);
   RegisterHam(Ham_TraceAttack, "worldspawn", "ham_TraceAttack", true);
   RegisterHam(Ham_TraceAttack, "player", "ham_TraceAttack", true);
   RegisterHam(Ham_Item_Deploy, weapon_drug, "ham_Item_Deploy", true);
   
   gCvarVelocidadDisparo
= register_cvar("wd_velocidad_disparo", "0.1");
}

public
client_putinserver(id) gWeaponDrug[id] = false;
public
client_disconnect(id) gWeaponDrug[id] = false;

public
SetDrug(id)
{
   if (!is_user_alive(id)) return;
   
   gWeaponDrug
[id] = true;
   give_item(id, weapon_drug);
   cs_set_user_bpammo(id, CSW_DRUG, 90);
}

public
event_RoundStart()
{
   for(new id = 1 ; id <= get_maxplayers() ; id++)
   {
       if (!is_user_connected(id)) continue;
       
       gWeaponDrug
[id] = false;
   }
}
       

public ham_TakeDamage(victim, inflictor, attacker, Float:damage, damagebits)
{
   if (attacker == victim || !is_user_connected(attacker)) return;
   if (cs_get_user_team(attacker) == cs_get_user_team(victim)) return;
   
   if
(gWeaponDrug[attacker])
       SetEffectDrug(victim);
}

public
ham_PrimaryAttack(DrugWeapon)
{
   new id = get_pdata_cbase(DrugWeapon, 41, 4);
   
   if
(!is_user_alive(id)) return HAM_IGNORED;
   
   if
(gWeaponDrug[id])
   {
       static Float:flRate;
       flRate = get_pcvar_float(gCvarVelocidadDisparo);
       
       set_pdata_float
(DrugWeapon, 46, flRate, 4)
       set_pdata_float(DrugWeapon, 47, flRate, 4);
       set_pdata_float(DrugWeapon, 48, flRate, 4);
   }
   
   return HAM_IGNORED
;
}

public
ham_TraceAttack(victim, attacker, Float:damage, Float:direction[3], tracehandle, damage_type)
{
   new gWeapon = get_user_weapon(attacker);
   new Float:vecEndPos[3];
   get_tr2(tracehandle, TR_vecEndPos, vecEndPos);
   
   if
(gWeapon == CSW_DRUG && gWeaponDrug[attacker])
   {
       engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, vecEndPos, 0);
       write_byte(TE_BEAMENTPOINT);
       engfunc(EngFunc_WriteCoord, vecEndPos[0]);
       engfunc(EngFunc_WriteCoord, vecEndPos[1]);
       engfunc(EngFunc_WriteCoord, vecEndPos[2]);
       write_short(gLaser);
       write_byte(0);
       write_byte(0);
       write_byte(1);
       write_byte(10);
       write_byte(0);
       write_byte(LaserWeapon);
       write_byte(LaserWeapon1);
       write_byte(LaserWeapon2);
       write_byte(128);
       write_byte(0);
       message_end();
   }
   
   return HAM_HANDLED
;
}

public
ham_Item_Deploy(Weapon)
{
   static gOwner; gOwner = get_weapon_ent_owner(Weapon);
   
   if
(!pev_valid(gOwner) || !is_user_alive(gOwner)) return;
   
   static gWeaponD
; gWeaponD= cs_get_weapon_id(Weapon);
   
   if
(gWeaponD == CSW_DRUG && gWeaponDrug[gOwner])
       set_pev(gOwner, pev_viewmodel2, gModelWeapon);
   else if (gWeaponD == CSW_DRUG || !gWeaponDrug[gOwner])
       return;
}

public
SetEffectDrug(id)
{
   new gWeaponD = read_data(2);
   
   if
(gWeaponD == CSW_DRUG && gWeaponDrug[id])
   {
       message_begin(MSG_ONE, get_user_msgid("ScreenFade"), _, id);
       write_short((1<<12));
       write_short(0);
       write_short(0x0000);
       write_byte(0);
       write_byte(0);
       write_byte(180);
       write_byte(200);
       message_end();
           
       new Float
:fVec[3]
       fVec[0] = random_float(50.0, 150.0);
       fVec[1] = random_float(50.0, 150.0);
       fVec[2] = random_float(50.0, 150.0);
           
       set_pev
(id, pev_punchangle, fVec);
   }
}

stock get_weapon_ent_owner( ent )
{
   if (~pev_valid(ent) & 2) return -1;
   
   return get_pdata_cbase
(ent, 41, 4);
}

El model no lo tengo, así que lo cambian ustedes v:
[Imagen: 76561198095047868.png]

Perfil de amxmodx-es: Skylar
Responder

Fury Ausente
User
#2
Buen aporte prro
+1

"El día que seas capaz de llorar de impotencia ante una injusticia, ese día seremos compañeros"
[+] 2 users say Thank You to Fury for this post
Responder

Sky^^ Sin conexión
User
#3
(07-28-2017, 05:09 PM)Fury escribió: Buen aporte prro
+1

Gracias bb
[Imagen: 76561198095047868.png]

Perfil de amxmodx-es: Skylar
Responder

Toreto :v Sin conexión
Banned
#4
(07-28-2017, 05:38 PM)lelelelelelelelele °Ushio-Z escribió: :foreveralone: Me disparo con su rasho laser  :dafuq:  :roflmao: :roflmao:
[+] 1 user says Thank You to Toreto :v for this post
Responder

Sky^^ Sin conexión
User
#5
k (?)
[Imagen: 76561198095047868.png]

Perfil de amxmodx-es: Skylar
Responder

ChrstopH Ausente
Hypnotize
#6
deberías sacar una versión zp o algo así, no le veo mucho sentido que sea solo así por cmd,.

Código PHP:
<?php 
else if (gWeaponD == CSW_DRUG || !gWeaponDrug[gOwner])
return;

khé?


aparte el r g b sacalo en cvar no todos pueden tocar el código.
podrías cachear getplayers y el screen al comenzar el plugin.

en caso de sacar versión item mandale false al morir
[Imagen: 76561198283253977.png]

Mapas Frutas 100%
DeathRun Levels 100%
Atrapa al Traidor (Edición) 100%
Battle Royale 40%
Responder

Sky^^ Sin conexión
User
#7
(07-29-2017, 02:32 AM)ChrstopH escribió: deberías sacar una versión zp o algo así, no le veo mucho sentido que sea solo así por cmd,.

Código PHP:
<?php 
else if (gWeaponD == CSW_DRUG || !gWeaponDrug[gOwner])
return;

khé?


aparte el r g b sacalo en cvar no todos pueden tocar el código.
podrías cachear getplayers y el screen al comenzar el plugin.

en caso de sacar versión item mandale false al morir
Es bastante viejo el plugin, creo que fue a principios de 2016 o 2015 cuando lo hice, tu me ayudabas a testearlo v:

Se entiende la parte del if, si tiene la scout y la variable del arma está activa tendrá el model, pero si tiene el arma y no la variable activa no tendrá el model xd
[Imagen: 76561198095047868.png]

Perfil de amxmodx-es: Skylar
Responder





Usuarios navegando en este tema:
1 invitado(s)



Sobre M X E M E X I C O

Comunidad MxE © 2020 - La mejorar comunidad de Counter Strike 1.6 .