AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Radio commands (events) (https://forums.alliedmods.net/showthread.php?t=12554)

v3x 04-17-2005 22:55

Radio commands (events)
 
Pretty self-explanitory if you look at my comment. :|
Code:
#include <amxmodx> public plugin_init() {     register_event("TextMsg", "catch_radio", "be", "2&#Game_radio", "4&#Fire_in_the_hole")     register_event("TextMsg", "catch_radio", "be", "2&#Game_radio", "4&#Cover_me") } public catch_radio(id) {     // How the hell would I tell which is which radio command     return PLUGIN_HANDLED }

BioHazardousWaste 04-17-2005 23:50

um, pass in a parameter...

xeroblood 04-17-2005 23:58

Re: Radio commands (events)
 
Code:
#include <amxmodx> public plugin_init() {     register_event("TextMsg", "catch_fire_hole", "be", "2&#Game_radio", "4&#Fire_in_the_hole")     register_event("TextMsg", "catch_cover_me", "be", "2&#Game_radio", "4&#Cover_me") } public catch_fire_hole(id) {     // blah blah blah     return PLUGIN_CONTINUE  //    <--------------------  :D } public catch_cover_me(id) {     // blah blah blah     return PLUGIN_CONTINUE  //    <--------------------  :D }


:D

BioHazardousWaste 04-18-2005 00:00

that will work too lol

n0obie4life 04-18-2005 06:16

is it possible to do 2 register_events ?

BioHazardousWaste 04-18-2005 07:05

i've done up too 3.. i don't think there is a limit

v3x 04-19-2005 11:17

Aww, I really didn't want to do a function for each event! :(

Oh well.. :|

[EDIT]
I forgot to mention that twisted mentioned something about read_data(), can I somehow do it with that?

xeroblood 04-19-2005 11:41

Well, you could try.. Just print out the values to the console to see what they are, maybe you will find something you could work with..

The TextMsg event has the following signature:
Code:

TextMsg         
ID = 78
SIZE =  -1
BYTE : destination
STRING : message
STRING : param1 (opt)
STRING : param2 (opt)
STRING : param3 (opt)
STRING : param4 (opt)


v3x 04-19-2005 11:48

Code:
message_begin(MSG_ONE,get_user_msgid("TextMsg"),{0,0,0},id) write_byte( x ) // BYTE : destination write_string( x ) // STRING : message message_end()

Like that, but what would x be?

xeroblood 04-19-2005 12:15

Re: Radio commands (events)
 
Well, I meant something like:

Code:
#include <amxmodx> public plugin_init() {     register_event("TextMsg", "catch_radio", "be", "2&#Game_radio", "4&#Fire_in_the_hole")     register_event("TextMsg", "catch_radio", "be", "2&#Game_radio", "4&#Cover_me") } public catch_radio(id) {     new iByte         iByte = read_data( 1 )         new szMessage[64]         read_data( 2, szMessage, 63 )         new szParam1[32]         read_data( 3, szParam1, 31 )         // etc...         console_print( 0, "TextMsg Event Data: Byte=%d, Msg=%s, P1=%s", iByte, szMessage, szParam1 )     return PLUGIN_HANDLED }

So that you can see what the values are, and then decide if you can use them to differentiate between the event..


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

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