SA-MP Forums Archive
In-game panel suggestions - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Other (https://sampforum.blast.hk/forumdisplay.php?fid=7)
+--- Forum: Everything and Nothing (https://sampforum.blast.hk/forumdisplay.php?fid=23)
+--- Thread: In-game panel suggestions (/showthread.php?tid=388664)



In-game panel suggestions - Face9000 - 29.10.2012

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.


Re: In-game panel suggestions - MP2 - 30.10.2012

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.


Re: In-game panel suggestions - Face9000 - 30.10.2012

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?


Re: In-game panel suggestions - Glint - 30.10.2012

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.


Re: In-game panel suggestions - playbox12 - 30.10.2012

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.


Re: In-game panel suggestions - Face9000 - 30.10.2012

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


Re: In-game panel suggestions - [HK]Ryder[AN] - 30.10.2012

enums would be better and easier to use


Re: In-game panel suggestions - Face9000 - 30.10.2012

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