AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Wondering about a kindof hook (https://forums.alliedmods.net/showthread.php?t=187667)

Misery 06-16-2012 09:20

Wondering about a kindof hook
 
Hi,

Right now I'm maintaining lists within the plugin about
1- Spawnable players
2- Team ids of players, period (i.e. regardless if they're spawnable or not)

This is mostly because I use a lot of references for this list and it's just optimal to make this work this way, instead of recalculating the data from scratch each time my functions get called.

I'm currently hooking the TeamInfo message and update the list here. I've hooked TeamInfo using a Orpheu way instead of the standard AMXX way. It's more efficient...

But I'm wondering... I still have some sort of problems with the list of spawnable players.

Say a user joins a team, but just does not choose it's appearance. In this case he's stuck to be dead and cannot be spawned until he chooses his appearance.
I am wondering if there would be something I could hook in order to perfectly know, right right after he chooses his appearance, so I can update my lists instantly.

I would use this hook in conjunction with my TeamInfo hook and it would be perfect... Would have been wonderful if TeamInfo was called too just after the player chooses his appearance. But it's not the case (there would be no point either...).

Also, as a side question. Is there any function I could hook which would be called both when a player joins a team and when he chooses his team? It's most likely a dream, just wondering...
I thought about hooking CheckWinConditions since it's called on some team joins and recalculate from scratch things there, but it's definitely not called always... since when the time comes where FPlayerCanRespawn() ends, it's not called anymore on team joins...

Thanks!

Misery

Arkshine 06-16-2012 09:50

Re: Wondering about a kindof hook
 
Don't have the time to decompile atm, but to start, and since you use orpheu, you could take a look at HandleMenu_ChooseAppearance() and HandleMenu_ChooseTeam().

Misery 06-16-2012 14:00

Re: Wondering about a kindof hook
 
HandleMenu_ChooseAppearance actually works gret, it's called just after appearance choosing. It's perfect. Thanks Arkshine ^^

Still, I wanted to hear your opinion on that... What about hooking pfnClientUserInfoChanged()?
I would hook it and recalculate all the spawnable/team list from zero... could it be a reliable function to hook on for team changes or the m_iTeam in private data can potentially be changed without calling this function?
Just wondering...

Misery


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

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