Convert PlayerInfo System to PVars with #define -
Meta - 04.01.2011
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
Re: Convert PlayerInfo System to PVars with #define -
Johnny_Xayc - 04.01.2011
SetPVarInt(playerid,"pCash",GetPVarInt(playerid,"p Cash")*7);
AW: Convert PlayerInfo System to PVars with #define -
Meta - 04.01.2011
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?
AW: Convert PlayerInfo System to PVars with #define -
Meta - 08.01.2011
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
Re: Convert PlayerInfo System to PVars with #define -
Joe Staff - 08.01.2011
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.
Re: Convert PlayerInfo System to PVars with #define -
admantis - 08.01.2011
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.
AW: Convert PlayerInfo System to PVars with #define -
Meta - 08.01.2011
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
Re: Convert PlayerInfo System to PVars with #define -
Souvlaki - 08.01.2011
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 ?
AW: Convert PlayerInfo System to PVars with #define -
Meta - 08.01.2011
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
Re: AW: Convert PlayerInfo System to PVars with #define -
admantis - 08.01.2011
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.