Raised This Month: $ Target: $400
 0% 

Anyone familiar with WeaponMod ?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
KingCommentor
Senior Member
Join Date: Jan 2008
Location: Floridaaaa
Old 08-02-2008 , 00:11   Anyone familiar with WeaponMod ?
Reply With Quote #1

I installed WeaponMod on my server the other day and now I've added a few addon weapons, but some of the weapon don't shoot "through" the walls or break "breakable things such as vent openings.. what can I do to change this ?

Like this weapon here, a "Laser", also it seems to have unlimited ammo, the 2nd ammo doesn't even get takena way from, once the first 100 drains to 0, it just couns back up to 100 and then down again .. can these features be changed?

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <weaponmod>
new const PLUGIN[] = "WPN Laser"
new const VERSION[] = "0.7"
new const AUTHOR[] = "DevconeS/World Crafter"
new WPN_NAME[] = "Concentrated Light Amplifier"
new WPN_SHORT[] = "lasergun"
new P_MODEL[] = "models/p_laser.mdl"
new V_MODEL[] = "models/v_laser.mdl"
new W_MODEL[] = "models/w_laser.mdl"
new SOUND_RUN[] = "weapons/laser_fire.wav"
#define LOAD_UP_TIME 0.01
#define SHUT_DOWN_TIME 0.1
#define SHOOT_LENGTH 2.0
// Sequences
enum
{
 
anim_idle,
 
anim_fire,
 
anim_reload,
 
anim_draw
}
// Types
enum
{
 
act_none,
 
act_load_up,
 
act_run
}
new 
g_wpnid
new Float:g_lastShot[33]
new 
Float:g_nextSound[33]
new 
g_plAction[33]
new 
g_MaxPlayers
new laser
new blood
new bloodspray
public plugin_precache() {
 
precache_model(P_MODEL)
 
precache_model(V_MODEL)
 
precache_model(W_MODEL)
 
precache_sound(SOUND_RUN)
 
laser precache_model("sprites/laserbeam.spr")
 
blood precache_model("sprites/blood.spr")
 
bloodspray precache_model("sprites/bloodspray.spr")
}
public 
plugin_init() {
 
register_plugin(PLUGIN,VERSION,AUTHOR)
 
 
register_forward(FM_Think,"fwd_Think")
 
register_forward(FM_Touch,"fwd_Touch")
 
register_forward(FM_StartFrame,"fwd_StartFrame")
 
 
g_MaxPlayers get_maxplayers()
 
 
create_weapon()
}
create_weapon() {
 new 
wpnid wpn_register_weapon(WPN_NAME,WPN_SHORT)
 if(
wpnid == -1) return PLUGIN_CONTINUE
 
 wpn_set_string
(wpnid,wpn_viewmodel,V_MODEL)
 
wpn_set_string(wpnid,wpn_weaponmodel,P_MODEL)
 
wpn_set_string(wpnid,wpn_worldmodel,W_MODEL)
 
 
wpn_register_event(wpnid,event_attack1,"ev_attack1")
 
wpn_register_event(wpnid,event_reload,"ev_reload")
 
wpn_register_event(wpnid,event_draw,"ev_draw")
 
 
wpn_set_float(wpnid,wpn_refire_rate1,0.025)
 
wpn_set_float(wpnid,wpn_reload_time,2.3)
 
wpn_set_float(wpnid,wpn_recoil1,1.0)
 
wpn_set_float(wpnid,wpn_run_speed,250.0)
 
 
wpn_set_integer(wpnid,wpn_ammo1,125// Here are the ammo for the weapon
 
wpn_set_integer(wpnid,wpn_ammo2,250// but when this amount it used up it just reloads, or starts counting up
 
wpn_set_integer(wpnid,wpn_bullets_per_shot1,1)
 
wpn_set_integer(wpnid,wpn_bullets_per_shot2,0)
 
wpn_set_integer(wpnid,wpn_cost,7000)
 
 
g_wpnid wpnid
 
return PLUGIN_CONTINUE
}
public 
ev_reload(id)
 
wpn_playanim(id,anim_reload)
public 
ev_draw(id)
 
wpn_playanim(id,anim_draw)
public 
ev_attack1(id) {
 
//wpn_playanim(id,anim_fire)
 
new Float:gtime get_gametime()
 
g_lastShot[id] = gtime
 
 
if(g_nextSound[id] <= gtime) {
  new 
usrwpn wpn_has_weapon(id,g_wpnid)
  switch(
g_plAction[id]) {
   case 
act_none: {
    
g_nextSound[id] = gtime+LOAD_UP_TIME
    g_plAction
[id] = act_load_up
 
    
// No flame was shot, so don't decrease ammo :)
    
wpn_set_userinfo(id,usr_wpn_ammo1,usrwpn,wpn_get_userinfo(id,usr_wpn_ammo1,usrwpn)+1)
    return 
PLUGIN_CONTINUE
   
}
   case 
act_load_up: {
    
emit_sound(id,CHAN_WEAPON,SOUND_RUN,0.8,ATTN_NORM,0,PITCH_NORM)
    
wpn_playanim(id,anim_fire)
    
g_nextSound[id] = gtime
    g_plAction
[id] = act_run
 
    
// No flame was shot, so don't decrease ammo :)
    
wpn_set_userinfo(id,usr_wpn_ammo1,usrwpn,wpn_get_userinfo(id,usr_wpn_ammo1,usrwpn)+1)
    return 
PLUGIN_CONTINUE
   
}
  }
 }
 
 new 
aimvec[3]
 
get_user_origin(id,aimvec,3)
 
 
message_beginMSG_BROADCAST,SVC_TEMPENTITY)
 
write_byte (TE_BEAMENTPOINT)     //TE_BEAMENTPOINTS 0
 
write_short(id 0x1000)
 
write_coord(aimvec[0])
 
write_coord(aimvec[1])
 
write_coord(aimvec[2])
 
write_short(laser)
 
write_byte// framestart
 
write_byte// framerate
 
write_byte// life
 
write_byte10 // width
 
write_byte// noise
 
write_byte250 // r, g, b
 
write_byte// r, g, b
 
write_byte// r, g, b
 
write_byte200 // brightness
 
write_byte200 // speed
 
message_end()
 
 
message_beginMSG_PVSSVC_TEMPENTITY)
 
write_byte)
 
write_coordaimvec[0] )
 
write_coordaimvec[1] )
 
write_coordaimvec[2] )
 
message_end()
 
 
 new 
FFOn get_cvar_num("mp_friendlyfire")
 new 
tid,tbody
 
 get_user_aiming
(id,tidtbody)
 if( 
is_user_alive(tid) && ( FFOn || get_user_team(id) != get_user_team(tid) ) ) {
  
wpn_damage_user(g_wpnid,tid,id,0,random_num(7,10),DMG_ENERGYBEAM)
  
message_begin(MSG_BROADCAST,SVC_TEMPENTITY
  
write_byte(TE_BLOODSPRITE)
  
write_coord(aimvec[0]) 
  
write_coord(aimvec[1]) 
  
write_coord(aimvec[2]) 
  
write_short(bloodspray)
  
write_short(blood)
  
write_byte(70)
  
write_byte(random_num(7,10))
  
message_end()
 }
 
 new 
decal random_num(41,44)
 
 if (
tid){
  
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
  
write_byte(TE_DECAL)
  
write_coord(aimvec[0])
  
write_coord(aimvec[1])
  
write_coord(aimvec[2])
  
write_byte(decal)
  
write_short(tid)
  
message_end()
 }else{ 
  
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
  
write_byte(TE_WORLDDECAL)
  
write_coord(aimvec[0])
  
write_coord(aimvec[1])
  
write_coord(aimvec[2])
  
write_byte(decal)
  
message_end()
 }
 
 return 
PLUGIN_CONTINUE
}
public 
fwd_StartFrame() {
 static 
Float:gtime
 
static pwpn
 gtime 
get_gametime()
 
 for(new 
id 1id g_MaxPlayersid++) {
  if(
g_plAction[id] != act_none) {
   
pwpn wpn_has_weapon(id,g_wpnid)
   if((!(
pev(id,pev_button) & IN_ATTACK) && g_lastShot[id]+0.2 gtime)  || (pwpn == -1)) {
    
emit_sound(id,CHAN_WEAPON,SOUND_RUN,0.8,ATTN_NORM,SND_STOP,PITCH_NORM)
    
wpn_playanim(id,anim_idle)
    
g_plAction[id] = act_none
   
}
  }
 }

Is it possible to add "Same team colors" on the trail to this RPG Weapon for WeaponMod ?

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <weaponmod>
new PLUGIN[] = "WPN RPG"
new VERSION[] = "0.1"
new AUTHOR[] = "DevconeS(Edited by Humming Bird)"
new WPN_NAME[] = "RPG"
new WPN_SHORT[] = "rpg"
new P_MODEL[] = "models/p_rpg.mdl"
new V_MODEL[] = "models/v_rpg.mdl"
new W_MODEL[] = "models/w_rpg.mdl"
new ROCKET_MDL[] = "models/rpgrocket.mdl"
new ROCKET_SOUND[] = "weapons/rocketfire1.wav"
#define ROCKET_SPEED 1400
#define ROCKET_RADIUS 270.0
#define ROCKET_DAMAGE 200.0
// Sequences
enum
{
 
anim_idle1,
 
anim_fidget1,
 
anim_altfireon,
 
anim_altfirecycle,
 
anim_altfireoff,
 
anim_fire1,
 
anim_fire2,
 
anim_fire3,
 
anim_fire4,
 
anim_draw,
 
anim_holster
}
new 
g_wpnid
new g_trail,g_explosion
public plugin_precache() {
 
precache_model(P_MODEL)
 
precache_model(V_MODEL)
 
precache_model(W_MODEL)
 
 
precache_model(ROCKET_MDL)
 
precache_sound(ROCKET_SOUND)
 
 
g_trail precache_model("sprites/smoke.spr")
 
g_explosion precache_model("sprites/zerogxplode.spr")
}
public 
plugin_init() {
 
register_plugin(PLUGIN,VERSION,AUTHOR)
 
 
register_forward(FM_Touch,"fwd_Touch")
 
 
create_weapon()
}
create_weapon() {
 new 
wpnid wpn_register_weapon(WPN_NAME,WPN_SHORT)
 if(
wpnid == -1) return PLUGIN_CONTINUE
 
 wpn_set_string
(wpnid,wpn_viewmodel,V_MODEL)
 
wpn_set_string(wpnid,wpn_weaponmodel,P_MODEL)
 
wpn_set_string(wpnid,wpn_worldmodel,W_MODEL)
 
 
wpn_register_event(wpnid,event_attack1,"ev_attack1")
 
wpn_register_event(wpnid,event_draw,"ev_draw")
 
 
wpn_set_float(wpnid,wpn_refire_rate1,1.0)
 
wpn_set_float(wpnid,wpn_reload_time,2.0)
 
wpn_set_float(wpnid,wpn_recoil1,4.0)
 
wpn_set_float(wpnid,wpn_run_speed,210.0)
 
 
wpn_set_integer(wpnid,wpn_ammo1,5)
 
wpn_set_integer(wpnid,wpn_ammo2,0)
 
wpn_set_integer(wpnid,wpn_bullets_per_shot1,1)
 
wpn_set_integer(wpnid,wpn_cost,6000)
 
 
g_wpnid wpnid
 
return PLUGIN_CONTINUE
}
// vector_to_angle port
stock vec_to_angle(Float:vector[3],Float:output[3]) {
 new 
Float:angles[3]
 
engfunc(EngFunc_VecToAnglesvectorangles)
 
output[0] = angles[0]
 
output[1] = angles[1]
 
output[2] = angles[2]
}
public 
ev_attack1(id) {
 
wpn_playanim(id,random_num(anim_fire3,anim_fire4))
 
 new 
rocket engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"info_target"))
 if(!
rocket) return PLUGIN_CONTINUE
 
 
// Strings
 
