[House] Get New House ID
#2

The public is called by the mysql plugin.
Returning anything in that function returns your data to the plugin, not your script.

AFAIK, you should always "return 1;" in those callbacks to inform the plugin to clear the cache.

I think you need to store the result (ID) in a global variable and read that variable where you need it.

Are you trying to determine which ID to use for a new house you create with a command like /createhouse?
Personally, I would load all houses during OnGameModeInit using non-threaded queries (to block the server from being opened before all houses are loaded) and store all data in an array.

Then you could check which index is not used yet (no data) in the array and create your house there, set default data and use an INSERT query to save it to MySQL.
For this to work, you'll need to set the ID column to NOT use auto_increment, as the ID of the house would be the index in the array.
Reply


Messages In This Thread
[House] Get New House ID - by anou1 - 08.03.2014, 20:53
Re: [House] Get New House ID - by PowerPC603 - 08.03.2014, 21:05
Re: [House] Get New House ID - by Mriss - 08.03.2014, 21:06
Re: [House] Get New House ID - by anou1 - 08.03.2014, 21:25
Re : [House] Get New House ID - by anou1 - 09.03.2014, 12:45
Respuesta: [House] Get New House ID - by CuervO - 09.03.2014, 15:12
Re : [House] Get New House ID - by anou1 - 09.03.2014, 16:01

Forum Jump:


Users browsing this thread: 1 Guest(s)