下面是引用 Rubbish-Nec 于 2009-12-29 01:10 发表的 又是请大大看看我的sma:
请看看吧
#include <amxmodx> #include <cstrike> new g_mac_cost public plugin_init() { register_plugin ("Buy Mac" , "1.0" , "Rubbish.Nec") register_clcmd ( "say /buymac" , "buy_mac" ) g_mac_cost = register_cvar ( "amx_mac_cost" , "16000" ) } public buy_mac(id) { if (!is_user_alive (id) || !is_user_connected (id)) { new money = cs_get_user_money(id) if (money < g_mac_cost) { give_item( id , "weapon_mac10" ) cs_set_user_money ( id , money - g_mac_cost ) } else { client_print( id , print_chat , "你不够钱。" ) } } } [/pre]
我怎么觉得你逻辑条件假设相反了…?
我是改这样:
#include <amxmodx>
#include <cstrike>
new g_mac_cost
public plugin_init()
{
register_plugin ("Buy Mac" , "1.0" , "Rubbish.Nec")
register_clcmd ( "say /buymac" , "buy_mac" )
g_mac_cost = register_cvar ( "amx_mac_cost" , "16000" )
}
public buy_mac(id)
{
if (!is_user_alive (id) || !is_user_connected (id))
{
new money = cs_get_user_money(id)
if (money <
get_pcvar_num(g_mac_cost
))
{
client_print( id , print_chat , "你不够钱。" )
return;
}
give_item( id , "weapon_mac10" )
cs_set_user_money ( id , money -
get_pcvar_num(g_mac_cost
) )
}
}
话说…干脆问插件能不能像枪模一样开个研究区算了…
感觉插件的语法都还要跑来提问区问…
搞不好开个「插件研究区」后yymmychat大就能教一些很好用的语法呢~