quindo

Members
  • Content count

    100
  • Joined

  • Last visited

  • Days Won

    1

quindo last won the day on August 30 2017

quindo had the most liked content!

Community Reputation

21 Decent

2 Followers

About quindo

  • Rank
    Punk-@ss B*tch

Recent Profile Visitors

855 profile views
  1. [RESOLVED] triggerServerEvent

    In what situation would it not detect it? I can't think of a single case where it happens.
  2. [HELP] Why not working killTimer?

    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.
  3. [HELP] Why not working killTimer?

    getElementData(thePlayer,"asdasd") You sure this data is set correctly? i don't see you setting it anywhere in the script
  4. [HELP] Why not working killTimer?

    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.
  5. [HELP] Remove breakable trees forever.

    Maybe https://wiki.multitheftauto.com/wiki/SetWorldSpecialPropertyEnabled with "randomfoliage" parameter? Not sure if it's gonna do what you need.
  6. Health Loss

    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.
  7. Health Loss

    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.
  8. 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
  9. 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.
  10. DisableCharacters

    Forgot that mta needs double escaping, replace regex in my post with this: local regex = "[\\/\\\\\"\\]\\[\\'\\-{}^$*+?,;:!£%&()_=@#~,<.>?]"
  11. DisableCharacters

    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
  12. Break smoothMoveCamera()

    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
  13. Script Efficiency & Readability

    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
  14. Command

    You are checking if boss is true after you already changed player stats, you need to do that before, and return from function if it's true.
  15. I sure did, passwordHash gives you hashed password, which you store in database, passwordVerify only checks if given password results in that given hash, you can't get password from hash. The original password isn't stored anywhere.