Markn1

Members
  • Content Count

    34
  • Joined

  • Last visited

Community Reputation

2 Neutral

About Markn1

  • Rank
    Rat

Details

  • Gang
    Grove
  • Location
    Russia
  • Occupation
    Yep

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Не могу понять почему модель автомобиля не отправляется на сервер при покупке ее. [server где createvehicle] debug: client: elseif source == carshopBuyVehicle then local r, g, b = getVehicleColor(veh) triggerServerEvent("onPlayerVehicleBuy", localPlayer, localPlayer, getElementModel(veh), getVehicleData(getElementModel(veh))[3], r, g, b, shop) fadeCamera(false) guiSetVisible(carShopWindow, false) guiSetVisible(infoCarShopWindow, false) showCursor(false) setTimer(function() fadeCamera(true) setCameraTarget(localPlayer) setElementDimension(localPlayer, 0) destroyElement(veh) veh = nil showChat(true) setElementFrozen(localPlayer, false) end, 1000, 1) elseif source == carshopNext then if index < #vehShopVehicles[1] then index = index + 1; else index = 1; end if ( isElement ( vehicle ) ) then destroyElement ( vehicle ) end if ( isElement ( veh ) ) then destroyElement ( veh ) end veh = createVehicle ( vehShopVehicles[currentShop][index][1], 554.9150390625,-1289.4499511719,16.657926559448 ); setElementDimension(veh, 1) elseif source == carshopPrev then if index > 1 then index = index - 1; else index = #vehShopVehicles[1] end if ( isElement ( vehicle ) ) then destroyElement ( vehicle ) end if ( isElement ( veh ) ) then destroyElement ( veh ) end veh = createVehicle ( vehShopVehicles[currentShop][index][1], 554.9150390625,-1289.4499511719,16.657926559448 ); setElementDimension(veh, 1) server. function onPlayerVehicleBuy(player, model, price, r, g, b, shop) fadeCamera(player, false) setTimer( function() local owner = getPlayerName(player) local q = mysql:_Query("SELECT * FROM vehicles WHERE owner=?",owner) fadeCamera(player, true) setCameraTarget(player, player) setElementFrozen(player, false) if tonumber(getPlayerMoney(player)) < tonumber(price) then outputChatBox(nex.."[Ошибка]#ffffff Для покупки авто, вам недостаточно средств.", player, 255, 255, 255, true) return end takePlayerMoney(player, tonumber(price)) -- createVehicle - debug [ERROR *170 строка] veh = createVehicle(model, vehShopsTable[shop][4], vehShopsTable[shop][5], vehShopsTable[shop][6]) setElementRotation(veh, 0, 0, vehShopsTable[shop][7]) setVehicleColor(veh, r, g, b, 255, 255, 255) warpPedIntoVehicle(player, veh) ~~ ~~ ~~ shared: vehShopsTable = { -- 1, 2 , 3 - маркер; 4, 5, 6 - позиция автомобиля, 7 - ROT [1] = {539.70989990234, -1287.5334472656, 16.2421875, 544.77709960938,-1275.4229736328,17.248237609863, 180}, [2] = {2131.8623046875, -1151.3229980469, 23.060688018799, 2122.1408691406, -1137.4603271484, 25.201257705688, 180}, [3] = {1889.1101074219, -1317.2145996094, 49.408805847168, -1094.7878417969, 41.567222595215, 180} }
  2. Помогите решить 😏, exp линия выходит за пределы.. при ширине 170 он выходит за пределы. Надо чтоб когда exp достигла своего уровня, сразу на исходную и дальше шел опыт по своему уровню.. не могу понять как правильно сложить все. По разному пробовал.. local xp = getElementData( localPlayer, "expxp" ) or 0; local lvl = getElementData ( localPlayer, "explevel" ) or 0; local nlvl = lvl + 1; local nxp = nlvl*60 + 60*lvl; dxDrawRectangle ( sx - 265, 82, xp*170/170, 23, tocolor ( 47, 112, 150, 150 ) );
  3. debug: attempt to concatenate local 'eCarRZ' ( a nil value ) function createHouse( add, ID, owner, key, eX, eY, eZ, etX, etY, etZ, exX, exY, exZ, extX, extY, extZ, int, dim, cost, nameclass, room, username, eCarX, eCarY, eCarZ, eCarRX, eCarRY, eCarRZ ) if not username then username = "-" end if add then --в этой строке ошибка ( в конце ..eCarRZ.. ) sql.Query( "INSERT INTO house_data ( ID, en_X, en_Y, en_Z, en_tX, en_tY, en_tZ, ex_X, ex_Y, ex_Z, ex_tX, ex_tY, ex_tZ, int, dim, cost, owner, key, nameclass, room, username, eCarX, eCarY, eCarZ, eCarRX, eCarRY, eCarRZ ) VALUES ( "..ID..", "..eX..", "..eY..", "..eZ..", "..etX..", "..etY..", "..etZ..", "..exX..", "..exY..", "..exZ..", "..extX..", "..extY..", "..extZ..", "..int..", "..dim..", "..cost..", '','', \""..nameclass.."\", "..room..", \""..username.."\", "..eCarX..", "..eCarY..", "..eCarZ..", "..eCarRX..", "..eCarRY..", "..eCarRZ.." )" ); end;
  4. Столкнулся с проблемой сохранения, помогите ее решить. Дебаг ничего не выдает 🤔 function onResStartP () executeSQLQuery ( "CREATE TABLE IF NOT EXISTS License ( p_acc TEXT, driving_lic INTEGER DEFAULT 0 )" ); outputDebugString ( "Table license created" ); for i, player in ipairs(getElementsByType("player")) do local acc = getAccountName ( getPlayerAccount ( player ) ); local getDataCS = executeSQLQuery ( "SELECT driving_lic FROM License WHERE p_acc=?", acc ); if ( #getDataCS ~= 0 ) then setElementData ( player, "driving_lic", ( getDataCS[1]["driving_lic"] ) or false ); else executeSQLQuery ( "INSERT INTO License VALUES ( ?, ? )", acc, false ); end end end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource ( ) ), onResStartP ) function onLogin ( _, account ) local acc = getAccountName( account ); local getDataCS = executeSQLQuery ( "SELECT driving_lic FROM License WHERE p_acc=?", acc ); if ( #getDataCS ~= 0 ) then setElementData ( source, "driving_lic", ( getDataCS[1]["driving_lic"] ) or false ); else executeSQLQuery ( "INSERT INTO License VALUES ( ?, ? )", acc, false ); end end addEventHandler ( "onPlayerLogin", root, onLogin ) function onResStop () for i, player in ipairs(getElementsByType("player")) do local acc = getAccountName ( getPlayerAccount ( player ) ); local getLic = ( getElementData ( player, "driving_lic" ) ); executeSQLQuery ( "UPDATE License SET driving_lic=? WHERE p_acc=?", getLic, acc ); end end addEventHandler ( "onResourceStop", getResourceRootElement ( getThisResource ( ) ), onResStop ) function onPlayerQuit ( ) local acc = getAccountName ( getPlayerAccount ( source ) ); local getLic = ( getElementData ( player, "driving_lic" ) ); executeSQLQuery ( "UPDATE License SET driving_lic=? WHERE p_acc=?", getLic, acc ); end addEventHandler( "onPlayerQuit", root, onPlayerQuit ) addEventHandler( "onPlayerLogout", root, onPlayerQuit ) После того как сдал на права: addEvent ( "finishDriveServer", true ) addEventHandler ( "finishDriveServer", root, function ( thePlayer ) local veh = getPedOccupiedVehicle ( source ); local acc = getAccountName ( getPlayerAccount ( source ) ); local getLic = ( getElementData ( thePlayer, "driving_lic" ) ); if veh then local vehHealth = getElementHealth ( veh ) / 10; if ( vehHealth < 60 ) then outputChatBox ( "Автомобиль поврежден более чем на 40%, вы не сдали на права!", source, 255, 255, 255, true ); else setElementData ( source, "driving_lic", true ); outputChatBox ( "Поздравляем, Вы успешно прошли все испытания и сдали на права!", source, 255, 255, 255, true ); executeSQLQuery ( "UPDATE License SET driving_lic=? WHERE p_acc=?", getLic, acc ); end removePedFromVehicle ( source ); destroyElement ( veh ); setElementDimension ( source, 0 ); end end ) Мое предположение, при старте ресурса: setElementData ( player, "driving_lic", ( getDataCS[1]["driving_lic"] ) or false );
  5. Ищу скриптера, надо доделать пару работ. Оплата приветствуется!
  6. Хочу вызвать функцию между 12.00 и 13.00 игрового времени. В чем ошибка? client: addEventHandler ( "onClientResourceStart", resourceRoot, function () local h, m = getTime() if tonumber(h) >= 12 and tonumber(h) < 13 then create () outputChatBox( "works", 255, 0, 255 ) end end , false )
  7. Niccccccccccccccccccccce ♥
  8. Йоу, ребят почему снимаются деньги при нажатие любой кнопки или элемента гуи? Даже если в админ панели нажимать кнопки снимаются деньги что не так сделал? * У меня имеется панель. При нажатия из списка убирается капот на автомобиле и снимаются деньги. Вот часть кода: client: function onClickRow ( btn, vehicle ) if btn ~= 'left' then return false; end; local theply = getLocalPlayer (); local vehicle = getPedOccupiedVehicle( theply ); local row, col = guiGridListGetSelectedItem ( vehList ); if vehicle then if ( row == 0 ) and ( col == 1 ) then triggerServerEvent ( "capot", theply, vehicle ); setVehicleComponentVisible ( vehicle, "bonnet_dummy", false ) end end end addEventHandler("onClientGUIClick", root, onClickRow) server: money = 500 addEvent("capot", true) addEventHandler("capot", root, function (vehicle, theply) if getPlayerMoney(source) > money then takePlayerMoney ( source, tonumber(money) ); setVehicleDoorState ( vehicle, 0, 4 ) else triggerClientEvent ( source, "sendMsg", source, "#ff3333Недостаточно денег!" ); end end )
  9. نعم. أنا بحاجة للحفاظ على معرف اللاعب. ساعدني من فضلك
  10. Hello! The problem with the database, namely the preservation of the player's ID. For example, if the player has an identifier (50) and the next time the player connects to the account, he will have 50. Even if he is one on the server. Help me please! code > server ids = {} function displayLoadedRes ( res ) max_players = getServerConfigSetting ( "maxplayers" ) exports.scoreboard:scoreboardAddColumn("playerid", root, 30, "ID", 1) for i = 1, max_players do table.insert ( ids, false ) end for i, v in ipairs ( getElementsByType ( 'player' )) do assignPlayerFreeID ( v ) end end addEventHandler ( "onResourceStart", getResourceRootElement(), displayLoadedRes ) function assignPlayerFreeID ( player ) local assigned = false if isElement ( player ) then for i, v in ipairs (ids) do if not isElement(v) then assigned = i ids[i] = player break end end if assigned then setElementData ( player, "playerid", assigned ) return true else outputChatBox ( 'Невозможно подобрать свободный ид для игрока '..getPlayerName ( player )) kickPlayer ( player ) return false end else return false end end function getPlayerFromID ( id ) for i, v in ipairs ( getElementsByType ( 'player' )) do local playerid = getElementData ( v, "playerid" ) if playerid and playerid == tonumber(id) then return v end end return false end -- SAVE ( DB ) createDB = dbConnect( "sqlite", "save.db" ) if createDB then outputDebugString("DB ON") else outputDebugString("DB Fail") end addEventHandler( "onResourceStart", getRootElement(), function() if createDB then local tabela = dbExec( createDB, "CREATE TABLE IF NOT EXISTS save ( login, playerid )" ) else return false end end ) addEventHandler( "onPlayerLogin", getRootElement(), function( pre, cur ) if not isGuestAccount ( cur ) then assignPlayerFreeID ( source ) end local login = getAccountName (getPlayerAccount(source)) local q = dbQuery( createDB, "SELECT * FROM save WHERE login=?", login ) local result = dbPoll( q, -1 ) if result then for _, row in ipairs(result) do setElementData ( source, "playerid", row["playerid"] ) end end end ) function onPlayerQuit ( thePlayer ) local lp = source local pl = getPlayerAccount (lp) if isGuestAccount(pl) then return end local login = getAccountName (pl) local playerid = getElementData ( lp, "playerid" ); local q = dbQuery( createDB, "SELECT * FROM save WHERE login=?", login ) local result = dbPoll( q, -1 ) dbFree(q) if #result == 0 then dbExec( createDB, "INSERT INTO save (login, playerid) VALUES (?,?)", login, playerid ) else dbExec( createDB, "UPDATE save SET login=?, playerid=?", login, playerid ) end end addEventHandler( "onPlayerQuit", getRootElement(), onPlayerQuit ) --addEventHandler( "onPlayerWanted", getRootElement(), onPlayerQuit ) addEventHandler ( "onResourceStop", resourceRoot, function () for _,v in ipairs ( getElementsByType ( "player" ) ) do local pl = getPlayerAccount (v) if isGuestAccount(pl) then return end local login = getAccountName (pl) local playerid = getElementData (v, "playerid" ); local q = dbQuery( createDB, "SELECT * FROM save WHERE login=?", login ) local result = dbPoll( q, -1 ) dbFree(q) if #result == 0 then dbExec( createDB, "INSERT INTO save (login, playerid) VALUES (?,?)", login, playerid ) else dbExec( createDB, "UPDATE save SET login=?, playerid=?", login, playerid ) end end end )
  11. مرحبا بالجميع! أريد الحفاظ على معرف لكل لاعب. بحيث أنه في كل مرة يدخل الحساب كان لديه عدد. على سبيل المثال: إذا كان لدي 50 معرف بحيث بعد إعادة الدخول إلى الملقم سيكون هناك 50. -- server ids = {} function displayLoadedRes ( res ) max_players = getServerConfigSetting ( "maxplayers" ) exports.scoreboard:scoreboardAddColumn("playerid", root, 30, "ID", 1) for i = 1, max_players do table.insert ( ids, false ) end for i, v in ipairs ( getElementsByType ( 'player' )) do assignPlayerFreeID ( v ) end end addEventHandler ( "onResourceStart", getResourceRootElement(), displayLoadedRes ) function assignPlayerFreeID ( player ) local assigned = false if isElement ( player ) then for i, v in ipairs (ids) do if not isElement(v) then assigned = i ids[i] = player break end end if assigned then setElementData ( player, "playerid", assigned ) return true else outputChatBox ( 'Невозможно подобрать свободный ид для игрока '..getPlayerName ( player )) kickPlayer ( player ) return false end else return false end end function getPlayerFromID ( id ) for i, v in ipairs ( getElementsByType ( 'player' )) do local playerid = getElementData ( v, "playerid" ) if playerid and playerid == tonumber(id) then return v end end return false end -- SAVE ( DB ) createDB = dbConnect( "sqlite", "save.db" ) if createDB then outputDebugString("DB ON") else outputDebugString("DB Fail") end addEventHandler( "onResourceStart", getRootElement(), function() if createDB then local tabela = dbExec( createDB, "CREATE TABLE IF NOT EXISTS save ( login, playerid )" ) else return false end end ) addEventHandler( "onPlayerLogin", getRootElement(), function( pre, cur ) if not isGuestAccount ( cur ) then assignPlayerFreeID ( source ) end local login = getAccountName (getPlayerAccount(source)) local q = dbQuery( createDB, "SELECT * FROM save WHERE login=?", login ) local result = dbPoll( q, -1 ) if result then for _, row in ipairs(result) do setElementData ( source, "playerid", row["playerid"] ) end end end ) function onPlayerQuit ( thePlayer ) local lp = source local pl = getPlayerAccount (lp) if isGuestAccount(pl) then return end local login = getAccountName (pl) local playerid = getElementData ( lp, "playerid" ); local q = dbQuery( createDB, "SELECT * FROM save WHERE login=?", login ) local result = dbPoll( q, -1 ) dbFree(q) if #result == 0 then dbExec( createDB, "INSERT INTO save (login, playerid) VALUES (?,?)", login, playerid ) else dbExec( createDB, "UPDATE save SET login=?, playerid=?", login, playerid ) end end addEventHandler( "onPlayerQuit", getRootElement(), onPlayerQuit ) --addEventHandler( "onPlayerWanted", getRootElement(), onPlayerQuit ) addEventHandler ( "onResourceStop", resourceRoot, function () for _,v in ipairs ( getElementsByType ( "player" ) ) do local pl = getPlayerAccount (v) if isGuestAccount(pl) then return end local login = getAccountName (pl) local playerid = getElementData (v, "playerid" ); local q = dbQuery( createDB, "SELECT * FROM save WHERE login=?", login ) local result = dbPoll( q, -1 ) dbFree(q) if #result == 0 then dbExec( createDB, "INSERT INTO save (login, playerid) VALUES (?,?)", login, playerid ) else dbExec( createDB, "UPDATE save SET login=?, playerid=?", login, playerid ) end end end )
  12. no ( function onResRestrt ) - warning and error DEBUG: 1. bad argument @ 'getElementType' [ expected ....... at argument 1, got string 'player'] 2. ERROR: bad argument #1 to 'ipairs' (table expected, got boolean)
  13. يحفظ عند الذهاب إلى الملقم. إذا قمت بإعادة تشغيل المورد، فإنه لن حفظ local saveableData = { ["car"] = true, ["moto"] = true, ["air"] = true } function onStartorLogin (_,acc) setElementData ( source, "car", getAccountData ( acc, "car" ) or false ) setElementData ( source, "moto", getAccountData ( acc, "moto" ) or false ) setElementData ( source, "air", getAccountData ( acc, "air" ) or false ) end addEventHandler("onPlayerLogin", getRootElement(), onStartorLogin ) function onResRestrt (_,acc) setAccountData ( source, "car", getElementData ( acc, "car" ) or false ) setAccountData ( source, "moto", getElementData ( acc, "moto" ) or false ) setAccountData ( source, "air", getElementData ( acc, "air" ) or false ) end addEventHandler("onResourceStop", getRootElement(), onResRestrt ) --// addEventHandler("onResourceStart", getRootElement(), onResRestrt ) function outputChange(dataName,oldValue) if getElementType(source) == "player" then if saveableData[dataName] then setAccountData ( getPlayerAccount ( source ), dataName, getElementData ( source, dataName ) ) end end end addEventHandler("onElementDataChange",getRootElement(),outputChange)