set_pev(rocket,pev_classname,"wpn_rpg")
 
engfunc(EngFunc_SetModel,rocket,ROCKET_MDL)
 
 
// Integer
 
set_pev(rocket,pev_owner,id)
 
set_pev(rocket,pev_movetype,MOVETYPE_FLY)
 
set_pev(rocket,pev_solid,SOLID_BBOX)
 
 
// Floats
 
set_pev(rocket,pev_mins,Float:{-1.0,-1.0,-1.0})
 
set_pev(rocket,pev_maxs,Float:{1.0,1.0,1.0})
 
 new 
Float:fStart[3]
 
wpn_projectile_startpos(id,40,0,0,fStart)
 
set_pev(rocket,pev_origin,fStart)
 
 new 
Float:fVel[3]
 
velocity_by_aim(id,ROCKET_SPEED,fVel)  
 
set_pev(rocket,pev_velocity,fVel)
 
 new 
Float:fAngles[3]
 
vec_to_angle(fVel,fAngles)
 
set_pev(rocket,pev_angles,fAngles)
 
 
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
 
write_byte(TE_BEAMFOLLOW)
 
write_short(rocket)
 
write_short(g_trail)
 
write_byte(25)
 
write_byte(5)
 
write_byte(224)
 
write_byte(224)
 
