AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How do I call a registered event? (https://forums.alliedmods.net/showthread.php?t=302768)

suhdude 11-10-2017 12:40

How do I call a registered event?
 
[SOLVED]

Code:
register_logevent("logevent_function_p", 3, "2=Planted_The_Bomb")

I want the round timer to be removed, and the c4 timer to appear.
I think this event will do that, but I don't know how to call it. (Beginner)

I use a script that auto plants the bomb, but it does not remove the timer.

Thank you!

HamletEagle 11-10-2017 13:43

Re: How do I call a registered event?
 
You do not call events, you hook events. This even is simply called when the bomb is planted, far from what you want to do. To change the timer you need to send a RoundTime message: https://wiki.alliedmods.net/Half-Lif...ents#RoundTime
If you want to hide the timer, then send a BombDrop https://wiki.alliedmods.net/Half-Lif...vents#BombDrop message with Flag = 1.

How to send messages? message_begin + ... + message_end.

suhdude 11-10-2017 14:48

Re: How do I call a registered event?
 
Quote:

Originally Posted by HamletEagle (Post 2559611)
You do not call events, you hook events. This even is simply called when the bomb is planted, far from what you want to do. To change the timer you need to send a RoundTime message: https://wiki.alliedmods.net/Half-Lif...ents#RoundTime
If you want to hide the timer, then send a BombDrop https://wiki.alliedmods.net/Half-Lif...vents#BombDrop message with Flag = 1.

How to send messages? message_begin + ... + message_end.

That was exactly what I was looking for!
Thanks for pointing me in the right direction again.

Its working, but on the radar the bomb is planted in a different place..
Oh well :)

HamletEagle 11-10-2017 14:59

Re: How do I call a registered event?
 
Send the correct bomb origin in BombDrop message to update the radar.

suhdude 11-10-2017 17:01

Re: How do I call a registered event?
 
Quote:

Originally Posted by HamletEagle (Post 2559637)
Send the correct bomb origin in BombDrop message to update the radar.

I have to do this for every map or is there a way to set it to player location?
Whatever, it is not important in this retake scenario :)

HamletEagle 11-10-2017 17:22

Re: How do I call a registered event?
 
get_user_origin

suhdude 11-10-2017 17:30

Re: How do I call a registered event?
 
Quote:

Originally Posted by HamletEagle (Post 2559673)
get_user_origin

Code:
{ get_user_origin(index, c4origin[3], mode = 0); message_begin(MSG_ALL, get_user_msgid("BombDrop"), {0,0,0}, 1) write_byte (c4origin); write_byte (c4origin); write_byte (c4origin); write_byte (1); write_byte (1); write_byte (1); write_byte (1); message_end(); }

This cant be right.. lol

KiLLeR. 11-10-2017 17:40

Re: How do I call a registered event?
 
Quote:

Originally Posted by suhdude (Post 2559676)
Code:
{ get_user_origin(index, c4origin[3], mode = 0); message_begin(MSG_ALL, get_user_msgid("BombDrop"), {0,0,0}, 1) write_byte (c4origin); write_byte (c4origin); write_byte (c4origin); write_byte (1); write_byte (1); write_byte (1); write_byte (1); message_end(); }

This cant be right.. lol

Code:
message_begin(MSG_ALL, get_user_msgid("BombDrop"), {0,0,0}, 1) write_byte(c4origin[0]); write_byte(c4origin[1]); write_byte(c4origin[2]); write_byte(1); message_end();

suhdude 11-10-2017 18:14

Re: How do I call a registered event?
 
Quote:

Originally Posted by KiLLeR. (Post 2559679)
Code:
message_begin(MSG_ALL, get_user_msgid("BombDrop"), {0,0,0}, 1) write_byte(c4origin[0]); write_byte(c4origin[1]); write_byte(c4origin[2]); write_byte(1); message_end();

I get "Error: Undefined symbol "c4origin""

Code:
public delete_clock(id) { get_user_origin(id, c4origin[3], mode = 0); message_begin(MSG_ALL, get_user_msgid("BombDrop"), {0,0,0}, 1) write_byte(c4origin[0]); write_byte(c4origin[1]); write_byte(c4origin[2]); write_byte(1); message_end(); }

HamletEagle 11-10-2017 18:25

Re: How do I call a registered event?
 
You have to define it(new ...)


All times are GMT -4. The time now is 21:39.

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