PDA

View Full Version : Multidimensional session array


spawni
10-17-2014, 09:59
hello,
i want to create a session restore plugin for my own server and need some help. I want to restore the position, angle, kills, etc. of players after they do a retry. How can i realize my idea?

the structure of my array should look like that

1. szSteamid player x
1.1 flPosition
1.2 flAngle
1.3 iKills
..
2. szSteamid player x
2.1 flPosition
2.2 flAngle
2.3 iKills
..
etc.


My first thoughts:
- global handle xxx which will be used as adt array
- enum with subitems like position, angle, ..
- pluginstart: xxx = CreateArray(???);
- onmapstart: cleararray(xxx)
- onadmincheck: go through the array and check whether the array contains his steamid (if yes then restore his stats etc.)
- 1sec timer: save client data like position?

thx 4 help

spawni
10-19-2014, 11:53
push

Leonardo
10-19-2014, 16:21
https://forums.alliedmods.net/misc.php?do=showrules
Do not "bump" your threads. Bumping is posting simply to make the thread higher in the forum sort order.

KeyValues (https://wiki.alliedmods.net/KeyValues_(SourceMod_Scripting)) is the best for this, I guess.
"my_keyvalues"
{
"[U:1:12345]"
{
"origin" "0.0 0.0 0.0"
"angles" "90.0 0.0 0.0"
"kills" "42"
}
}
Store it on client disconnect.
Restore it on client's first spawn (iirc first spawn as an unassigned player also triggers the player_spawn event).