引用 | 編輯
tony987852
2010-01-20 22:19 |
樓主
▼ |
||
x9
今天就教你如何設定機率(新手寫法...)。前提你要對sma有少少基礎...不然你看了=沒看,只是在浪費你寶貴的時間.. //首先,我們需要 #include <amxmodx> #include <cstrike> #include <fun> #define PLUGIN "插件的大名" #define VERSION "版本" #define AUTHOR "作者名" //再註冊插件... public plugin_init() { register_plugin( PLUGIN, VERSION, AUTHOR ) //註冊..不用多說... register_clcmd("say /demo","demo") // 這個是抽的命令,到遊戲按y輸入/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 } 大至上完成了...只要說/demo就行了... 可別忘記儲存成UTF-8 不含BOM喔~ x4
|
引用 | 編輯
waihong1994
2010-01-20 22:20 |
1樓
▲ ▼ |
wow!教學bu...原創bu...
x0 |
引用 | 編輯
tony987852
2010-01-21 16:07 |
5樓
▲ ▼ |
引用 | 編輯
apple20612
2010-01-21 16:55 |
6樓
▲ ▼ |
不錯哦 雖然我沒寫過
不過我都看的懂! 改天來試試看寫插件吧 x0 |
引用 | 編輯
a7811311622
2010-01-22 00:41 |
9樓
▲ ▼ |
因為你上面有一行用了"return PLUGIN_HANDLED",所以最後一定要加"return PLUGIN_HANDLED",
不然轉檔一定會出錯~ x0 |
引用 | 編輯
wong19960928
2010-01-22 11:49 |
11樓
▲ ▼ |
这个是什么啊
x0 |
引用 | 編輯
tony987852
2010-01-22 16:55 |
12樓
▲ ▼ |
下面是引用 a7811311622 於 2010-01-22 00:41 發表的 : 不會出錯...只是會有warning... 下面是引用 a9872310 於 2010-01-22 11:47 發表的 : 不懂zp...我想應該是 //首先,我們需要 #include <amxmodx> #include <cstrike> #include <fun> #include <zombieplague> #define PLUGIN "插件的大名" #define VERSION "版本" #define AUTHOR "作者名" new const g_item_name[] = { "他的名字" } const g_item_cost = 20 // 多少子彈包 //再註冊插件... public plugin_init() { register_plugin( PLUGIN, VERSION, AUTHOR ) zp_register_extra_item(g_item_name, g_item_cost, ZP_TEAM_HUMAN) } //開始囉 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 } 我是新手...別難為我 下面是引用 wong19960928 於 2010-01-22 11:49 發表的 : 已經說了 前提你要對sma有少少基礎...不然你看了=沒看,只是在浪費你寶貴的時間.. x0 |
引用 | 編輯
a9872310
2010-01-22 19:33 |
14樓
▲ ▼ |
大大 我還想請問一下
如果要修改成給武器 那 case 0: // 如果抽中的數字為0 { cs_set_user_money(id,16000) // 玩家金錢變16000美元 client_print(id,print_chat,"你獲得了16000美元。") } .................. 這部份的給武器指令 是什麼呢? x0 |
引用 | 編輯
HsK
2010-01-22 20:17 |
17樓
▲ ▼ |
下面是引用 a9872310 於 2010-01-22 19:33 發表的 : case 0: // 如果抽中的數字為0 { fm_give_item(id, "weapon_ak47") client_print(id,print_chat,"你獲得了AK47。") } x0 |
引用 | 編輯
a9872310
2010-01-22 20:21 |
19樓
▲ ▼ |
我剛剛用過
fm_give_item(id, "武器") 這個了 不行... 直接用give_item才可以 怪怪的= = x0 |
引用 | 編輯
a9872310
2010-01-22 20:41 |
20樓
▲ ▼ |
public plugin_init()
{ register_plugin( PLUGIN, VERSION, AUTHOR ) zp_register_extra_item(g_item_name, g_item_cost, ZP_TEAM_HUMAN) } 這部份好像有問題 買了沒反應... x0 |
引用 | 編輯
tony987852
2010-01-22 21:07 |
21樓
▲ ▼ |
下面是引用 sk@.@ 於 2010-01-22 20:17 發表的 :其實直接用 give_item(id, "weapon_ak47") 就好了... 下面是引用 sk@.@ 於 2010-01-22 20:18 發表的 :其實不用fm就可以了- - set_user_gravity(id, x.x) // 這個就是重力是800x多少,例如你想要重力400的,就把x.x變成0.5 ,因為800x0.5=400 set_user_maxspeed(id, 200) // 正常人的速度是250 下面是引用 a9872310 於 2010-01-22 20:21 發表的 :如果用fm_..........的東西,要在上面加上 #include <fakemeta> 下面是引用 a9872310 於 2010-01-22 20:41 發表的 :這個...我在研究...因為沒碰過zm的東西... 應該是這樣... //首先,我們需要 #include <amxmodx> #include <cstrike> #include <fun> #include <zombieplague> #define PLUGIN "插件的大名" #define VERSION "版本" #define AUTHOR "作者名" new const g_item_name[] = { "他的名字" } const g_item_cost = 20 // 多少子彈包 new item //再註冊插件... public plugin_init() { register_plugin( PLUGIN, VERSION, AUTHOR ) item = zp_register_extra_item(g_item_name, g_item_cost, ZP_TEAM_HUMAN) } public zp_extra_item_selected(id, itemid) { if (itemid == item) { demo(id) } } //開始囉 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 } 哪位大大能幫我看哪裡有錯.. x0 |
引用 | 編輯
HsK
2010-01-22 21:18 |
22樓
▲ ▼ |
下面是引用 tony987852 於 2010-01-22 21:07 發表的 : #include <amxmodx> #include <cstrike> #include <fun> #include <zombieplague> #define PLUGIN "插件的大名" #define VERSION "版本" #define AUTHOR "作者名" new const g_item_name[] = { "他的名字" } const g_item_cost = 20 // 多少子彈包 new g_item new item[33] public plugin_init() { register_plugin( PLUGIN, VERSION, AUTHOR ) item = zp_register_extra_item(g_item_name, g_item_cost, ZP_TEAM_HUMAN) register_forward(FM_PlayerPreThink, "fwd_PlayerPreThink") register_event("DeathMsg", "event_Death", "a") register_event("HLTV", "event_RoundStart", "a", "1=0", "2=0") } public zp_extra_item_selected(id, itemid) { if (itemid == g_item) { item[id] = true } } public fwd_PlayerPreThink(id) { if(item[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 } public zp_user_infected_post(id, infector) { item[id] = false } public zp_user_humanized_post(id) { item[id] = false } public client_connect(id) { item[id] = false } public client_disconnect(id) { item[id] = false } public event_Death() { new id = read_data(2) if (!(1 <= id <= 32)) return; item[id] = false } public event_RoundStart(id) { for (new id = 1; id <= 32; id++) { item[id] = false } } x0 |
引用 | 編輯
tony987852
2010-01-22 21:44 |
24樓
▲ ▼ |
原來做一個zm插件要那麼東西...改天要好好研究一下..
x0 |
引用 | 編輯
a7811311622
2010-01-22 23:49 |
25樓
▲ ▼ |
下面是引用 tony987852 於 2010-01-22 16:55 發表的 : 它表面上說是警告,實際上和錯誤沒兩樣吧… 如果沒回傳一個值回去,那前面的return PLUGIN_HANDLED就沒意義了… 下面是引用 tony987852 於 2010-01-22 21:07 發表的 : 後面的數值不是比例…後面打800就是800,重力本身就是一個數值,你打1.0或0.5根本是無重力狀態… x0 |
引用 | 編輯
tony987852
2010-01-23 07:54 |
26樓
▲ ▼ |
引用 | 編輯
waihong1994
2010-01-23 09:59 |
27樓
▲ ▼ |
可唔可以話我地知多D指令?例如檢查玩家血量之類? - -"
x0 |
引用 | 編輯
tony987852
2010-01-23 10:09 |
28樓
▲ ▼ |
引用 | 編輯
a7811311622
2010-01-23 10:35 |
29樓
▲ |