搜索
查看: 2046|回复: 4

read_data()函数的使用方法

[复制链接]
发表于 2006-5-31 09:16:16 | 显示全部楼层 |阅读模式 来自 福建泉州
哪个大哥能给个使用实例,3q
发表于 2006-5-31 10:10:24 | 显示全部楼层 来自 华中科技大学韵苑公寓

回复: read_data()函数的使用方法

Description

read_data - Gets arguments/values from client messages.

Syntax

read_data ( value, [ ... ] )

Notes

To get an array/string:
new string[32]
read_data(argument, string, 31)

To get a float:
new Float:fVal
read_data(argument, fVal)

To get an integer:
read_data(argument)

[color="Blue"]例如:
下面是DeathMsg Event的描述:
DeathMsg
Fired to all players (MSG_ALL or MSG_BROADCAST) to notify them of a death. This generates the HUD message the client sees in the upper right corner of their screen.

Name:         DeathMsg  

[color="Blue"]Structure:  
                   byte  killer  
                   byte  victim  
                   byte  headshot  
                   string  weapon   

则,
new killer_id = read_data(1)
new victim_id = read_data(2)
new headshot = read_data(3)
new weaponname[20]
read_data(4,weaponname,31)
回复

使用道具 举报

 楼主| 发表于 2006-5-31 12:12:44 | 显示全部楼层 来自 福建泉州

回复: read_data()函数的使用方法

如何可以判断 read_data(1)一定是取DeathMsg呢?
回复

使用道具 举报

发表于 2006-5-31 13:14:04 | 显示全部楼层 来自 华中科技大学韵苑公寓

回复: read_data()函数的使用方法

register_event("DeathMsg","hook_death")

public hook_death()
{
new killer_id = read_data(1)
new victim_id = read_data(2)
}
回复

使用道具 举报

 楼主| 发表于 2006-5-31 19:36:09 | 显示全部楼层 来自 福建泉州

回复: read_data()函数的使用方法

3q,获得完整答案。
回复

使用道具 举报

游客
回复
您需要登录后才可以回帖 登录 | 注个册吧

快速回复 返回顶部 返回列表