29.12.2011, 09:36
Why?
Yes, I know, but it is only slow on compile. You can do IncreasePVar(playerid, szVariable, -1); to have the same effect like DecreasePVar. The only reason I have made IncreasePVar as the main function, because it is more common to have that. E.g we don't have TakePlayerMoney, but we have GivePlayerMoney, which can do the same effect with negative values.
BTW, we could do this function with stocks, then you would not have to worry about compile speed, but execution speed would be slower (not significantly, PVars are slow enough to be a reason to don't use it)
For now:
Quote:
|
Also, are you aware the the DecreasePVar is slower now? Because it now must replace 3 strings instead of 1. As you (may) know, macro's literally replaces texts (only while compiling - not visual in the pwn like CTRL+H). It's now gonna do this:
|
BTW, we could do this function with stocks, then you would not have to worry about compile speed, but execution speed would be slower (not significantly, PVars are slow enough to be a reason to don't use it)
For now:
pawn Код:
#define IncreasePVarInt(%0,%1,%2) SetPVarInt(%0, %1, GetPVarInt(%0, %1) + %2)
#define DecreasePVarInt(%0,%1,%2) SetPVarInt(%0, %1, GetPVarInt(%0, %1) - %2)
#define IncreasePVarFloat(%0,%1,%2) SetPVarFloat(%0, %1, GetPVarFloat(%0, %1) + %2)
#define DecreasePVarFloat(%0,%1,%2) SetPVarFloat(%0, %1, GetPVarFloat(%0, %1) - %2)


