Posts: 3,351
Threads: 780
Joined: Jan 2010
Hello, i'm planning to make an ingame player panel for my server and i need some suggestions:
Whats better to use: pvars, defines or bools?
This ingame panel will allow players to enable/disable the things in the server such as textdraw, pms etc.
And in the case i've to save what a player enable/disable a thing, it's better to use my account variables? Like the normals pPm and etc (what i have in my gamemode).
Thanks.
Posts: 6,236
Threads: 310
Joined: Jan 2011
Reputation:
0
I would recommend a separate enum/array for player settings. pVars aren't really needed in this situation. How can you use defines to store variables? They can't be changed..
What do you mean by account variables? You want them to save right..? I'd make a separate file/table for settings if there's over 10.
Posts: 3,351
Threads: 780
Joined: Jan 2010
Quote:
Originally Posted by MP2
I would recommend a separate enum/array for player settings. pVars aren't really needed in this situation. How can you use defines to store variables? They can't be changed..
What do you mean by account variables? You want them to save right..? I'd make a separate file/table for settings if there's over 10.
|
For "account variables" i mean the variables i use in my account system like i have:
pMoney
pPassword
etc.
So, in case a player need to disable /pm, i'll set pPm to 0 and on the /pm command a check if player has enabled or disabled pms.
But this is just an example, got it?
Posts: 3,351
Threads: 780
Joined: Jan 2010
Quote:
Originally Posted by playbox12
Go with either booleans or bit arrays.
pawn Код:
#define TOTAL_SETTINGS 10 #define P_SETTING_PM 0 #define P_SETTING_TD 1 #define CONTINUE HERE 2 pSettings[MAX_PLAYERS][TOTAL_SETTINGS char] (total settings would be the amount of settings you'd have)
// Now you can use it like this pSettings[playerid][P_SETTING_PM] = 1;
This example is not correct it's more of a psuedo code with actual code hah, but I hope you get the idea. Look at the includes for bit arrays, I think ****** made y_bits in YSI and Ryder` also made an include for it.
|
It's exactly what i have in my account settings, so i'll go with that, thank you
Posts: 1,196
Threads: 45
Joined: Jan 2012
Reputation:
0
enums would be better and easier to use
Posts: 3,351
Threads: 780
Joined: Jan 2010
Quote:
Originally Posted by [HK]Ryder[AN]
enums would be better and easier to use
|
I use enums for my account system