Posts: 112
Threads: 14
Joined: Jan 2014
Reputation:
0
Hello, I'm converting my gamemode from SQLite to MySQL and I was wondering: should I convert everything? or should i keep some tables on sqlite?
Posts: 102
Threads: 2
Joined: Jul 2017
anyway to optimise this
PHP код:
if(ServerInfo[AntiSwear] == 1 && PlayerInfo[playerid][Level] < MAX_ADMIN_LEVEL)
{
new pos;
for(new s; s < ForbiddenWordCount; s++)
{
while((pos = strfind(text,ForbiddenWords[s],true)) != -1)
{
for(new i = pos, j = pos + strlen(ForbiddenWords[s]); i < j; i++) text[i] = '*';
}
}
+ rep for helper
Posts: 2,528
Threads: 124
Joined: Jul 2009
Reputation:
0
No, cache is cleared automatically after your callback function is finished.
Posts: 240
Threads: 5
Joined: Nov 2017
Quote:
Originally Posted by GaByM
Should I expect memory leaks if I don't use cache_unset_active() after a threaded 'SELECT' query?
PHP код:
main()
{
new MySQL:d = mysql_connect("localhost", "gabi", "gabi", "test");
mysql_tquery(d, "SELECT * FROM alog;", "ff");
return 1;
}
forward ff();
public ff()
{
//cache_get_value_name..
//cache_get_value_name_int...etc
return 1;//Results deleted??
}
|
return 1;//Results deleted??
yes its cleared. you wont get memory leaks
Posts: 112
Threads: 14
Joined: Jan 2014
Reputation:
0
Is it a bad idea to save players's data just on disconnect/payday?
Posts: 6,242
Threads: 8
Joined: Jun 2008
Quote:
Originally Posted by GaByM
Is it a bad idea to save players's data just on disconnect/payday?
|
It should be every 5 minutes or so. With a forced save via commands that will shut down the server, or via an admin command that can simply be used to save manually.
As long as you don't overload timers, it's a good idea to save as much as you can. (Just prioritize what you are saving in these sweeps too. Level, cash, position... Good things to save. Bad things to save all the time, are things like IP (As it only needs to be noted once per session as it won't change) or passwords, and any variables that don't actually change as much.)
Posts: 1,661
Threads: 47
Joined: May 2013
Reputation:
0
You should save player data once it's changed, rather than large queries that save everything all together.
[HLF]Southclaw
Unregistered
Quote:
Originally Posted by Lucases
some cases where OnPlayerDisconnect doesn't get called
|
I'm interested, I'd like to know examples of these cases.
Quote:
Originally Posted by Dignity
You should save player data once it's changed, rather than large queries that save everything all together.
|
Yes, this is the best solution. Unless it's a metric that changes very often, save it only when it changes. And remember you don't need to save every metric at the same time, just save the bits that change.
Posts: 654
Threads: 161
Joined: Dec 2015
Reputation:
0
SAMP 0.3.8 supports custom vehicle models, right?
Posts: 186
Threads: 36
Joined: Dec 2017
Quote:
Originally Posted by NealPeteros
SAMP 0.3.8 supports custom vehicle models, right?
|
No 0.3.8 not supports custom vehicles
Posts: 186
Threads: 36
Joined: Dec 2017
how can i make put player in boot i need help
Posts: 112
Threads: 14
Joined: Jan 2014
Reputation:
0
What can happen if I use a function to return a string? I heard is is bad practice, but idk when, how and what could happen
Posts: 1,506
Threads: 13
Joined: Jun 2015
Quote:
Originally Posted by GaByM
What can happen if I use a function to return a string? I heard is is bad practice, but idk when, how and what could happen
|
Actually its better to use a function to return any kind of data, it can be from a array, the function itself or the database because it's better to read the code and cleaner. And about the practice matters, it's a good practice because of readability but not optimization.
I now consider readability and optimization both important together whenever possible but when it's not, I go for readability (matters though)...
So look in my COD script I've a array with rank names and their scores, I use a function called return
PHP Code:
GetRankName(rankid) {
new rankname[MAX_RANK_NAME_LEN];
format(rankname, sizeof rankname, gRanks[rankid][E_RANK_NAME]);
return rankname;
} // Written in the web browser, neglect the indentation
which just makes this code
PHP Code:
gRanks[rankid][E_RANK_NAME]
more easier to read and write.