引用 | 編輯
mischna09
2013-02-04 23:54 |
樓主
▼ |
||||||||||||
x2
===========================================輕鬆寫插件~ ~寫插件輕鬆 =========================================== 大家好~我又是Y14Y了~ [依然是AMXX新手] ~!@#$%^&*() 今天你將活用變數 來控制等級 這種東西 Let's GO! -------------------------------------------------------------------------------------- 如果你不知道變數是什麼 請先到我的第一集 http://bbs.mychat.to/reads.php?tid=976916 -------------------------------------------------------------------------------------- 我將用一個自製速成型插件 功能是 * 我會放原插件內容 和 口語化的翻譯 讓你能更清楚每句話的意義 更快學會! ~~~~~~~~~~~~~~~~~~插件原文~~~~~~~~~~~~~~~~~~~~~~~~~ //此插件只提供參考 請勿自行修改後 自稱自創品 #include <amxmodx> #include <hamsandwich> #include <cstrike> #include <fakemeta> #include <fun> #define PLUGIN "變數實用範例 {2} - 購買血量等級" #define VERSION "1.0" #define AUTHOR "Y14Y" new g_heal_level[33] public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) RegisterHam(Ham_Spawn, "player", "fw_Spawn_Post", 1) register_clcmd("maxhp_up", "example") } public example(id) { if(!is_user_alive(id)) { client_print(id, print_chat, "[系統]請等到復活後再使用!") } else if(is_user_alive(id) && cs_get_user_money(id) >= 3000 && g_heal_level[id] <= 40) { cs_set_user_money(id, cs_get_user_money(id) - 3000 ,0) g_heal_level[id]++ set_user_health(id, get_user_health(id) + 20) client_print(id, print_chat, "[系統]你提升了血量上限至[%d]", (g_heal_level[id] * 20 + 100)) } else if(is_user_alive(id) && cs_get_user_money(id) < 3000) { client_print(id, print_chat, "[系統]你的金錢不夠!") } else if(is_user_alive(id) && g_heal_level[id] == 41) { client_print(id, print_chat, "[系統]你的血量上限已達最高!") } } public fw_Spawn_Post(id) { set_user_health(id, get_user_health(id) + (g_heal_level[id] * 20)) } ~~~~~~~~~~~~~~~~~~文原件插~~~~~~~~~~~~~~~~~~~~~~~~~ 翻譯: (基礎類的不多加說明) #include <amxmodx> //不多加說明 #include <hamsandwich> //不多加說明 #include <cstrike> //不多加說明 #include <fakemeta> //不多加說明 #include <fun> //不多加說明 #define PLUGIN "變數實用範例 {2} - 購買血量等級" //不多加說明 #define VERSION "1.0" //不多加說明 #define AUTHOR "Y14Y" //不多加說明 新變數 名字g_heal_level[33] public plugin_init() //不多加說明 { register_plugin(PLUGIN, VERSION, AUTHOR) //不多加說明 註冊(事件[復活] 對象[玩家] 此發生時事件觸發"fw_Spawn_Post"這個FUCTION) 註冊指令(輸入"maxhp_up", 觸發"example") } public example(id) //不多加說明 { 如果(玩家沒有生存(id)) { client_print(id, print_chat, "[系統]請等到復活後再使用!") //不多加說明 } 其他的 如果(玩家生存(id) 並且 取得玩家美金大於等於3000 並且 g_heal_level[id]這個變數 小於等於 40) { 設定美金(對象:觸發此FUCTION的玩家, 取得玩家金錢(id) 扣除3000 ,0) //後面的0不懂的勿動 g_heal_level[id]此變數加1 設置血量(對象:id , 取得玩家血量 + 20) client_print(id, print_chat, "[系統]你提升了血量上限至[%d]", (g_heal_level[id] * 20 + 100)) //不多加說明 } 其他的 如果(玩家生存(id) 並且 取得玩家美金(id) 小於 3000) { client_print(id, print_chat, "[系統]你的金錢不夠!") //不多加說明 } 其他的 如果(玩家生存(id) 並且 g_heal_level[id]此變數等於41) { client_print(id, print_chat, "[系統]你的血量上限已達最高!") //不多加說明 } } public fw_Spawn_Post(id) //經解釋後 現在是玩家重生發生的事 { 設置血量(對象:id , 取得玩家血量 加上 (g_heal_level[id]的數量 乘於 20)) } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 如果身為高手的你覺得哪裡講錯或有更好的講法 歡迎說出~ ^^ 今天的教學就到這裡了~祝你能成SMA高手 如果你覺得對你有用 就讓我吃朵花花 或推推吧~
x3
|
引用 | 編輯
烈Gama英仙座
2013-02-05 07:50 |
1樓
▲ ▼ |
嗯嗯~
怎麼感覺你出文比上帝大大來的快呢 一天一篇 不早點起床搶不到頭香呢 頭香(洗頭) 重點: 看過之後 並不會覺的妳很嫩 真的 不需要在文章後加那一句 整篇文章算還不錯的 x2 |
引用 | 編輯
Marchillus
2013-02-17 17:13 |
3樓
▲ ▼ |
呢 咱跟汝的階級好像已經差不多了呢...(話說快開學了QAQ
x0 |
引用 | 編輯
弒血
2013-04-23 01:53 |
5樓
▲ ▼ |
加油喔
希望多出點,原因當然是,希望出現高手!!! 還有我這個人看到很多密密麻麻的字就 想刪掉一些多餘的字 我可以提醒你一下 這是你的 if(!is_user_alive(id)) { client_print(id, print_chat, "[係統]請等到復活後再使用!") } else if(is_user_alive(id) && cs_get_user_money(id) >= 3000 && g_heal_level[id] <= 40) { cs_set_user_money(id, cs_get_user_money(id) - 3000 ,0) g_heal_level[id]++ set_user_health(id, get_user_health(id) + 20) client_print(id, print_chat, "[係統]你提升了血量上限至[%d]", (g_heal_level[id] * 20 + 100)) } else if(is_user_alive(id) && cs_get_user_money(id) < 3000) { client_print(id, print_chat, "[係統]你的金錢不夠!") } else if(is_user_alive(id) && g_heal_level[id] == 41) { client_print(id, print_chat, "[係統]你的血量上限已達最高!") } } 我覺得 修改過後 會減少很多 這我幫你修改的,看你要不要使用 if(!is_user_alive(id)) { client_print(id, print_chat, "[係統]請等到復活後再使用!") } else { if(cs_get_user_money(id) >= 3000 && g_heal_level[id] <= 40) { cs_set_user_money(id, cs_get_user_money(id) - 3000 ,0) g_heal_level[id]++ set_user_health(id, get_user_health(id) + 20) client_print(id, print_chat, "[係統]你提升了血量上限至[%d]", (g_heal_level[id] * 20 + 100)) } else if(cs_get_user_money(id) < 3000) { client_print(id, print_chat, "[係統]你的金錢不夠!") } else if(g_heal_level[id] == 41) { client_print(id, print_chat, "[係統]你的血量上限已達最高!") } } 我是覺得...你已經判斷好了前者,為啥後者要不斷的給他勒 你不覺得你已經給了if(!is_user_alive(id)) 那為什麼 else之後 就是另類的意思 還多給他3個is_user_alive(id) 這並不是在指點你 ,而是想說 讓大家明白使用else的方式。 x0 |
引用 | 編輯
adi37545vfg
2013-09-11 18:29 |
9樓
▲ ▼ |
樓主大大好強 我不會寫插件= = 感謝你發教學文 讓我們看^^
x0 |
引用 | 編輯
dpes964211
2013-09-27 20:22 |
10樓
▲ ▼ |
載點不能下載= = health_example.txt 裡面都是亂碼
x0 |
引用 | 編輯
j12412211202
2014-05-11 09:59 |
12樓
▲ ▼ |
因為大大的教學。令我學會了如何製作sma
x0 |