广告广告
  加入我的最爱 设为首页 风格修改
首页 首尾
 手机版   订阅   地图  繁体 
您是第 1471 个阅读者
 
发表文章 发表投票 回覆文章
  可列印版   加为IE收藏   收藏主题   上一主题 | 下一主题   
Rubbish-Nec 手机 会员卡
个人头像
个人文章 个人相簿 个人日记 个人地图
特殊贡献奖 社区建设奖 优秀管理员勋章 特殊贡献奖-2
小有名气
级别: 小有名气 该用户目前不上站
推文 x214 鲜花 x701
分享: 转寄此文章 Facebook Plurk Twitter 复制连结到剪贴簿 转换为繁体 转换为简体 载入图片
推文 x0
[1.6] 请大大看看我的sma
我写了以下的东西
复制程式
#include <amxmodx>
#include <hamsandwich>
#include <zombieplague>
#include <fun>
#include <fakemeta>
#include <xs>

new const g_item_name[] = { "丧尸急冻手雷" }
const g_item_cost = 5

new g_itemid_flashbang

public plugin_init()
{
    register_plugin("[ZP] Extra: Flashbang for zombie", "1.0", "Rubbish-.Nec")
   
    g_itemid_flashbang = zp_register_extra_item(g_item_name, g_item_cost, ZP_TEAM_ZOMBIE)

}

public zp_extra_item_selected(player, itemid)
{
    client_print(player, print_chat, "[ZP] 你买了一颗急冻手雷.")
    fm_give_item(player, "weapon_flashbang")
}

#include 那里我不知道要加啥,所以什么都加进去了…表情

compile时它说:



已成过去的中二少年。
献花 x0 回到顶端 [楼 主] From:香港城市电讯 | Posted:2009-12-25 22:34 |
a7811311622 手机
个人头像
个人文章 个人相簿 个人日记 个人地图
特殊贡献奖 优秀管理员勋章 社区建设奖
头衔:我…在工作了…我…在工作了…
版主
级别: 版主 该用户目前不上站
版区: CS提问区
推文 x771 鲜花 x2152
分享: 转寄此文章 Facebook Plurk Twitter 复制连结到剪贴簿 转换为繁体 转换为简体 载入图片

下面是引用 Rubbish-Nec 于 2009-12-25 22:34 发表的 请大大看看我的sma: 到引言文
我写了以下的东西
复制程式
#include <amxmodx> #include <hamsandwich> #include <zombieplague> #include <fun> #include <fakemeta> #include <xs>  new const g_item_name[] = { "丧尸急冻手雷" } const g_item_cost = 5  new g_itemid_flashbang  public plugin_init() {     register_plugin("[ZP] Extra: Flashbang for zombie", "1.0", "Rubbish-.Nec")         g_itemid_flashbang = zp_register_extra_item(g_item_name, g_item_cost, ZP_TEAM_ZOMBIE)  }  public zp_extra_item_selected(player, itemid) {     client_print(player, print_chat, "[ZP] 你买了一颗急冻手雷.")     fm_give_item(player, "weapon_flashbang") }


这是我改的:
#include <amxmodx>
#include <fakemeta>
#include <zombieplague>

 
new const g_item_name[] = { "丧尸急冻手雷" }
const g_item_cost = 5
 
new g_itemid_flashbang
 
public plugin_init()
{
 register_plugin("[ZP] Extra: Flashbang for zombie", "1.0", "Rubbish-.Nec")
 g_itemid_flashbang = zp_register_extra_item(g_item_name, g_item_cost, ZP_TEAM_ZOMBIE)
}
 
public zp_extra_item_selected(player, itemid)
{
 if ( itemid == g_itemid_flashbang)
 {

  client_print(player, print_chat, "[ZP] 你买了一颗急冻手雷.")
  fm_give_item(player, "weapon_flashbang")
 }
}

stock fm_give_item(id, const item[])
{
 static ent
 ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, item))
 if (!pev_valid(ent)) return;
 
 static Float:originF[3]
 pev(id, pev_origin, originF)
 set_pev(ent, pev_origin, originF)
 set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN)
 dllfunc(DLLFunc_Spawn, ent)
 
 static save
 save = pev(ent, pev_solid)
 dllfunc(DLLFunc_Touch, ent, id)
 if (pev(ent, pev_solid) != save)
  return;
 
 engfunc(EngFunc_RemoveEntity, ent)
}

