Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vrpex] spawn error #405

Closed
SnaiCrys opened this issue Mar 17, 2018 · 23 comments
Closed

[vrpex] spawn error #405

SnaiCrys opened this issue Mar 17, 2018 · 23 comments

Comments

@SnaiCrys
Copy link
Contributor

SnaiCrys commented Mar 17, 2018

clip2net_180317172315
It happens when you come after the crash.
Then character reset

@ImagicTheCat
Copy link
Member

modules/survival.lua has 219 lines, so error messages are wrong or the file is modified.

@SnaiCrys
Copy link
Contributor Author

SnaiCrys commented Mar 17, 2018

it's my debug print and comments, sorry

155 line

AddEventHandler("vRP:playerJoin",function(user_id,source,name,last_login)
  local data = vRP.getUserDataTable(user_id)
  if data.hunger == nil then
    data.hunger = 0
    data.thirst = 0
  end
end)

@ImagicTheCat
Copy link
Member

ImagicTheCat commented Mar 17, 2018

You can check the user_id validity and check the value of vRP.getUData(user_id, "vRP:datatable"), also check if there are MySQL errors. You can also check the vRP.setUData data in the disconnect event of base.lua.

@SnaiCrys
Copy link
Contributor Author

I don't think I can specifically reproduce this error again. I'll add prints for the future.

@ImagicTheCat
Copy link
Member

There are some reports of money loss, random MySQL errors, etc, so maybe using something else than vrp_mysql will solve those issues.

@SnaiCrys
Copy link
Contributor Author

I'll try to use https://github.com/GHMatti/FiveM-MySQL

@ImagicTheCat
Copy link
Member

ImagicTheCat commented Mar 17, 2018

You can create a driver, I don't know if this resource supports prepared statements, but stability is better than performance for now. If you create a repository, I could help you with the interface.

@SnaiCrys
Copy link
Contributor Author

You mean the fork GHMatti''s MySQL? I have zero knowledge in C#

@ImagicTheCat
Copy link
Member

ImagicTheCat commented Mar 17, 2018

No C#, it's just a bridge resource that depends on vrp and this resource, register a "DB driver" in Lua for vRP and use this resource API. My knowledge (and desire) about C# is poor too, it's why I added this new API to abstract any MySQL resources in vRP. It seems that this one has a Lua API, but I want to be sure that it's working well/easy to install before starting a driver.

@SnaiCrys
Copy link
Contributor Author

@ImagicTheCat
Copy link
Member

I don't know if it's good to do it this way, I will ask on the topic of the creator.

@SnaiCrys
Copy link
Contributor Author

In any case, we comply with AGPLv3

@ImagicTheCat
Copy link
Member

If his work is a standalone resource, it could be better to just write the bridge and let people install his resource with our own.

@SnaiCrys
Copy link
Contributor Author

So it would be better in terms of resource support.

@ImagicTheCat
Copy link
Member

ImagicTheCat commented Mar 17, 2018

Yes (and no duplication of data).

@ImagicTheCat
Copy link
Member

I think I will create a global repository with all the potential bridges inside instead, if you don't mind, easier to manage and they are too specific resources related to vRP core features, not really standalone.

@SnaiCrys
Copy link
Contributor Author

ok, i delete mine

@ImagicTheCat
Copy link
Member

ImagicTheCat commented Mar 17, 2018

It wasn't so difficult, I think I have GHMattiMySQL working well. https://github.com/ImagicTheCat/vRP-db-drivers

@SnaiCrys
Copy link
Contributor Author

SnaiCrys commented Mar 19, 2018

With a new database problem was repeated

tested without ac679a9

[vRP] 31.****193 disconnected (user_id = 41)
[vRP] Paradox (0.0.0.0) joined (user_id = 41)
[vRP] Paradox (0.0.0.0) re-joined (user_id = 41)
[vRP] Paradox (31.****.193) re-joined (user_id = 41)
[vRP] Paradox (0.0.0.0) joined (user_id = 41)
[vRP] 31.****.193 disconnected (user_id = 41)
[vRP] Paradox (31.****.193) joined (user_id = 41)

Then character reset

@SnaiCrys
Copy link
Contributor Author

Error resuming coroutine: citizen:/scripting/lua/scheduler.lua:577: bad argument #1 to 'unpack' (table expected, got no value)
stack traceback:
	[C]: in function 'table.unpack'
	citizen:/scripting/lua/scheduler.lua:577: in function <citizen:/scripting/lua/scheduler.lua:554>
	(...tail calls...)
	base.lua:297: in field 'setUData'
	base.lua:423: in function 'task_save_datatables'

@SnaiCrys
Copy link
Contributor Author

SnaiCrys commented Mar 26, 2018

I don't know why this is happening, but to keep the loop going, it's better to move the SetTimeout to the beginning.

function task_save_datatables()
  SetTimeout(config.save_interval*1000, task_save_datatables) --move  this

  TriggerEvent("vRP:save")

  Debug.log("save datatables")
  for k,v in pairs(vRP.user_tables) do
    vRP.setUData(k,"vRP:datatable",json.encode(v)) -- v==null?
  end
end

@SnaiCrys
Copy link
Contributor Author

SnaiCrys commented Apr 9, 2018

When a lot of players try to connect to a full server, they are stored in a strange way in the DB and die when spawned (because there is no value for hp). Note even that there is no user group
{inventory":{"item":{"amount":5}},"thirst":0,"groups":[],"hunger":0}

@ImagicTheCat
Copy link
Member

Probably irrelevant for vRP 2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants