Jump to content

quindo

Members
  • Posts

    112
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by quindo

  1. I'm encountering same issue even with inline optimizations disabled
  2. Change your timer on server to setTimer( setPedAnimation, 4000, 1, source, false)
  3. Some finds: gta_sa.exe doesn't even seem to start, so i can't even attach the debugger. After clean setup and build pthread(_d).dll seems to be missing from bin/mta folder. Copying it from working copy of mta doesn't help.
  4. Hey, for last 2 days am trying to compile and run mta, i can't run debug version because pthread_d.dll is missing, if i rename pthread.dll to that it just doesn't load the game after optimus settings are chosen. If i try to run release build i get this error: The first address changes on every run. What can i do about that?
  5. Haven't added it, i will look into it when i have some time, for now working on other projects. Should be pretty easy to add, but not sure about how to optimize it properly.
  6. Thanks for info Cody, i guess dark theme has problems with markdown, fixed it.
  7. MTA-Indicators This resource allows player to create custom indicators, both static positions and indicators following target element are possible to be created using this. Main features: Well optimized code, thousands of indicators can be created without causing lags on most PC's. OOP codebase. The resource is very customizable, there are function to get/set pretty much every variable. Example video of it in action: Details and download on Github: Github - MTA-Indicators
  8. I suggest looking into this shader: https://community.multitheftauto.com/?p=resources&s=details&id=7615 you would need to make depth buffer checks to make it not show through walls tho i think. I use a bit modified version of this shader in my project, and it seems to work pretty much like what you want: image
  9. It still may not be exactly 20 even if you set it as so, lua uses doubles(64 bit) to store numbers, which is floating point, the rotation is also floating point, but float(32 bit), at least internally in mta if i remember correctly. It may not be a problem in this case, but i suggest reading a but about floating point precision. Some good sites talking about that: http://0.30000000000000004.com/ a bit more technical: http://fabiensanglard.net/floating_point_visually_explained/
  10. In what situation would it not detect it? I can't think of a single case where it happens.
  11. Are you sure that "asdasd" data is false when you try to delete the timers? otherwise it will just create more timers in place of old ones.
  12. getElementData(thePlayer,"asdasd") You sure this data is set correctly? i don't see you setting it anywhere in the script
  13. The timers are defined in different scope and are local, so they aren't available where you want to destroy them. Delete the "local" from where you create timers, to move their declaration above the function.
  14. Maybe https://wiki.multitheftauto.com/wiki/SetWorldSpecialPropertyEnabled with "randomfoliage" parameter? Not sure if it's gonna do what you need.
  15. Depends on what map do you use, it could be as easy as using https://wiki.multitheftauto.com/wiki/DxDrawCircle to draw the circle on screen.
  16. Something like this should work: local healthlossTime = 1000 local lastHealthLossTick = 0 function isPlayerInCircle(player, cx,cy,radius) local px,py = getElementPosition( player ) return (getDistanceBetweenPoints2D( px, py, cx, cy ) <= radius) end local cx,cy,radius = 0,0,100 function checkPlayerCircleStatus() local currentTick = getTickCount() if (currentTick - lastHealthLossTick) > healthlossTime then if isPlayerInCircle(localPlayer, cx, cy, radius) then local health = getElementHealth( localPlayer ) if health > 0 then setElementHealth( localPlayer, health-10 ) end lastHealthLossTick = currentTick end end end addEventHandler( "onClientRender", root, checkPlayerCircleStatus ) For some explanation, this way doesn't use any markers, it uses "onClientRender" event to take 10 health from player every second when he's inside of circle that has center in point "cx,cy", and has radius of "radius". I haven't tested it, but it should work.
  17. Like this: Client function callServerFunction(funcname, ...) local arg = { ... } if (arg[1]) then for key, value in next, arg do if (type(value) == "number") then arg[key] = tostring(value) end end end -- If the serverside event handler is not in the same resource, replace 'resourceRoot' with the appropriate element triggerServerEvent("onClientCallsServerFunction", resourceRoot , funcname, unpack(arg)) end if player == localPlayer then setTimer( function() callServerFunction( 'createDropPicukup', wepons_models[ weapon ], x1, y1, z1, p_rot, slot, ammo, ammoc ) end, _dropSystem[ pickup ].time +50, 1 ) end Server allowedFunctions = { ["createDropPicukup"]=true} function callServerFunction(funcname, ...) if not allowedFunctions[funcname] then -- Protect server from abuse outputServerLog( "SECURITY: " .. tostring(getPlayerName(client)) .. " tried to use function " .. tostring(funcname) ) return end local arg = { ... } if (arg[1]) then for key, value in next, arg do arg[key] = tonumber(value) or value end end loadstring("return "..funcname)()(unpack(arg)) end addEvent("onClientCallsServerFunction", true) addEventHandler("onClientCallsServerFunction", resourceRoot , callServerFunction) function createDropPicukup ( id, x, y, z, rot, slot, ammo, ammoc ) outputChatBox ( "Red #FFFFFFWhite", getRootElement(), 255, 0, 0, true ) local object = createObject ( id, x, y, z, 87, 0, rot ) setElementCollisionsEnabled ( object, false ) local marker = createMarker ( x, y, z+0.25 + math.random( 0.0500, 0.1005 ) , "corona", 1.3, color_fromSlot[ slot ].r or 255, color_fromSlot[ slot ].g or 255, color_fromSlot[ slot ].b or 255, 12.5, getRootElement() ) setElementData( marker, 'pWeapon', { getIDFromModel( id ), ammo , ammoc } ) attachElements ( marker, object ) setElementParent( object, marker ) end Look that wiki source shows both source that should've been inserted into client and server side
  18. You can't call server functions from client side, those are 2 separate environments, callServers is availible only on the server side, not on client.
  19. Forgot that mta needs double escaping, replace regex in my post with this: local regex = "[\\/\\\\\"\\]\\[\\'\\-{}^$*+?,;:!£%&()_=@#~,<.>?]"
  20. Because there's no disabledKey[username] nor disabledKey[pw], good way of doing this would be using regular expressions, it would look like this: local regex = "[!\"£\$%\^&\*(\)_\+=\-\[\]\{\};\:\'@\#~\,<\.>\/?\\\`]" local username = guiGetText(gui["username"]) local pw = guiGetText(gui["username"]) if pregFind(username, regex) then return outputDebugString("blocked:username") end if pregFind(pw, regex) then return outputDebugString("blocked:pw") end
  21. You can replace original smoothMoveCamera implementation with this, and use stopSmoothMoveCamera() to break the movement at any time. I didn't test it, but it should work. local sm = {} sm.moov = 0 sm.object1,sm.object2 = nil,nil sm.timer1,sm.timer2,sm.timer3 = nil,nil,nil local function removeCamHandler() if(sm.moov == 1)then sm.moov = 0 end end local function camRender() if (sm.moov == 1) then local x1,y1,z1 = getElementPosition(sm.object1) local x2,y2,z2 = getElementPosition(sm.object2) setCameraMatrix(x1,y1,z1,x2,y2,z2) end end addEventHandler("onClientPreRender",root,camRender) function smoothMoveCamera(x1,y1,z1,x1t,y1t,z1t,x2,y2,z2,x2t,y2t,z2t,time) if(sm.moov == 1)then return false end sm.object1 = createObject(1337,x1,y1,z1) sm.object2 = createObject(1337,x1t,y1t,z1t) setElementAlpha(sm.object1,0) setElementAlpha(sm.object2,0) setObjectScale(sm.object1,0.01) setObjectScale(sm.object2,0.01) moveObject(sm.object1,time,x2,y2,z2,0,0,0,"InOutQuad") moveObject(sm.object2,time,x2t,y2t,z2t,0,0,0,"InOutQuad") sm.moov = 1 sm.timer1 = setTimer(removeCamHandler,time,1) sm.timer2 = setTimer(destroyElement,time,1,sm.object1) sm.timer3 = setTimer(destroyElement,time,1,sm.object2) return true end function stopSmoothMoveCamera() if isTimer( sm.timer1 ) then killTimer( sm.timer1 ) end if isTimer( sm.timer2 ) then killTimer( sm.timer2 ) end if isTimer( sm.timer3 ) then killTimer( sm.timer3 ) end if isElement( sm.object1 ) then destroyElement( sm.object1 ) end if isElement( sm.object2 ) then destroyElement( sm.object2 ) end removeCamHandler() end
  22. Maybe something like that? local AnswerToFunction = { npcAnswers[1][2] = wayOne, npcAnswers[1][3] = wayTwo, npcAnswers[1][4] = wayThree, npcAnswers[1][5] = wayFour, npcAnswers[2][2] = way1Option1, npcAnswers[3][2] = way2Option1, npcAnswers[3][3][2] = way2Option1Answer1, npcAnswers[3][4] = way2Option2, npcAnswers[3][5][2] = way2Option1Answer2, npcAnswers[4][2] = way3Option1, npcAnswers[5][2] = way4Option1, npcAnswers[5][3][2] = way4Option1Answer1, npcAnswers[5][4] = way4Option2, npcAnswers[5][5][2] = way4Option2Answer1, } function ChooseAnswers() local guiText = guiGetText( Option[i] ) local answerFunc = AnswerToFunction[guiText] if answerFunc then answerFunc() else outputChatBox("Unknown error. Please report it to admin ASAP.") end end
×
×
  • Create New...