[ACS] Questions regarding Database features

Discuss all aspects related to modding Zandronum here.
Post Reply
LordOZ_98
 
Posts: 43
Joined: Thu Feb 02, 2017 10:32 am

[ACS] Questions regarding Database features

#1

Post by LordOZ_98 » Sat Dec 02, 2017 2:56 pm

Hello (check spoiler for full story of what i'm trying to do)
Spoiler: (Open)
I'm trying to setup a system that changes level as soon as all players enter a specific sector (start sector), Here's how I set it up :

Code: Select all

bool PlayerAtSector[64];
int CurrentAmountAtSector;

script 107 ENTER //Player spawns at that sector
{
	 CurrentAmountAtSector = CurrentAmountAtSector+1;
         PlayerAtSector[playernumber()] = TRUE;
}
And I have the following script activated by player as soon as they leave the sector (ACS_ExecuteAlways), to subtract them from CurrentAmountAtSector

Code: Select all

script 109 (void) //Remove player from sector as soon as they leave it
{
	 PlayerAtSector[playernumber()] = FALSE;
	 CurrentAmountAtSector = CurrentAmountAtSector-1;
}
And the following script to ensure player is returned to that sector as soon as they die, because they will respawn at start location

Code: Select all

script 110 Death //Once player dies, return them to that sector
{
	 If(PlayerAtSector[playernumber()] == FALSE)
	 {
	 CurrentAmountAtSector = CurrentAmountAtSector+1;
         PlayerAtSector[playernumber()] = TRUE;
         }
}
It works fine, However i can't keep track of the player after they disconnect, I want to subtract them after they disconnect.

Code: Select all

script 108 (int gone) disconnect
{
If(PlayerAtSector[playernumber()] == TRUE)
	 CurrentAmountAtSector = CurrentAmountAtSector-1;
}
Is there anyway to store information of players to use them even after they disconnect ? I tried using arrays (check spoiler) But it didn't work, I'm I doing something wrong ?
Last edited by LordOZ_98 on Mon Dec 04, 2017 9:51 am, edited 1 time in total.
Kind Regards
- LordOZ_98

User avatar
Ivan
Addicted to Zandronum
Posts: 2219
Joined: Mon Jun 04, 2012 5:38 pm
Location: Omnipresent

[ACS] Re: Store player info via ACS ?

#2

Post by Ivan » Sat Dec 02, 2017 3:04 pm

You need to use the database features of Zandronum for that.

Alternatively you can do something very ghetto and only let the same 64 people play in your servers. You can use variables for that but you can't shutdown your server at any point...
=== RAGNAROK DM ON ... uh... dead forever? ===
=== ALWAYS BET ON ... uh... dead forever? ===
=== Who wanta sum wang? ===
=== Death and Decay - A new Monster/Weapon replacer ===

LordOZ_98
 
Posts: 43
Joined: Thu Feb 02, 2017 10:32 am

[ACS] Re: Store player info via ACS ?

#3

Post by LordOZ_98 » Sat Dec 02, 2017 6:37 pm

But is the incrementDBEntry going to work after player has already dsconnected ? will it work if I call it from a DISCONNECT script type ? the database tutorial mentioned in that article doesn't say anything about that.
Kind Regards
- LordOZ_98

Catastrophe
Retired Staff / Community Team Member
Posts: 2558
Joined: Sat Jun 02, 2012 2:44 am

[ACS] Re: Store player info via ACS ?

#4

Post by Catastrophe » Sat Dec 02, 2017 8:32 pm

LordOZ_98 wrote:
Sat Dec 02, 2017 6:37 pm
But is the incrementDBEntry going to work after player has already dsconnected ? will it work if I call it from a DISCONNECT script type ? the database tutorial mentioned in that article doesn't say anything about that.
1. Yes if you saved his name already beforehand.
2. Same as above.

See here: https://zandronum.com/forum/viewtopic.php?t=6993

LordOZ_98
 
Posts: 43
Joined: Thu Feb 02, 2017 10:32 am

[ACS] Re: Questions regarding Database features

#5

Post by LordOZ_98 » Mon Dec 04, 2017 9:53 am

(Renamed thread to something related)
Thanks, one last questions, about SortDBEntries, how exactly do I use it, I've got bunch of results that i'd like to sort in order, What do I need to put for
"int limit, int offset, bool order"

limit and offset is confusing, they sound the same, sorry If I sound dumb lol.

EDIT : Nevermind, I just need to write a function to return a value.
Kind Regards
- LordOZ_98

Post Reply