View Single Post
JusTGo
Veteran Member
Join Date: Mar 2013
Old 02-04-2023 , 13:27   Re: OciXCrom's Rank System [XP|Levels|Ranks]
Reply With Quote #838

Quote:
Originally Posted by DruGzOG View Post
Any idea to prevent this?
Yes it should be easy to fix, Just create a variable and set it to true once the player data is loaded, Then when saving data use the variable to see if the player's data got loaded and only save if the variable is set to true

It should look something like this:

PHP Code:
new bool:gLoaded[33]

public 
saveData(id) {
  if(
gLoaded[id] != true) return;
  
  
// The rest of the code
}

public 
loadData(id) {

  
// after data is retrived
  
gLoaded[id] = true;
}

public 
client_disconnected(id) {
  
// Make sure to mark the data as unloaded after player disconnects after saving it for the last time or else the save will not be executed
  
saveData(id)
  
gLoaded[id] = false;

__________________
JusTGo is offline