發新話題
打印

AMXX教學 - 第三章-amxx中各種變量(聖誕一日一篇amxx教學)

[Close]
引用:
原帖由 manchunho741 於 24-12-2010 02:18 PM 發表
d仔 我要學radom(唔知有冇打錯)
public plugin_init()
{
     register_plugin( PLUGIN, VERSION, AUTHOR )
     register_clcmd("say /demo","demo")
}

public demo(id)
{
     new random = random_num(0,9) //這個代表有多少個機會(從0至9抽一個數字) 這個代表有10次機會
     if(!is_user_alive(id))     return PLUGIN_HANDLED // 當他不是在生存時, 不讓他抽
     switch (random)
     {
           case 0: // 如果抽中的數字為0
           {
                 cs_set_user_money(id,16000) // 玩家金錢變16000美元
                 client_print(id,print_chat,"你獲得了16000美元。")
           }
           case 1: // 如果抽中的數字為1
           {
                 set_user_health(id,30000) // 玩家的血變成30000
                 client_print(id,print_chat,"你變成了血牛...")
           }
           default: //沒有抽中
           {
                 client_print(id,print_chat,"下次再抽吧...")
           }
     }
     return PLUGIN_HANDLED
}

TOP

回復 13# 的帖子

睇下D仔個序章啦

TOP

發新話題