Jump to content

Lergen

Members
  • Posts

    66
  • Joined

Everything posted by Lergen

  1. I second this notion as well, a public release of it would be a game-changer because we have no optimized ped system. Stuff like peds generally get put on the backburner in favor of working on the server's core gameplay elements/bugfixing since they're not a necessity. It'd be great to have a pre-existing core to work on rather than needing to make one from the ground up, you could probably make a github page or something for it too.
  2. Ah I see, so it's an MTA issue? That's unfortunate. I'll try out what you mentioned though, thanks for the advice! It's hardly a big inconvenience at least, I was just worried it might've been something I did on my end since it's a rather strange problem.
  3. Strange. Yeah, these are default map objects - they're from a vanilla GTASA interior which should be unmodified from any work I've done, it's why it struck me as odd. There's a bunch of objects with no particular commonality on the vanilla SA overworld that are unfortunately plagued by this issue, although replaced objects have it as well - even some playermodels. Sadly it's hard to recall when exactly this cropped up, but I'm pretty sure some of these models were fine at one point, so it's quite strange.
  4. I'm unsure how to best describe this issue other than that, the outlines of certain objects seem to have the peculiar effect of having the current weather's color "bleed through" their outlines when viewed from certain angles, almost as if they had some kind of transparency. For example: The outlines on these vanilla SA objects are blue here, but if the weather were night-time for example, they'd be black. However if I adjust my position a little bit, then the effect entirely disappears. Any idea what causes this, or a possible solution? I've searched quite a bit but haven't seen any other topics on it. I'm unsure if it's an issue with MTA or something on my end, but the issue's been present for quite some time.
  5. 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.
  6. Thank you! I've been playing around with it, and I think I have a pretty solid understanding of how it works now.
  7. 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.
  8. 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 )
  9. Ah I really should've checked the search function first. This was exactly what I was trying to do, thanks a bunch.
  10. 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
  11. 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.
  12. 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.
  13. 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)
  14. 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?
  15. 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.
  16. 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.
  17. That was exactly what I needed. Thank you.
  18. 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!
  19. That did the trick. Thank you guys!
  20. Yeah, that's what I'm trying to do, make sure the attacker isn't the person who died. I tried this, but still couldn't get it working. Am I forgetting something here or doing something wrong? function player_Wasted(ammo, attacker, weapon, bodypart) if isElement(source) and isElement(attacker) and getElementType(attacker) == "player" then if attacker ~= source then end else if(getPlayerTeam(source) == getTeamFromName(team_criminals) or getPlayerTeam(source) == getTeamFromName(team_lnr)) or getPlayerTeam(source) == getTeamFromName(team_gangsters) and (getPlayerTeam(attacker) == getTeamFromName(team_criminals) or getPlayerTeam(attacker) == getTeamFromName(team_lnr)) or getPlayerTeam(attacker) == getTeamFromName(team_gangsters) and getElementData(source, "Group") ~= getElementData(attacker, "Group") and not isTimer(cooldown[attacker]) and getElementData(source,"isInTurf") then local victim_money = getPlayerMoney(source) if victim_money > money_pickpocket_max then victim_money = money_pickpocket_max elseif victim_money < money_pickpocket_min then victim_money = money_pickpocket_min end local money = math.floor(victim_money*(math.random(10,25)/25))
  21. Hello again. I've been playing around with the GTW scripts as they're open source, but I discovered a small problem. Whenever an enemy player dies inside a turf, the player who got the kill receives some money. However, a player can also kill themselves with a grenade or vehicle and still receive the money as if they had killed an enemy. Is there any way to check that the player who just died wasn't themself so they won't receive payment? function player_Wasted(ammo, attacker, weapon, bodypart) if isElement(source) and isElement(attacker) and getElementType(attacker) == "player" then if(getPlayerTeam(source) == getTeamFromName(team_criminals) or getPlayerTeam(source) == getTeamFromName(team_lnr)) or getPlayerTeam(source) == getTeamFromName(team_gangsters) and (getPlayerTeam(attacker) == getTeamFromName(team_criminals) or getPlayerTeam(attacker) == getTeamFromName(team_lnr)) or getPlayerTeam(attacker) == getTeamFromName(team_gangsters) and getElementData(source, "Group") ~= getElementData(attacker, "Group") and not isTimer(cooldown[attacker]) and getElementData(source,"isInTurf") then local victim_money = getPlayerMoney(source) if victim_money > money_pickpocket_max then victim_money = money_pickpocket_max elseif victim_money < money_pickpocket_min then victim_money = money_pickpocket_min end local money = math.floor(victim_money*(math.random(10,25)/25)) givePlayerMoney(attacker, math.floor(money))
  22. Ahhh, that's unfortunate then. I appreciate the heads-up though, thanks!
  23. Thanks! This probably sounds dumb but how would you check that a player selected an animation on the client if it's handled server-side? I'm guessing getPedAnimation would be used.
  24. I looked around a bit, but couldn't find an answer for this. When using https://wiki.multitheftauto.com/wiki/SetPedWalkingStyle is there any way to change the speed a player sprints at while using it? A sprinting ped animation is probably slower than CJ's walking speed. So in other words, when someone is using a ped walking style, is it possible to let them sprint as fast as CJ? I'd greatly appreciate any help.
  25. A little over a month of trying different things but I've still had no luck on this. Everything I've tried just results in the same dead-end: It won't work unless I restart the resource when a new player joins. I have no idea what's going wrong in the script.
×
×
  • Create New...