Compiler never stops
#1

Hi, I'm trying to implement a server side money system on my GM.
In a very old comment in the forum I found this code, but when I try to compile the GM whit it inside, the compilation never ends, no error windows or message shows... Any help?

The code:
PHP Code:
new money[MAX_PLAYERS];
#define UpdatePlayerMoney(%0); if(money[%0] != GetPlayerMoney(%0)) ResetPlayerMoney(playerid); GivePlayerMoney(money[%0]);
#define GivePlayerMoney(%0,%1); money[%0]+=%1; GivePlayerMoney(%0, money[%0]);
#define GetPlayerMoney(%0) money[%0]
public OnPlayerUpdate(%0UpdatePlayerMoney(%0); 
Sorry if i misspelled something or if a can't explain myself well, i'm not very good in this lenguage. Regards
Reply
#2

Use this, it works even today.
https://sampforum.blast.hk/showthread.php?tid=71136
Reply
#3

Yeah, i found that thread when i was searching for serverside money systems, but i stick with the #define system due to optimisation... Btw, in my lenguage forum someone sugest that the problem is an infinite bucle caused by the 3rd line, and seems correct. Changed the line to a correct form and now it compiles. Have to test if it actually works...
Reply
#4

You think thats optimized? You are using OnPlayerUpdate with your system, thats not optimized at all. That thing gets called MANY times within 1 second. If you want optimized code + secure code use this include:
https://sampforum.blast.hk/showthread.php?tid=594848
Reply
#5

You think thats optimized? You are using OnPlayerUpdate with your system, thats not optimized at all. That thing gets called MANY times within 1 second. If you want optimized code + secure code use this include:
https://sampforum.blast.hk/showthread.php?tid=594848
Reply
#6

Yeah, i remove that when i put it on the gm, cos optimization and i really dont mind not showing to "ilegals players" that i have this system... But that include seems amazing, and simple... is it stable? the WIP tag is... a little bit scary
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)