Which is better
#1

Ok got a gamemode, with a series of filterscripts.

User data is used by each filterscript, and this is saved using the dUser system

Have suspicsion that some lag is caused by mass file access, and also suspect some data errors, caused by same sort of issue.


Two different ways of doing same thing
Quote:
Originally Posted by Method 1
dUserSetINT(PlayerName(playerid)).("Dosh", dUserINT(PlayerName(playerid)).("Dosh") + giveamount);
Quote:
Originally Posted by Method 2
playermoney = dUserINT(PlayerName(playerid)).("Dosh2");
dUserSetINT(PlayerName(playerid)).("Dosh", playermoney+ giveamount);
Now I have a suspicision that the second might be a little easier on file access as its not double accessing in same command, but am I right in this thought??

Problem is this particular piece of data is critical and is accessed every time a user spends or gains money (yes I know about on screen money, this is all about reducing a chance of a hack as if the screen and file values done match..
Reply
#2

They're the same thing in essence, if anything Method 2 is slightly worse as the server has to store and retrieve a variable.
Reply
#3

I always use Method 1. No point in creating an extra variable.
Reply
#4

Here its not the variable but the file access thats the issue, is file access worse in 1 or 2 ?
Reply
#5

It shouldn't make a difference as far as file access is concerned, but it will make a difference in terms of lag and extra lines (minuscule amount of lag).

For those reasons method 1 is preferable!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)