SetPVarInt or PlayerInfo?
#1

Heey guys, maybe it has been asked before.
But I am working on a new Gm with the basic of [HC]Thekiller mysql system and he uses SetPVarint, but I am used to playerinfo, is there any difference?
Reply
#2

See the following threads:

https://sampforum.blast.hk/showthread.php?tid=161454
https://sampforum.blast.hk/showthread.php?tid=261584
https://sampforum.blast.hk/showthread.php?tid=268499
Reply
#3

So conclusion:
I should just use the same way as killer is working?
Is that the right conclusion :$ (sorry don't realy get it)
Reply
#4

Well the point is just use some other variable name instead of "Playerinfo".
Hes explained it there, so no reason for me to re-explain it here.

Yes, Global Variables are indeed faster than PVars tho more complicated to use.

If you are inexperienced, and are not planning on some BIG project, you can use PVars for simplicity's sake. In case you are planning on a big project, I suggest using global vars as they are faster.

Here is the basic goods and bads list:

PVars:
-Use more memory (Edit, thanks for the correction ******)
-Reset Them selves when the player leaves (Or when he joins, doesn't matter)
-Much more understandable as they don't need those usual "confusing" characters.

Global Variables:
-Faster than PVars (Good)
-A bit harder to use (This applies only if you are new to the PAWN language)
-They must be reset (This can be a good or bad thing, you decide)

Unless you have just began to use the PAWN editor, I suggest Global Vars.

I'm not sure if he can understand those threads, nor is dedicated enough to go and check them out.

PS: I read your message again, seems you don't know how to use global vars. I cannot be your guide as there is the WIKI and many other sources you could learn this, tho i can give you an example
(At least for Player Data Storage)

Код:
enum pl_data
{
money,
admin
};

new gPlyData[MAX_PLAYERS][pl_data];
To explain you a bit of it:

This Array is 2D. I'm not good at explaining, but lets take as a example...a...table!
It has its Rows and its columns.
Each Player ID would have its Unique "row" with data written in it.
Our enum pl_data can act as a field.

You can use this code to read/write from this array.

Код:
gPlyData[5][admin] = 1; // Sets ID 5 as Admin

if (gPlyData[5][admin] == 1) Ban(5); // Checks if the Condition "is ID 5 admin" is true and if yes, ban the player.
Its just an example.
Reply
#5

Just a simple question, do you reset the values by making it = default number you set? Say for example you save the values and then reset them?
Reply
#6

Yes, just set the default value that you plan to use.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)