job system help
#1

Hello, im making a job system.. but there's a problem..
I have used pInfo[playerid][pJobSelected] = 0/1

0 = not selected
1 = selected



When i restart the server, they get reset.. I've used them when a player registers = 0(Not selected any job)

when 1, job is selected.. when i relog, the jobs do not get RESET.. but when i restart, they get reset..
Reply
#2

when i restart the server*
Reply
#3

Are you saving these in your enum?

Show us where you save this.


Edit: Next time you post a help topic you should add a code which is causing the problem. It makes stuff eaiser.
Reply
#4

saving in MySQL.. if it were enums, then if i would relog, data would get lost, wouldn't it?


When a player disconnects, mysql will set pjobselected(which means the player has selected his job) to 1..

Код:
new query[24];
format(query, sizeof(query), "UPDATE `playerdata` SET `pjobselected` to 1");
mysql_tquery(dbHandle, query);
And it works fine.. when i relog the GAME, my stats are saved, but as i restart the server using /RCON GMX... it resets the stats..
Reply
#5

Hi,

Because you aren't saving it at OnGameModeExit().
You can do it with the for command to save it for all players. But you also should make a saving command which saves it In-Game and everytime you restart you server tell all players to use that command.

Bye.
Reply
#6

Quote:
Originally Posted by div
Посмотреть сообщение
Код:
new query[24];
format(query, sizeof(query), "UPDATE `playerdata` SET `pjobselected` to 1");
mysql_tquery(dbHandle, query);
May i ask you, is this your actual query that you use or is just a representation? Because is wrong
Reply
#7

Use the edit button () instead of double posting, it's there for a reason.
Reply
#8

Quote:
Originally Posted by Logic_
Посмотреть сообщение
Use the edit button () instead of double posting, it's there for a reason.
link please, and read the thread, and check what is *WRITTEN* in it.
Reply
#9

Код:
 new query[60];
format(query, sizeof(query), "UPDATE `playerdata` SET `pjobselected` = 1 WHERE = SOMETHING HERE...");
mysql_tquery(dbHandle, query);
Problem was your size of query. If you had posted MySQL Logs, it would show you that Query is empty because destination array is too small. Query was size of 24 while clearly, there are more than 24 characters.
Reply
#10

fixed myself thank you for your time btw..
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)