skyforever 发表于 2006-5-31 09:16:16

read_data()函数的使用方法

哪个大哥能给个使用实例,3q

kinsprite 发表于 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
read_data(argument, string, 31)

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

To get an integer:
read_data(argument)
例如:
下面是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

Structure:
                   bytekiller
                   bytevictim
                   byteheadshot
                   stringweapon   
则,
new killer_id = read_data(1)
new victim_id = read_data(2)
new headshot = read_data(3)
new weaponname
read_data(4,weaponname,31)

skyforever 发表于 2006-5-31 12:12:44

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

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

kinsprite 发表于 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)
}

skyforever 发表于 2006-5-31 19:36:09

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

3q,获得完整答案。
页: [1]
查看完整版本: read_data()函数的使用方法