View Single Post
spunko
Senior Member
Join Date: Jun 2005
Location: Ecuador
Old 09-30-2006 , 13:27   Re: Silver Weapons Mod
Reply With Quote #65

well.. i downloaded the two scripts.. the one in the fisrt page(Rolnaaba) and the one in this page (k007).. both compile fine but when im in game it crashes my cs.

this is what it happens, everything works fine excepts when i have the $10.000.. then i bring the menu with /silvermenu and when i buy any gun it crashes my cs inmeditely.. dunno why.. the models are in the correct folder..

Anyway i edited the code to set the damage, so now it would make more damage and log kills.. take a look at the code.. it compiles fine but i can't test it becuase of that error.. and like i said, that error comes with all the plugins in this thread..

ummm i dunno why i can't upload the .sma file.. so i have to post the code here..

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <engine>
#include <fakemeta>
#define KeysSilverWeapons (1<<0)|(1<<1)|(1<<2)|(1<<3)
new CVAR_DAMAGE // damage multiplier cvar
 
public plugin_init()    
 {   
 
//------------------------- damage multiplier stuff
 
CVAR_DAMAGE register_cvar("amx_silverdamage""2")
 
register_event"Damage""event_damage""be" )
}  
 
// event damage multiplier - i can't test it but it compiles fine
public event_damageid ) {
 
 new 
victim_id id;
 if( !
is_user_connectedvictim_id ) ) return PLUGIN_CONTINUE
 
new dmg_take read_data);
 new 
dmgtype read_data);
 new 
Float:multiplier get_pcvar_float(CVAR_DAMAGE);
 new 
Float:damage dmg_take multiplier;
 new 
health get_user_healthvictim_id );
 
 new 
iWeapIDattacker_id get_user_attackervictim_idiWeapID );
 
 if( !
is_user_connectedattacker_id ) || !is_user_alivevictim_id ) ) {
  return 
PLUGIN_HANDLED
 
}
 
 if( 
iWeapID == CSW_AK47 && hasAK[id] == true ) {
 
  if( 
floatround(damage) >= health ) {
   if( 
victim_id == attacker_id ) {
    return 
PLUGIN_CONTINUE
    
}else{
    
log_killattacker_idvictim_id"ak47");
   }
 
   return 
PLUGIN_CONTINUE
   
}else {
   if( 
victim_id == attacker_id ) return PLUGIN_CONTINUE
 
   fakedamage
victim_id"weapon_ak47"damagedmgtype );
  }
 }
 
 else if( 
iWeapID == CSW_M4A1 && hasM4[id] == true ) {
 
  if( 
floatround(damage) >= health ) {
   if( 
victim_id == attacker_id ) {
    return 
PLUGIN_CONTINUE
    
}else{
    
log_killattacker_idvictim_id"m4a1");
   }
 
   return 
PLUGIN_CONTINUE
   
}else {
   if( 
victim_id == attacker_id ) return PLUGIN_CONTINUE
 
   fakedamage
victim_id"weapon_m4a1"damagedmgtype );
  }
 }
 
 else if( 
iWeapID == CSW_MP5NAVY && hasMP[id] == true ) {
 
  if( 
floatround(damage) >= health ) {
   if( 
victim_id == attacker_id ) {
    return 
PLUGIN_CONTINUE
    
}else{
    
log_killattacker_idvictim_id"mp5navy");
   }
 
   return 
PLUGIN_CONTINUE
   
}else {
   if( 
victim_id == attacker_id ) return PLUGIN_CONTINUE
 
   fakedamage
victim_id"weapon_mp5navy"damagedmgtype );
  }
 }
 return 
PLUGIN_CONTINUE
}
// log kills for damage multiplier
stock log_kill(killervictimweapon[],headshot) {
 
user_silentkillvictim );
 
 
message_beginMSG_ALLget_user_msgid"DeathMsg" ), {0,0,0}, );
 
write_bytekiller );
 
write_bytevictim );
 
write_byteheadshot );
 
write_stringweapon );
 
message_end();
 
 new 
kfrags get_user_fragskiller );
 
set_user_fragskillerkfrags++ );
 new 
vfrags get_user_fragsvictim );
 
set_user_fragsvictimvfrags++ );
 
 return  
PLUGIN_CONTINUE

then you have to delete the lines with // in ak, m4, and mp5 funcbuy
PHP Code:
//*****{BUY AK}*****   
public funcbuyak(id)  
{   
 if(
get_pcvar_num(cvar_enabled) == 0)  
 {    
  
client_print(id,print_chat,"Silver Weapons Mod is disabled, sorry")   
  return 
PLUGIN_HANDLED   
 
}  
 else 
 {
  new 
money cs_get_user_money(id)
  new 
price get_pcvar_num(cvar_ak_cost)
  if(!
is_user_alive(id))
  {
     
client_print(idprint_chat"You can only buy Silver Weapons when alive")
  }
   else if(
hasAK[id])
  {
    
client_print(idprint_chat"You already have a silver AK")
  }
   else if(
money price)
  {
    
client_print(idprint_chat"You can't afford that, DUH!!")
  }
   else
   {
   
//new ammo, clip  
   //new damage 
   //damage = read_data(2) 
   
hasAK[id] = true
   strip_user_weapons
(id)  
   
cs_set_user_money(idmoney price)  
   
give_item(id,"weapon_ak47")
   
cs_set_user_bpammo(idCSW_AK4790)  
   
client_print(id,print_chat,"You have bought the Silver AK for %i doallars",price)  
   
/*if(get_user_weapon(id,ammo,clip) == CSW_AK47 && hasAK[id] == true)  
   {   
    damage = damage*4/3  
   }*/
  
}
 }
 return 
PLUGIN_HANDLED

__________________
spunko is offline
Send a message via MSN to spunko