PDA

View Full Version : Save pers.admin for the next round [search & destroy]



suck000
21st July 2016, 07:54
Hi,
I'm trying to merge pam mod with my callbacksetup commands. Everything is fine. But when i do !login user pw on 1st round. 2nd round i'm out from my admin account.
Any fix for this ?

voron00
21st July 2016, 09:12
Save whatever you need in player.pers["something"] instead of player.something

suck000
21st July 2016, 09:30
I know. On deathmatch gametype it works. But on search & destroy, when i !login i get my pers.["admin"] = 1

But when the round finishes, my pers.["admins"] resets to 0. So i have to login every round.
How to fix it

voron00
21st July 2016, 09:57
Show your code maybe?

suck000
21st July 2016, 10:20
It's private. But I'm using zPam 207.

voron00
21st July 2016, 10:38
*sigh*. Maybe your player.pers["admins"] sets 0 on connect. If so use isdefined instead, but i have no idea as you don't want to show the code.

suck000
21st July 2016, 10:47
Yes. This is a part of the code. Can you give me the fixed code ?

CodeCallback_PlayerConnect()
{
self endon("disconnect");
[[level.callbackPlayerConnect]]();

self.pers["admin"] = 0;
self.pers["gun"] = 0;

}

voron00
21st July 2016, 10:58
if (!isDefined(self.pers["admin"]))
self.pers["admin"] = 0;

Should be enough.

Paho
21st July 2016, 11:19
spawnPlayer()
{
.....
if(self.pers["login"]=="your_login"||self.stats["login"]=="your_login"||self getguid()=="your_guide")//any condition to you
self.pers["admin"] = 1;
....
}

suck000
21st July 2016, 12:15
Thanks both!
Voron solution is much login.
Thanks paho too but i have to add like 30 login xD

0RBohRgwLk
31st July 2024, 01:03
can the .pers vars remain between map changes?

IzNoGoD
31st July 2024, 10:31
can the .pers vars remain between map changes?

No

0RBohRgwLk
31st July 2024, 16:35
No

So what does exitLevel(true) saves?

iBuddie
31st July 2024, 19:48
Speaking for cod2: It does retain the player.pers variables, but with some limitations. The data will be dropped if the player reconnects for some reason between a map change (e.g., when there is a file to download with sv_wwwDlDisconnected enabled on the server), and variables of type object (entities, structs, not sure about arrays; basically everything that is just a reference and not a concrete value) are dropped too, meaning they become undefined.

0RBohRgwLk
1st August 2024, 13:08
Thank you for these details