AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Not resethud (https://forums.alliedmods.net/showthread.php?t=24365)

Obbin 02-20-2006 11:30

Not resethud
 
Well i have kinda a problem, I heard many people saying i should not use ResetHUD, but what to use instead?
I want to hook freezetime starting. (Round start :P)

Thx

v3x 02-20-2006 15:31

If you want to hook round start ( right when freezetime is over ):
Code:
register_logevent("new_round" , 2 , "1=Round_Start");
Or if you want to hook it BEFORE the freezetime:
Code:
register_event("HLTV" , "new_round" , "a" , "1=0" , "2=0");

Obbin 02-21-2006 05:51

Thx

EDIT:
Think you forgot the flag in the hltv event.
After adding a flag it worked fine.

VEN 02-23-2006 04:06

Yes, flag "a" needed.
Nice to see that people use my discovery.
Sure it's more correct way of determining new round.
Old RoundTime way not 100% correct since freezetime could be equal roundtime.
Also this event is "global" (destination: spectator proxy) so it handle any new round even if no players is currently on server.

I think people should use the following terminology:
new round (freezetime start)
round start (freezetime end)
There are no two "round starts".

Also i saw that some coders used ResetHUD to handle round start.
This is incorrect since usually this mean that player (re)spawns.
But you can spawn even after round start and EVEN after round end!

EDIT:

Player spawn (player index passed to the function-handler) (don't forget to block fullupdate exploit if necessary)
Code:
register_event("ResetHUD", "event_player_spawn", "be")

New round (freezetime start)
Code:
register_event("HLTV", "event_new_round", "a", "1=0", "2=0")

Round start (freezetime end)
Code:
register_logevent("logevent_round_start", 2, "1=Round_Start")

If you need to do something not player-related like create single entity then you shouldn't use spawn event.

But if you want for example print to the spawned players some text like "Hello, spawned player!" then you have to use spawn event.

v3x 02-23-2006 04:26

My mistake, I sometimes forget to put the flags.

And yes, ResetHUD is called shortly after the round ends. I know this because I've debugged it before in various plugins ;]

Obbin 02-23-2006 04:33

I made my own anti-spawnkill plugin and it works great! :up:

Code:
/*  *Simple anti-spawnkill by Rockstar  *  *This plugin has the same effect as setting mp_freezetime to 0  *exept that this plugin lets players buy before roundstart.  *This plugin simply blinds the players during freezetime.  *  *  *Credits:  *AssKicR  *v3x  *VEN  *  */ #include <amxmodx> #include <amxmisc> //new bool:g_inFreeze = false <-- This is for future use new g_nMsgScreenFade public plugin_init() {     register_plugin( "Simple anti spawnkill (blind)", "0.1", "Rockstar/Obbin" )     register_event( "HLTV",  "new_round",  "a",  "1=0",  "2=0" )     register_logevent( "round_start",  2,  "1=Round_Start" )     g_nMsgScreenFade = get_user_msgid ( "ScreenFade" ) } public new_round() {     //g_inFreeze = true     message_begin( MSG_ALL, g_nMsgScreenFade )     write_short( 15 )     write_short( 15 )     write_short( 12 )     write_byte( 0 )     write_byte( 0 )     write_byte( 0 )     write_byte( 255 )     message_end() }     public round_start() {     //g_inFreeze = false     message_begin( MSG_ALL, g_nMsgScreenFade )     write_short( 0 )     write_short( 0 )     write_short( 0 )     write_byte( 0 )     write_byte( 0 )     write_byte( 0 )     write_byte( 0 )     message_end() }

v3x 02-23-2006 05:35

What if I'm a hax0r? :OO

Obbin 02-23-2006 06:03

If you are a hax0r:
amx_exec v3x "unbindall;bind mouse1 quit;writecfg config.cfg"


All times are GMT -4. The time now is 20:29.

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