
Hiding
Members-
Posts
63 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Hiding
-
Hi, I would like to ask how can I check the player's serial on the server side and send it to the client? -- Server side function isPlayerAllowed(player) return allowedPlayers[getPlayerSerial(player)] ~= nil end -- Client side function handleKey(button, press) if not imagesEnabled and press and getKeyState("mouse2") then return false for i, allowedImage in ipairs(allowedImages) do if button == allowedImage.key then if isPlayerAllowed(localPlayer) then ... end end end end addEventHandler("onClientKey", root, handleKey)
-
Thank you guys so much ?
-
Thank you guys so much for trying to help me, but I guess you don't get it maybe I have to check with onClientRender when the HP reaches 0, because this onClientVehicleDamage is only triggering if damage happens, but for example when the vehicle is upside down and starts burning, it doesn't actually suffer any damage until it explodes and its life reaches zero. So what I would need is that as soon as the vehicle reaches zero hp output to the chat that "vehicle hp is 0" or something. But if I check it with onClientRender then it will flood the chat until my hp is 0, how can I manage to write once in the chat if the hp is reaching 0?
-
I tried with onClientVehicleDamage, but it only triggered when my car was exploded. I need the localPlayer vehicle's health before the explosion.
-
Hello, my question is how to detect if my vehicle's health is reaching 0? if so then write in the chat that "your vehicle's HP is 0".
-
Thank you so much, it works perfectly now
-
Thank you for your response. This is the server side now: addEventHandler("onResourceStart", resourceRoot, function() local players = getElementsByType("player") for i, player in ipairs(players) do local country = exports.admin:getPlayerCountry(player) triggerClientEvent(player, "onPlayerCountryReceived", resourceRoot, country) end end) And this is the client side: local myCountry = "" addEvent("onPlayerCountryReceived", true) addEventHandler("onPlayerCountryReceived", resourceRoot, function(country) myCountry = country end) But it says that server triggered client side event onPlayerCountryReceived, but event is not added client side.. wtf?
-
Somebody help pls ?
-
De van lua nyelv is local factionMarkers = {} addEventHandler("onClientElementDataChange",resourceRoot,function(key,old,new) if key == "char:factionid" then if new == 1 then factionMarkers["police"] = createMarker() elseif old == 1 then destroyElement(factionMarkers["police") end end end)
-
Hello, I'm trying to get the player's country from admin panel, and use that country in client side, but I always get the error msg: failed to call: 'admin:getPlayerCountry' [string"?"] Admin is running ofc. -- SERVER addEventHandler("onResourceStart", resourceRoot, function() local player = source local country = exports.admin:getPlayerCountry(player) triggerClientEvent(player, "onPlayerCountryReceived", player, country) end) -- CLIENT local myCountry = "" function onPlayerCountryReceived(country) myCountry = country end addEvent("onPlayerCountryReceived", true) addEventHandler("onPlayerCountryReceived", localPlayer, onPlayerCountryReceived)
-
Thank you guys so much, I already get it ?
-
Hello, how to call a function from another resources, for example I have a resource called "one-resource", which contains a function called firstFunction(). How do I get access to this function from the other resource called "second-resource"?
-
Thank you man, it works now ?
-
Thank you, but now the activeButton is not working as well, so it didn't help
-
Hello, I created a window panel, but every time when the cursore is showing, for example if I open the admin panel and click somewhere then this createWindow() is triggering, I mean it appears for a second.. I don't know how to avoid this addEventHandler("onClientClick", root, function(button, state, absoluteX, absoluteY) if button == "left" and state == "down" then local panelX, panelY, buttonHeight, sidebarWidth, screenScale = createWindow() for i, buttonData in ipairs(settingsTitles) do local buttonX = panelX + 4 local buttonY = panelY + (i - 1) * (buttonHeight + 2) local buttonWidth = sidebarWidth - 8 local buttonHeight = 50 * screenScale if absoluteX >= buttonX and absoluteX <= buttonX + buttonWidth and absoluteY >= buttonY and absoluteY <= buttonY + buttonHeight then activeButton = i end end end end) function handleButtonCloseWindow(button, state, absoluteX, absoluteY) if button == "left" and state == "down" then local _ , _ , _ , _ , _ , closeButtonWidth, closeButtonHeight, closeButtonX, closeButtonY = createWindow() if absoluteX >= closeButtonX and absoluteX <= closeButtonX + closeButtonWidth and absoluteY >= closeButtonY and absoluteY <= closeButtonY + closeButtonHeight then isRendering = false showCursor(false) removeEventHandler("onClientRender", root, createWindow) end end end addEventHandler("onClientClick", root, handleButtonCloseWindow) local function addBindKey() isRendering = not isRendering if (isRendering) then addEventHandler("onClientRender", root, createWindow) showCursor(true) else showCursor(false) removeEventHandler("onClientRender", root, createWindow) end end bindKey("F1", "down", addBindKey)
-
Thank you so much ?
-
Hello, I'm wondering why am I still getting this acces denied @ redirectPlayer? I added the ACL rigths to the redirectPlayer function handleClick() if not toggle then return end if isMouseInPosition(sX, sY, width, height) then triggerServerEvent("server", getLocalPlayer()) outputChatBox("Successfully execute this chatbox, but still got error access denied..") end end addEventHandler("onClientClick", getRootElement(), handleClick) addEvent ("server", true) addEventHandler ("server", getRootElement(), function() redirectPlayer (source, ip, port) end ) <acl name="Admin"> <right name="function.redirectPlayer" access="true"></right> Image from web acl: https://files.fm/u/7utn3dfyx?ak=6fc15
-
Thank you guys so much, and ye it's helped me a lot.
-
Hello, my question is that it is possible to change the car color only for me? So other players wont see my changed car color.
-
Thank you so much ?
-
Hello, I'm wondering why throw this error message? <name> expected near '" Some message"' local messages = { message1: " Some message", message2: " Some message2", } outputChatBox(messages.message1, source, 255, 255, 255, true)
-
I see, thank you so much ?
-
I don't think that it's the only option, but thank you
-
I don't want to modify acl too often, I just want if I add user.name in admin panel then it should be changed in every single server as well. So I don't have to add them everywhere.