Jump to content

DarkStalker30

Members
  • Posts

    40
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by DarkStalker30

  1. YES! THANKS VERY MUCH IT WORKS! Can I ask some questions else? 1. Can I'll write to your's PM for some questions in future? Looks like you are advanced user and can help with many problems 2. Nothing go bad if I use "root" in client events? Because on wiki was written that root should not use, only in specific moments. I tried this too, but without new event it didn't work. And still thank you, that was very important message for best understanding of client triggers!
  2. Hello everyone! I have some server code: function onJoinLogin() local isClientReady = getElementData(source, "client.isready") local timer = true while not isClientReady or not timer do if timer then outputChatBox("Loading on client, wait...", source) isClientReady = getElementData(source, "client.isready") if not isClientReady then timer = false setTimer(function () timer = true end, 100, 1) end end end triggerClientEvent("setCameraForSpawn", source) triggerClientEvent("toggleHUD", source) setElementData(source, "player.isLogined", false) setElementData(source, "player.isActiveChar", false) outputChatBox("Login or reg, please", source) end addEventHandler("onPlayerJoin", root, onJoinLogin) And client code: local logoPath = "logo2.png" local screenWidth, screenHeight = guiGetScreenSize() local logoPNG = dxCreateTexture(logoPath) function createLogo() if logoPNG then dxDrawImage(screenWidth/10 * 9, screenHeight/6 * 5, 128, 128, logoPNG) else outputDebugString("Err logo!") end end addEventHandler("onClientRender", root, createLogo) addEvent("toggleHUD", true) addEventHandler("toggleHUD", root, function () outputDebugString('Toggle HUD!') setPlayerHudComponentVisible("radar", not isPlayerHudComponentVisible("radar")) end) addEvent("setCameraForSpawn", true) addEventHandler("setCameraForSpawn", root, function () outputDebugString('Set camera!') fadeCamera(true) setCameraMatrix(-2656.638, 373.576, 35.809, -2706.585, 376.137, 4.969) end) addEventHandler("onClientResourceStart", root, function () setElementData(root, "client.isready", true) end ) The problem is that client code workes on all players on server, when someone new joining. I tried to change "root" in client code on "localPlayer", "getLocalPlayer()", added "onClientResourceStart" and "set/getElementData()", but it's still don't work. And plus for first time for player camera don't work too, just a black screen. How can I fix it? p.s. New in Lua, but C++ programmer, I think I know some things about programming, but not here readed this topics: https://forum.multitheftauto.com/topic/118393-event-is-not-added-a-clientside-mta/ https://forum.multitheftauto.com/topic/88306-event-is-not-added-to-clientside/ https://forum.multitheftauto.com/topic/63280-server-triggered-clientside-event-but-event-is-not-added/
  3. LOL REALLY THANKS! I wrote the code at night and just forgot about that, Im stupid Thx for help everyone.
  4. Already did, no any errors but didnt work. Debug is OK, right number in data. On spawn I have script for setting skin from data "player.skin" and it's working correct.
  5. Previous and next codes working good, I'm spawning in dimension 0 on right coords and with normal camera. setElementDimension(client, 0) setElementData(client, "player.isCharCreator", false) setElementData(client, "player.sex", charTable[4]) if charTable[4] then setPedWalkingStyle(client, 118) else setPedWalkingStyle(client, 129) end setElementData(client, "player.skin", charTable[7]) local skin = tonumber(charTable[7]) setElementModel(player, skin) setElementData(client, "player.pame", charTable[8]) setElementData(client, "player.isCharCreator", false) spawnPlayer(client, 233.5927734375, -1278.25, 6.351, -100, 0, 0, 0) fadeCamera(client, true) setCameraTarget(client) From client: triggerServerEvent("endCreate", localPlayer)
  6. setElementData(client, "player.isCharCreator", false)--working good setElementData(client, "player.sex", charTable[4])--working good if charTable[4] then setPedWalkingStyle(client, 118)--working too else setPedWalkingStyle(client, 129)--working too end setElementData(client, "player.skin", charTable[7]) local skin = tonumber(charTable[7]) setElementModel(client, skin)--didn't work
  7. So, I trying to change skin for player after registration. Im using setElementModel(client, skin) but it doesn't work. No errors in console or debugscript; "thePlayer", "root" doing errors. setElementData & setPedWalkingStyle working good. How can I change the skin in this way?
  8. I should have understood it by myself ? Very thx!
  9. It's really working, very thx! But sometimes it's lagging and jetpack is on/off many times in a second. Can I fix it somehow?
  10. So, I have a client-side event: addEventHandler("onClientKey", root, function (button,press) if button == "j" then triggerServerEvent("jetpackClicked", root) end end) And I have server-side code: addEvent("jetpackClicked", true) addEventHandler('jetpackClicked', getRootElement(), function ( root ) setPedWearingJetpack ( root, not isPedWearingJetpack(root) ) end) But it's not working because "root" is not a ped. How can I fix it?
  11. Есть карта Vice City, загружается на сервер с помощью скрипта. Как можно её же запустить в Map Editor? Пробовал Import - ничего не пишет в ответ.
  12. Благодарю, я разобрался, там нужен был другой ресурс (MTA-Stream этого же автора).
  13. Хочу ради интереса запустить карту Vice City. Запускаю этот код: addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),function() for i=550,20000 do removeWorldModel(i,10000,0,0,0) end setOcclusionsEnabled(false) -- Also disable occlusions when removing certain models setWaterLevel(-15000) -- Also hide the default water as it will be full of holes end) Карта Vice City эта: https://github.com/Wolfee-J/MTA-Vice-City В mtaserver.conf <!-- play is the default freeroam gamemode. Remove the following line to prevent it from starting. --> <resource src="play" startup="1" protected="0" /> <resource src="deleteStandartMap" startup="1" protected="0" /> <resource src="VC2" startup="1" protected="0" /> <resource src="VCLightGen" startup="1" protected="0" /> <resource src="VCMini" startup="1" protected="0" /> Итог: Как правильно прописать ресурсы, чтобы всё чётко работало? Когда захожу на сервер, какое-то время висит экран в районе Чилиада и идёт подгрузка, но потом всё равно спавнит на обычной карте.
  14. Суть: хочу получить конкретное значение из ячейки SQl. То есть: таблица формата (id, nick, is_admin, level_admin). is_admin булево значение, хочу получить напрямую его. Как правильно это прописать? А также что конкретно возвращает dbQuery и что делает dbPoll? Основная проблема в том, что я относительно новый человек, и очень плохо разбираюсь в LUA. Совершенно не могу этого понять Два дня уже ищу ответ на вопрос, нахожу для других языков, но не могу. Как сделать дб - знаю, как писать код - знаю, а как правильно соединить ДБ и код - не знаю
×
×
  • Create New...