write_byte(255)
 
write_byte(255)
 
message_end()
 
 
emit_sound(rocketCHAN_WEAPONROCKET_SOUND1.0ATTN_NORM0PITCH_NORM)
 
 return 
PLUGIN_CONTINUE
}
public 
ev_draw(id)
 
wpn_playanim(id,anim_draw)
public 
fwd_Touch(ptrptd) {
 if(
pev_valid(ptr)) {
  new 
classname[32]
  
pev(ptr,pev_classname,classname,31)
 
  if(
equal(classname,"wpn_rpg")) {
   new 
Float:fOrigin[3],iOrigin[3]
   
pev(ptr,pev_origin,fOrigin)
 
   
iOrigin[0] = floatround(fOrigin[0])
   
iOrigin[1] = floatround(fOrigin[1])
   
iOrigin[2] = floatround(fOrigin[2])
 
   
message_begin(MSG_BROADCAST,SVC_TEMPENTITY,iOrigin)
   
write_byte(TE_EXPLOSION)
   
write_coord(iOrigin[0])
   
write_coord(iOrigin[1])
   
write_coord(iOrigin[2])
   
write_short(g_explosion)
   
write_byte(30)
   
write_byte(15)
   
write_byte(0)
   
message_end()
 
   new 
attacker pev(ptr,pev_owner)
   
wpn_radius_damage(g_wpnid,attacker,ptr,ROCKET_RADIUS,ROCKET_DAMAGE,DMG_BLAST// This is line 178
   
if(pev_valid(ptd)) {
    
pev(ptd,pev_classname,classname,31)
 
    if(
equal(classname,"func_breakable"))
     
dllfunc(DLLFunc_Use,ptd,ptr)
   }
   
set_pev(ptr,pev_flags,FL_KILLME)
  }
 } 
As seen in this one,
http://forums.alliedmods.net/showthread.php?p=178286
__________________
+Karma is appreciated! |Be PROUD, leave your name!

Last edited by KingCommentor; 08-02-2008 at 00:31.
KingCommentor is offline
Send a message via AIM to KingCommentor
 



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 05:39.


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