Convert PlayerInfo System to PVars with #define
#1

Hello everyone!
I'm using the GF PlayerInfo-System, but I want to convert it to a PVars System.
Therefour, I want to use #define to let the compiler read it as SetPVarInt etc.
e.g.
pawn Код:
Old:
if(PlayerInfo[playerid][pAdmin] == 1)

New:
if(GetPVarInt(playerid, "pAdmin") == 1)
But I don't know how to do it, because very often I got things like
pawn Код:
PlayerInfo[playerid][pCash] *= 7;
for example.

So I wanted to ask, if someone knows, how to let the Compiler know, that it should use PVars instead of the old system using #define?

I dunno how to explain it exactly, so I'm sorry
Reply
#2

SetPVarInt(playerid,"pCash",GetPVarInt(playerid,"p Cash")*7);
Reply
#3

No, it's about converting
pawn Код:
PlayerInfo[playerid][pAdmin] = 1;
PlayerInfo[playerid][pCash]--;
if(PlayerInfo[playerid][pLaptop] == 7)
and so on with ONE universal #define code, so that after pre-compiling the code is like this:
pawn Код:
SetPVarInt(playerid, "pAdmin", 1);
SetPVarInt(playerid, "pCash", GetPVarInt(playerid, "pCash")-1);
if(GetPVarInt(playerid, "pLaptop") == 7)
Do you know what I mean?
Reply
#4

push -.-
Still waiting for help, but it seems that nobody wants to help, the same as in the topics with HTTP Bug and my f***ing Timeouts
Reply
#5

It's not that nobody wants to help, it's that nobody can help. I'll take a swing at it.

pawn Код:
#define PlayerInfo[%1][%2]=%3 SetPVarInt(%1,"%2",%3)
Even if that does work, it will only work for integers, that doesn't include Strings and Floats


Chances are you're just going to have to manually walk through your script and change it.
Reply
#6

Maybe regular variables are older, but they're faster than PVars, thought its just a fact of miliseconds, there's no reason to change it.
Reply
#7

but they're also taking space, so that the amx file is very huge at the end.
If I compile my Script now with MAX_PLAYERS = 500, the .amx got 22 MB. If I take MAX_PLAYERS = 70, I only got 6 MB and less
Reply
#8

I converted my script from PVars to normal variables yesterday.

Edit
Quote:

but they're also taking space, so that the amx file is very huge at the end.
If I compile my Script now with MAX_PLAYERS = 500, the .amx got 22 MB. If I take MAX_PLAYERS = 70, I only got 6 MB and less

22MB :O ?
Reply
#9

pawn Код:
#define PlayerInfo[%1][%2]=%3 SetPVarInt(%1,"%2",%3)
I know, it's working, but only for things with "=".
The problem will be stuff with ++, *= or -- etc

EDIT:
Quote:
Originally Posted by Souvlaki
Посмотреть сообщение
22MB :O ?
Yep, my script got 83264 lines
Reply
#10

Quote:
Originally Posted by Meta
Посмотреть сообщение
but they're also taking space, so that the amx file is very huge at the end.
If I compile my Script now with MAX_PLAYERS = 500, the .amx got 22 MB. If I take MAX_PLAYERS = 70, I only got 6 MB and less
Than use GetMaxPlayers and not MAX_PLAYERS.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)