Jump to content

AshFTW

Members
  • Posts

    15
  • Joined

  • Last visited

Everything posted by AshFTW

  1. WARNING: server.lua:63: Bad argument @ 'dbExec' [Expected db-connection at argument 1] connect = dbConnect ("sqlite", ":veh/vehicles.db") if connect then outputDebugString ('Connect :veh/vehicles.db') else outputDebugString ('Trouble :veh/vehicles.db') end --always success connect --string 30 dbExec(connect, "query on resource start blah blah blah") --string 63 dbExec(connect, "UPDATE query") Whats wrong?
  2. Nonono, whether it is possible to compress this? function requestVehicleHide(vehicle) if isGuestAccount(getPlayerAccount(source)) then return end --[some code] end addEventHandler ("onPlayerLogout", resourceRoot, requestVehicleHide) addEventHandler ("onPlayerQuit", resourceRoot, requestVehicleHide) addEventHandler ("requestVehicleHide", resourceRoot, function (player,vehicle) if isGuestAccount(getPlayerAccount(player)) then return end --[some code] end)
  3. How to realize it here? function requestElementHide(element) if isGuestAccount(getPlayerAccount(source)) then return end --hide function end addEventHandler ("requestElementHide", resourceRoot, requestElementHide) addEventHandler ("onPlayerLogout", resourceRoot, requestElementHide) addEventHandler ("onPlayerQuit", resourceRoot, requestElementHide)
  4. I mostly understand, but when I triggered server event from client side (same resource), it can't be executed. Okay, I have files: :veh/client.lua, where included client GUI :veh/server.lua, where this code will be triggered from client.lua: addEvent("onVehicleBuyRequest", true) addEventHandler("onVehicleBuyRequest", resourceRoot, function(model, price, px, py, pz, rx, ry, rz) local veh = createVehicle (model, px, py, pz, rx, ry, rz) --[blah blah blah] outputChatBox ("Congratulations! You bought a ".. getVehicleNameFromModel(model) .."! Press F2 to see it!", source) end) If i wanna to call "onVehicleBuyRequest" from other resource, I will change addEventHandler("onVehicleBuyRequest", resourceRoot, function(model, price, px, py, pz, rx, ry, rz) to addEventHandler("onVehicleBuyRequest", root, function(model, price, px, py, pz, rx, ry, rz) But I don't wanna do this event available from other resource. I leave "resourceRoot". And... Script won't be executed. Why? Edit: same problem with triggered event from serverside to clientside
  5. Not enough examples here... Many questions about the server-side event, like "I cant feel difference between root and resourceRoot" Not a function. Event. addEvent ("requestInformationUpdate", true) function requestInformationUpdate(vehicle) if isGuestAccount(getPlayerAccount(source)) then return end triggerClientEvent(source,"onVehicleInformationUpdate", source, getElementZoneName(vehicle), getElementHealth(vehicle), getElementData(vehicle,"fuel")) end addEventHandler ("requestInformationUpdate", root, requestInformationUpdate) What if i change "root" to "resourceRoot"?
  6. Can someone explain me, how to use variables like: "root", "resourceRoot", "source", "localPlayer" at client/server side? I just cant feel difference between these elements... For expample, this script will be not work: --server.lua addEventHandler ("onPlayerLogin", resourceRoot, function () triggerClientEvent(source, "onVehiclesDataReceive", source, getPlayerVehicles (source)) end) and I cant understand why, but if I replace 'resourceRoot' to 'root', script will be work. What I must learn (or understand), to avoid those mistakes? (Sorry for bad english)
  7. Обновитесь до версии windows 10 build 10162
  8. AshFTW

    [HELP] sqlite

    Oh, thanx Silva Should I use dbFree()? So this query to create the table is correct? dbExec(connect, "CREATE TABLE IF NOT EXISTS `accounts` (`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE, `nickname` TEXT, `password` TEXT, `email` TEXT);") or i shoud use just "`id` INTEGER AUTOINCREMENT"?
  9. AshFTW

    [HELP] sqlite

    Okay, so, how to get last id? Pleeeaaase Edit: I also try SELECT LAST_INSERT_ID(), but again got error
  10. AshFTW

    [HELP] sqlite

    I have connection to db with this content: +--+----+---+ |id|name|hp | +--+----+---+ |1 |mom |82 | |2 |guy |74 | |5 |gay |69 | |6 |lol |100| |7 |sas |93 | +--+----+---+ So, I wanna to get last available id, it will be 3, then 4, then 8. So, how to write this code? Also I'm thying this code, but get error local q = dbQuery(connect, "SELECT MAX(`id`) FROM `tabname`") res = dbPoll (q, -1) dbFree(q) for k, i in ipairs (res) do outputChatBox("next id is "..res[k]['id']+1) [...]
  11. Oh, thanks a lot! I'll try
  12. After "MTA is up to date" it crashes Windows 10 build 10130 Edit: single player stable high fps 9 fps now Ok, i will try to download and install another game distributive
  13. After connecting to any server, I get low fps (15 fps). Even after disconnecting. Idk what to do. Multi Theft Auto v1.5-release-7331
  14. Try, it will be works perfectly: function getPlayerMedKits(player) local account = getPlayerAccount(player) if not account then outputChatBox("Player not logged in!") return 0 end local medKits = getAccountData(account, "medKits") or 0 return medKits end function setPlayerMedKits(player, amount) local account = getPlayerAccount(player) if not account then outputChatBox("Player not logged in!") return false end setAccountData(account, "medKits", tonumber(amount)) --WTF? getPlayerAccount(player, "medKits", tonumber(amount)) triggerClientEvent(player, "onMedKitLoad", player, tonumber(amount)) return true end
×
×
  • Create New...