Chcem nascriptovať menu, v ktorom budú položky napr. Sila 1, Sila 2 atď... a každá táto položka bude dávať iný damage. Napr. Sila 1, keď si ju hráč kúpi, ňastaví mu to damage na 70.0.
Tu je script:
Kód: Vybrat vše
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>
#include <hamsandwich>
new float:dmgSet = 50.0
new float:dmgSet2 = 230.0
public plugin_init()
{
register_plugin("VIP Shop", "1.0", "RayCodeCSC")
register_clcmd("say /vipshop", "vip_menu")
register_clcmd("say /vs", "vip_menu")
RegisterHam(Ham_TakeDamage, "player", "tkDamage")
RegisterHam(Ham_TakeDamage, "player", "tkDamage2")
}
public vip_menu(id)
{
new m = menu_create("Vyber si z menu:", "vip_menu_selection")
menu_additem(m, "Sila 1")
menu_additem(m, "Sila 2")
menu_display(id, m)
}
vip_menu_selection(id, menu, item)
{
if(item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
switch(item)
{
case 0:
{
tkDamage(dmgSet)
}
case 1:
{
tkDamage2(dmgSet2)
}
}
}
public tkDamage(victim, attacker, inflictor, dmgSet)
{
if(get_player_weapon(attacker) == CSW_KNIFE)
{
SetHamParamFloat(4, damage = dmgSet)
}
}
public tkDamage2(victim, attacker, inflictor, dmgSet)
{
if(get_player_weapon(attacker) == CSW_KNIFE)
{
SetHamParamFloat(4, damage = dmgSet2)
}
}
Kód: Vybrat vše
test.sma(10) : warning 213: tag mismatch
test.sma(53) : error 017: undefined symbol "get_player_weapon"
test.sma(55) : error 017: undefined symbol "damage"
test.sma(55) : warning 215: expression has no effect
test.sma(55) : error 001: expected token: ";", but found ")"
test.sma(55) : error 029: invalid expression, assumed zero
test.sma(55) : fatal error 107: too many error messages on one line