AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   detecting when a player spawns (https://forums.alliedmods.net/showthread.php?t=27896)

Anthraxnz 05-01-2006 23:06

detecting when a player spawns
 
how do i check for if a player has spawned yet?
theres client_spawn but that doesnt seem to work.

Batman/Gorlag 05-01-2006 23:29

Code:
register_event("ResetHUD", "yourfunction", "be")   //calls a function, yourfunction, whenever you respawn

Use that.

jtp10181 05-01-2006 23:38

be aware that event can be called other ways. It is a good idea to have a check in place to make sure the player actually died first or the round ended.

MaximusBrood 05-02-2006 05:07

There is a better way: (VEN invented it if I remember correct)

Code:
register_event("HLTV", "event_new_round", "a", "1=0", "2=0")

Mind that it is global.

johnjg75 05-02-2006 06:52

Quote:

Originally Posted by MaximusBrood
There is a better way: (VEN invented it if I remember correct)

Code:
register_event("HLTV", "event_new_round", "a", "1=0", "2=0")

Mind that it is global.

thats every new round though, not when a player spawns :?

v3x 05-02-2006 07:23

And you should always make a delayed function. Here's a brief example:
Code:
#include <amxmodx> public plugin_init() {   register_plugin("test" , "0.1" , "v3x");   register_event("ResetHUD" , "event_ResetHUD" , "b"); } public event_ResetHUD(id)   set_task(0.1 , "delayed_ResetHUD" , id); public delayed_ResetHUD(id) {   if(is_user_alive(id)) // you don't need to check if the person is alive if you're just setting variables though   {     //   } }

jtp10181 05-02-2006 08:34

v3x: yes that is a good idea since there are lots of things where if they are done DURING resethud cause problems.

v3x 05-02-2006 13:57

I learned my lesson on that a while ago :o

Kiloboban 05-08-2006 21:32

#include <CSX>

and 'client_spawn' will work xD

Smokey485 05-08-2006 22:14

Note that ResetHUD happens twice most of the time(atleast with the specialists mod)


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

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