@K3rhos Hey man I think this is gonna save my server because Im having an issue now where last location doesnt get saved all the time, so all i gotta do is put this in my resouces, start in server.cfg and then import the SQL right?
Also, does this change the default spawn location for new players? I got a custom one and I dont want to change it, I just want returning players last location to be saved.
Hey, I’m receiving an error of this for some reason. I’ve also compiled this script with my other essentiamode scripts into one resource, which shouldn’t affect this at all.
Here is my error code if you’d like to look it over.
InvokeNative: execution failed: Argument at index 1 was null.
Await failure: citizen:/scripting/lua/scheduler.lua:126: Execution of native 000000002f7a49e6 in script host failed.
stack traceback:
[C]: in upvalue '_in'
citizen:/scripting/lua/natives_server.lua:436: in function 'TriggerClientEventInternal'
(...tail calls...)
server/es-pos_server.lua:22: in upvalue 'ref'
citizen:/scripting/lua/scheduler.lua:389: in function <citizen:/scripting/lua/scheduler.lua:388>
[C]: in function 'xpcall'
citizen:/scripting/lua/scheduler.lua:388: in function <citizen:/scripting/lua/scheduler.lua:387>
stack traceback:
citizen:/scripting/lua/scheduler.lua:640: in local 'cb'
server/player/login.lua:133: in upvalue 'handler'
citizen:/scripting/lua/scheduler.lua:219: in function
[ERROR] [MySQL] [lastpostodb] An error happens on MySQL for query "[object Object]": ER_BAD_FIELD_ERROR: Unknown column 'lastpos' in 'field list'
Error: (node:1592) UnhandledPromiseRejectionWarning: AssertionError [ERR_ASSERTION]: unexpected PromiseRejectEvent
at process.<anonymous> (internal/process/promises.js:27:25)
at <anonymous>
at Query.db.query [as _callback] (mysql-async.js:4973:13)
at Query.Sequence.end (mysql-async.js:280:24)
at Query.ErrorPacket (mysql-async.js:2122:8)
at Protocol._parsePacket (mysql-async.js:5941:23)
at Parser.write (mysql-async.js:6198:12)
at Protocol.write (mysql-async.js:5701:16)
at Socket.<anonymous> (mysql-async.js:693:28)
at emitOne (events.js:116:13)
Error: (node:1592) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
Error: (node:1592) UnhandledPromiseRejectionWarning: Error: ER_BAD_FIELD_ERROR: Unknown column 'lastpos' in 'field list'
at Query.Sequence._packetToError (mysql-async.js:244:14)
at Query.ErrorPacket (mysql-async.js:2109:18)
at Protocol._parsePacket (mysql-async.js:5941:23)
at Parser.write (mysql-async.js:6198:12)
at Protocol.write (mysql-async.js:5701:16)
at Socket.<anonymous> (mysql-async.js:693:28)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
--------------------
at Pool.query (mysql-async.js:4728:23)
at Promise (mysql-async.js:4970:12)
at new Promise (<anonymous>)
at execute (mysql-async.js:4967:26)
at Object.global.exports [as callback] (mysql-async.js:4993:5)
at citizen:/scripting/v8/main.js:87:41
Error: (node:1592) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 4)
Thats the easy part… For some reason I can’t get the client to spawn off the coordinates. The client is receiving the location perfectly fine, although SetEntityCoords is not accepting them
– Vous pouvez remplacer {-887.48388671875, -2311.68872070313, -3.50776553153992, 142.503463745117} par la position par defaut où seront spawn les nouveaux utilisateurs
SCRIPT ERROR: @save-position/server.lua:15: attempt to index a nil value (local 'user')
> ref (@save-position/server.lua:15)
> handler (@essentialmode/server/player/login.lua:134)
> handler (@save-position/server.lua:14)
You Need To Change USE[servername] ;
Because if you type essentialmode; it wont exist you need to type the database name like mine is zap i type USE zap1232;