Raised This Month: $ Target: $400
 0% 

Function help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Hawkie
Junior Member
Join Date: Mar 2005
Old 03-23-2005 , 10:33   Function help
Reply With Quote #1

I have never known how and when to use the read_data() function. It says it reads a message from the client, but what message?
Hawkie is offline
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 03-23-2005 , 11:20  
Reply With Quote #2

Usually used when hooking an event.. using that function can return useful parameters passed on each event, but as far as I know it only returns integer types (like short or byte)

An example of the data for the 'CurWeapon' Event:

(not actual Small C code, just example of the data)
Code:
Name  = CurWeapon
ID       = 68
Size    = 3
Arg1   = BYTE : isActive
Arg2   = BYTE : weapon id
Arg3   = BYTE : ammo

so, if you hook that event, you can do something like:
Code:
#include <amxmodx> public plugin_init() {     // Hook the Event to call our function for each player (flag "b")     // our function only gets called if first arg is 1 (isActive: 1)     // if our weapon was active, then it will meet the "1=1" condition     // and call our function     register_event( "CurWeapon", "event_weapon", "b", "1=1" ) } public event_weapon() {     // we dont need to use first argument in this function (unless u want to)     // since we already used first argument as a condition when registering the event     new iWeaponID = read_data( 2 )     new iAmmo = read_data( 3 )     // some more code...     return PLUGIN_CONTINUE }


I have appended an old list of events and parameters for CS...
Attached Files
File Type: rar events.rar (3.1 KB, 86 views)
xeroblood is offline
Send a message via MSN to xeroblood
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 03-23-2005 , 16:28  
Reply With Quote #3

Very nice, xero.
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:57.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode