In-game panel suggestions
#1

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.
Reply
#2

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.
Reply
#3

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?
Reply
#4

Quote:
Originally Posted by Logitech90
Посмотреть сообщение
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?
You could use Booleans for that.
Reply
#5

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.
Reply
#6

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
Reply
#7

enums would be better and easier to use
Reply
#8

Quote:
Originally Posted by [HK]Ryder[AN]
Посмотреть сообщение
enums would be better and easier to use
I use enums for my account system
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)