红色部分是你错误或是缺少的内容。

参考资料:
我的经验值…


[ 此文章被a7811311622在2009-12-26 00:09重新编辑 ]


尚无签名,欢迎 [新增个性化签名]
献花 x0 回到顶端 [1 楼] From:台湾教育部 | Posted:2009-12-25 23:24 |
Rubbish-Nec 手机 会员卡
个人头像
个人文章 个人相簿 个人日记 个人地图
特殊贡献奖 社区建设奖 优秀管理员勋章 特殊贡献奖-2
小有名气
级别: 小有名气 该用户目前不上站
推文 x214 鲜花 x701
分享: 转寄此文章 Facebook Plurk Twitter 复制连结到剪贴簿 转换为繁体 转换为简体 载入图片

stock fm_give_item(id, const item[]) 有啥意思?不太懂… 表情

还有g_itemid_lightning好像要改成g_itemid_flashbang


已成过去的中二少年。
献花 x0 回到顶端 [2 楼] From:香港城市电讯 | Posted:2009-12-25 23:46 |
a7811311622 手机
个人头像
个人文章 个人相簿 个人日记 个人地图
特殊贡献奖 优秀管理员勋章 社区建设奖
头衔:我…在工作了…我…在工作了…
版主
级别: 版主 该用户目前不上站
版区: CS提问区
推文 x771 鲜花 x2152
分享: 转寄此文章 Facebook Plurk Twitter 复制连结到剪贴簿 转换为繁体 转换为简体 载入图片

下面是引用 Rubbish-Nec 于 2009-12-25 23:46 发表的 : 到引言文
stock fm_give_item(id, const item[]) 有啥意思?不太懂… 表情

还有g_itemid_lightning好像要改成g_itemid_flashbang


fm_give_item等于<fun>里的give_item,但因为你只需要用到give_item,
就直接用stock把give_item独立出来,不然你只为了give_item这指令就读取
<fun>的全部指令,这样插件会读取你没用到的内容,影响插件的大小和执行效率。
(以上纯为猜测,完全是靠我理解到的知识说明的,所以有没有说错也不清楚…)
 
至于g_itemid_lightning…啊!偷懒复制贴上的结果…表情


尚无签名,欢迎 [新增个性化签名]
献花 x0 回到顶端 [3 楼] From:台湾教育部 | Posted:2009-12-26 00:15 |
Rubbish-Nec 手机 会员卡
个人头像
个人文章 个人相簿 个人日记 个人地图
特殊贡献奖 社区建设奖 优秀管理员勋章 特殊贡献奖-2
小有名气
级别: 小有名气 该用户目前不上站
推文 x214 鲜花 x701
分享: 转寄此文章 Facebook Plurk Twitter 复制连结到剪贴簿 转换为繁体 转换为简体 载入图片

噢,那就是可以打#include <fun>

但是会令sma读取到不需要的东西


已成过去的中二少年。
献花 x0 回到顶端 [4 楼] From:香港城市电讯 | Posted:2009-12-26 00:47 |
a7811311622 手机
个人头像
个人文章 个人相簿 个人日记 个人地图
特殊贡献奖 优秀管理员勋章 社区建设奖
头衔:我…在工作了…我…在工作了…
版主
级别: 版主 该用户目前不上站
版区: CS提问区
推文 x771 鲜花 x2152
分享: 转寄此文章 Facebook Plurk Twitter 复制连结到剪贴簿 转换为繁体 转换为简体 载入图片

下面是引用 Rubbish-Nec 于 2009-12-26 00:47 发表的 : 到引言文
噢,那就是可以打#include <fun>

但是会令sma读取到不需要的东西


大致是这个意思,因为读取<fun>时等于把<fun>里面的指令全部算进SMA里,
浪费资源,浪费时间,浪费空间


尚无签名,欢迎 [新增个性化签名]
献花 x0 回到顶端 [5 楼] From:台湾教育部 | Posted:2009-12-26 01:12 |

首页  发表文章 发表投票 回覆文章
Powered by PHPWind v1.3.6
Copyright © 2003-04 PHPWind
Processed in 0.016328 second(s),query:16 Gzip disabled
本站由 瀛睿律师事务所 担任常年法律顾问 | 免责声明 | 本网站已依台湾网站内容分级规定处理 | 连络我们 | 访客留言