Lergen

Members
  • Content Count

    37
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Lergen

  • Rank
    Rat

Recent Profile Visitors

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

  1. Very cool, I played around with it on your server for a few minutes. It's nice to see an attempt being made at something like this since the only alternative, NPC HLC, is a real resource hog for servers even with the number of peds toned down. Do you have any plans to release it? I'd love to poke around the code.
  2. Thank you! I've been playing around with it, and I think I have a pretty solid understanding of how it works now.
  3. Thank you for your help, although I'm still a bit confused. So I need to trigger a client-side event from the server to actually pass the information? I tried doing something like this: --SERVER addEvent ("getRandomPlayer",true) function randomPlayer () randomPlayer = getRandomPlayer() triggerClientEvent (root, "checkPlayer", root, randomPlayer) end addEventHandler ("getRandomPlayer", resourceRoot, randomPlayer) --CLIENT addEvent("checkPlayer", true) function checkPlayer ( commandName ) triggerServerEvent ( "getRandomPlayer", resourceRoot, randomPlayer ) outputChatBox ( getPlayerName ( randomPlayer ).." is the player!" ) end addCommandHandler ( "check", checkPlayer ) addEventHandler("checkPlayer", root, checkPlayer) Although this still returns "player" as nil. I know technically you could do this all server-side, I'm just using it as an example to get info from a server-side variable to the client.
  4. Hello. I'm a bit stumped on something and can't quite figure out where I'm going wrong here. I want to pass a variable from the server to the client, but all my attempts return the variable come back as nil. Any advice on what I'm doing wrong here? Here's a simple example where I try to pass "randomPlayer" to output on a client's chatbox but returns the player element as nil. I've read the wiki and some other posts regarding this but I still don't quite get it. Server: addEvent ("getRandomPlayer",true) function randomPlayer () randomPlayer = getRandomPlayer() end addEventHandler ("getRandomPlayer", resourceRoot, randomPlayer) Client: function checkPlayer ( commandName ) triggerServerEvent ( "getRandomPlayer", resourceRoot, randomPlayer ) outputChatBox ( getPlayerName ( randomPlayer ).." is the player!" ) end addCommandHandler ( "check", checkPlayer )
  5. Ah I really should've checked the search function first. This was exactly what I was trying to do, thanks a bunch.
  6. I hate to bump, but I'm afraid I still haven't figured this out. This is the function's source as listed on the wiki: function dxDrawImageOnElement(TheElement,Image,distance,height,width,R,G,B,alpha) local x, y, z = getElementPosition(TheElement) local x2, y2, z2 = getElementPosition(localPlayer) local distance = distance or 20 local height = height or 1 local width = width or 1 local checkBuildings = checkBuildings or true local checkVehicles = checkVehicles or false local checkPeds = checkPeds or false local checkObjects = checkObjects or true local checkDummies = checkDummies or true local seeThroughStuff = seeThroughStuff or false local ignoreSomeObjectsForCamera = ignoreSomeObjectsForCamera or false local ignoredElement = ignoredElement or nil if (isLineOfSightClear(x, y, z, x2, y2, z2, checkBuildings, checkVehicles, checkPeds , checkObjects,checkDummies,seeThroughStuff,ignoreSomeObjectsForCamera,ignoredElement)) then local sx, sy = getScreenFromWorldPosition(x, y, z+height) if(sx) and (sy) then local distanceBetweenPoints = getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) if(distanceBetweenPoints < distance) then dxDrawMaterialLine3D(x, y, z+1+height-(distanceBetweenPoints/distance), x, y, z+height, Image, width-(distanceBetweenPoints/distance), tocolor(R or 255, G or 255, B or 255, alpha or 255)) end end end end
  7. I'm a bit stumped on something - I'm trying to use dxDrawImageOnElement and while it works as it should, it seems you cannot change the the actual height of the image to be any larger like you can with the width argument. You can change the height (location) of the image, but not image's actual size-wise height. Strangely the wiki page lists two different arguments for height that you can use which I'm guessing is what I need, but only one of them seems to work. I'm not sure if this is a mistake or if I'm missing something here. Any ideas? I'd greatly appreciate any help on this.
  8. Lergen

    Script error?

    Thanks for the tip. So after trying that code and starting the script, I get barraged with error messages when I start the video: "bad argument at 'dxDrawimage' [expected material at argument 5, got nil]" and "bad argument at 'loadbrowserURL' [expected browser at argument 1, got nil]" Thinking the problem was with it being that I was using a video file rather than a video URL, I tried the YouTube example on the wiki function renderBSOD() local x, y = guiGetScreenSize() playVideo (0, 0, x, y, "https://www.youtube.com/embed/rRjY8SOZ9Uo?autoplay=1&showinfo=0&rel=0&controls=0&disablekb=1", 90600, false, false) -- bs.png for win7/XP, bs2.png for Win10/modern BSOD screen. change at will end However doing it this way causes the screen to go white and crashes MTA.
  9. Lergen

    Script error?

    Hello. I made a slight modification to Dutchman's BSOD script to play a video rather than display an image, but I'm receiving an error on line 5: "attempt to call global 'playVideo' (a nil value). Can anyone offer some advice as to what's wrong here? I'd greatly appreciate it. local bsodTimer function renderBSOD() local x, y = guiGetScreenSize() playVideo (0, 0, x, y, "bs2.mp4", 90600, false, false) -- bs.png for win7/XP, bs2.png for Win10/modern BSOD screen. change at will end function performPrank(thePlayer) if (thePlayer == getLocalPlayer()) then if (isTimer(bsodTimer)) then killTimer(bsodTimer) end for i = 1, 100 do setWorldSoundEnabled(i, false) end setAmbientSoundEnabled("general", false) setAmbientSoundEnabled("gunfire", false) setInteriorSoundsEnabled(false) showChat(false) setPlayerHudComponentVisible("all", false) setSoundVolume(sound, 0.5) removeEventHandler("onClientRender", getRootElement(), renderBSOD) addEventHandler("onClientRender", getRootElement(), renderBSOD) bsodTimer = setTimer( function() removeEventHandler("onClientRender", getRootElement(), renderBSOD) showChat(true) setPlayerHudComponentVisible("all", true) setAmbientSoundEnabled("general", true) setAmbientSoundEnabled("gunfire", true) setInteriorSoundsEnabled(true) resetWorldSounds() end,420000,1) end end addEvent("showBSODToPlayer", true) addEventHandler("showBSODToPlayer", getRootElement(), performPrank)
  10. Thanks so much for your help! I hate to ask again, but I'm still a bit confused as to where to go from here, as removing those lines still seems to present another error: addEventHandler("onPlayerLogin", root, function(thePlayer, command) local account_name = getAccountName(player_account) if not isObjectInACLGroup("user."..account_name, aclGetGroup("Admin")) and isObjectInACLGroup("user."..account_name, aclGetGroup("Moderator")) then return false end local img = ":admin/client/images/flags/us.png" local country_code = "US" setElementData(thePlayer, "Country", {img, country_code}) return true end ) This now gives me an error on the 4th line: "attempt to concatenate local 'account_name' (a boolean value). Any ideas?
  11. Hello. I've been attempting to modify the scoreboard so that when a moderator/admin logs in, they're automatically assigned the region/flag of the country specified in the Lua script. addEventHandler("onPlayerLogin", root, function(thePlayer, command) local player_account = getPlayerAccount(thePlayer) if not player_account then return false end local account_name = getAccountName(player_account) if not isObjectInACLGroup("user."..account_name, aclGetGroup("Admin")) and isObjectInACLGroup("user."..account_name, aclGetGroup("Moderator")) then return false end local img = ":admin/client/images/flags/us.png" local country_code = "US" setElementData(thePlayer, "Country", {img, country_code}) return true end ) Unfortunately, I seem to be getting an error on the third line: "Bad argument @ 'getPlayerAccount' [Expected element at argument 1, got account]. Can anyone offer any advice on what's going wrong here? Making it a command handler instead of an event handler seems to work, for some reason, but I need it to be on logon rather than through player command.
  12. Hello. I've been trying to make a script so that when a player types the command handler, it draws an image above their head for a few seconds before removing itself. Do you guys have any advice for going about this? I've tried referencing a few resources that do something similar, but still can't get it working.
  13. That was exactly what I needed. Thank you.
  14. Hello. I've had a bit of trouble trying to figure out how to do something. I'm trying to make it so when a player enters water (swimming) it drains his health until he exits it. What's the best way to go about doing this? I've looked around but haven't been able to find any reference points for this. I'd greatly appreciate any help!
  15. That did the trick. Thank you guys!