AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   if you chaose sword1 you have sword1 damage (https://forums.alliedmods.net/showthread.php?t=108849)

~Ice*shOt 11-10-2009 09:09

if you chaose sword1 you have sword1 damage
 
Topic^

PHP Code:

#include <amxmodx>
#include <hamsandwich>
new damage_sword1damage_sword2damage_sword3damage_sword4
new g_MaxPlayers
public plugin_init()
{
 
register_plugin("Fable TLC Mod Shop""1.0""Frostas")
 
register_clcmd("say shop""ShopSystem")
 
damage_sword1 register_cvar("damage_sword1""3.0")
 
damage_sword2 register_cvar("damage_sword2""4.0")
 
damage_sword3 register_cvar("damage_sword3""5.0")
 
damage_sword4 register_cvar("damage_sword4""6.0")
 
RegisterHam(Ham_TakeDamage"player""Ham_DamageSword1");
 
RegisterHam(Ham_TakeDamage"player""Ham_DamageSword2");
 
RegisterHam(Ham_TakeDamage"player""Ham_DamageSword3");
 
RegisterHam(Ham_TakeDamage"player""Ham_DamageSword4");
 
g_MaxPlayers get_maxplayers()
}
public 
Ham_DamageSword1(idinflictorattackerFloat:damagedamagebits
{
 if ( !(
<= attacker <= g_MaxPlayers) || !is_user_alive(id))
        return 
HAM_IGNORED;
 new 
weapon2 get_user_weapon(attacker__);
 if( 
weapon2 == CSW_KNIFE)
 {
  
SetHamParamFloat(4damage get_pcvar_float(damage_sword1))
  return 
HAM_HANDLED;
 }
 return 
HAM_IGNORED;
}
public 
Ham_DamageSword2(idinflictorattackerFloat:damagedamagebits
{
 if ( !(
<= attacker <= g_MaxPlayers) || !is_user_alive(id))
        return 
HAM_IGNORED;
 new 
weapon2 get_user_weapon(attacker__);
 if( 
weapon2 == CSW_KNIFE)
 {
  
SetHamParamFloat(4damage get_pcvar_float(damage_sword2))
  return 
HAM_HANDLED;
 }
 return 
HAM_IGNORED;
}
public 
Ham_DamageSword3(idinflictorattackerFloat:damagedamagebits
{
 if ( !(
<= attacker <= g_MaxPlayers) || !is_user_alive(id))
        return 
HAM_IGNORED;
 new 
weapon2 get_user_weapon(attacker__);
 if( 
weapon2 == CSW_KNIFE)
 {
  
SetHamParamFloat(4damage get_pcvar_float(damage_sword3))
  return 
HAM_HANDLED;
 }
 return 
HAM_IGNORED;
}
public 
Ham_DamageSword4(idinflictorattackerFloat:damagedamagebits
{
 if ( !(
<= attacker <= g_MaxPlayers) || !is_user_alive(id))
        return 
HAM_IGNORED;
 new 
weapon2 get_user_weapon(attacker__);
 if( 
weapon2 == CSW_KNIFE)
 {
  
SetHamParamFloat(4damage get_pcvar_float(damage_sword4))
  return 
HAM_HANDLED;
 }
 return 
HAM_IGNORED;
}
public 
ShopSystem(id)
{
 new 
menu menu_create("\rFable TLC Mod Shop:""menu_handler")
     
menu_additem(menu"\wSwords Menu""1"0);
     
menu_additem(menu"\wArmors Menu""2"0);
     
menu_setprop(menuMPROP_EXITMEXIT_ALL);
     
menu_display(idmenu0);
}
 
public 
menu_handler(idmenuitem)
{
 if (
item == MENU_EXIT)
     {
         
menu_destroy(menu);
         return 
PLUGIN_HANDLED;
     }
     new 
data[6], iName[64];
     new 
accesscallback;
     
menu_item_getinfo(menuitemaccessdata,5iName63callback);
     new 
key str_to_num(data);
     switch(
key)
     {
         case 
1:
         {
              
SwordsMenu(id)
         }
         case 
2:
         {
              
ArmorsMenu(id)
         }
     }
     
menu_destroy(menu);
     return 
PLUGIN_HANDLED;
}
SwordsMenu(id)
{
 new 
menu menu_create("\rFable TLC Swords:""swordsmenu_handler")
     
menu_additem(menu"\yBlack Sword""1"0);
     
menu_additem(menu"\yMithril Sword""2"0);
     
menu_additem(menu"\yAdamant Sword""3"0);
     
menu_additem(menu"\yRune Sword""4"0);
     
menu_setprop(menuMPROP_EXITMEXIT_ALL);
     
menu_display(idmenu0);
}
public 
swordsmenu_handler(idmenuitem)
{
 if (
item == MENU_EXIT)
     {
         
menu_destroy(menu);
         if (
is_user_connected(id))
             
ShopSystem(id);
         return 
PLUGIN_HANDLED;
     }
     new 
data[6], iName[64];
     new 
accesscallback;
     
menu_item_getinfo(menuitemaccessdata,5iName63callback);
     new 
key str_to_num(data);
     switch(
key)
     {
         case 
1:
         {
              
client_print(idprint_chat"You buy Black Sword!");
   
set_task(1.0"Ham_DamageSword1"id)
         }
         case 
2:
         {
              
client_print(idprint_chat"You buy Mithril Sword!");
   
set_task(2.0"Ham_DamageSword2"id)
         }
         case 
3:
         {
              
client_print(idprint_chat"You buy Adamant Sword!");
   
set_task(3.0"Ham_DamageSword3"id)
         }
         case 
4:
         {
              
client_print(idprint_chat"You buy Rune Sword!");
   
set_task(4.0"Ham_DamageSword4"id)
         }
     }
     
menu_destroy(menu);
     
ShopSystem(id);
     return 
PLUGIN_HANDLED;
}
ArmorsMenu(id)
{
 new 
menu menu_create("\rFable TLC Armors:""armorsmenu_handler")
     
menu_additem(menu"\yRune Full Helm""1"0);
     
menu_additem(menu"\yRune PlateBody""2"0);
     
menu_additem(menu"\yRune PlateLegs""3"0);
     
menu_setprop(menuMPROP_EXITMEXIT_ALL);
     
menu_display(idmenu0);
}
public 
armorsmenu_handler(idmenuitem)
{
 if (
item == MENU_EXIT)
     {
         
menu_destroy(menu);
         if (
is_user_connected(id))
             
ShopSystem(id);
         return 
PLUGIN_HANDLED;
     }
     new 
data[6], iName[64];
     new 
accesscallback;
     
menu_item_getinfo(menuitemaccessdata,5iName63callback);
     new 
key str_to_num(data);
     switch(
key)
     {
         case 
1:
         {
              
client_print(idprint_chat"You buy Rune Full Helm!");
         }
         case 
2:
         {
              
client_print(idprint_chat"You buy Rune PlateBody!");
         }
         case 
3:
         {
              
client_print(idprint_chat"You buy Rune PlateLegs!");
         }
     }
     
menu_destroy(menu);
     
ShopSystem(id);
     return 
PLUGIN_HANDLED;
}
stock fm_give_item(index, const item[])
{
 if (!
equal(item"weapon_"7) && !equal(item"ammo_"5) && !equal(item"item_"5) && !equal(item"tf_weapon_"10))
  return 
0
 
new ent engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocStringitem))
 if (!
pev_valid(ent))
  return 
0
 
new Float:origin[3]
 
pev(indexpev_originorigin)
 
set_pev(entpev_originorigin)
 
set_pev(entpev_spawnflagspev(entpev_spawnflags) | SF_NORESPAWN)
 
dllfunc(DLLFunc_Spawnent)
 new 
save pev(entpev_solid)
 
dllfunc(DLLFunc_Touchentindex)
 if (
pev(entpev_solid) != save)
  return 
ent
 engfunc
(EngFunc_RemoveEntityent)
 return -
1


who can help ?

GIGS 11-10-2009 13:47

Re: if you chaose sword1 you have sword1 damage
 
where r models if u have than can u post the link for ur different swords

Jon 11-10-2009 17:35

Re: if you chaose sword1 you have sword1 damage
 
Wtf?

PHP Code:

set_task(1.0"Ham_DamageSword1"id



All times are GMT -4. The time now is 17:46.

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