Jump to content

βurak

Members
  • Posts

    370
  • Joined

  • Last visited

  • Days Won

    21

Everything posted by βurak

  1. You're welcome. please open more topics i would like to help you
  2. loadstring(exports.dgs:dgsImportFunction())() local IsOn = false local sW, sH = dgsGetScreenSize() function doPhone() if(IsOn) then return end rrn = dgsCreateRoundRect(30,false, tocolor(0,0,0,255)) phone = dgsCreateImage( sW * 0.7, sH * 0.5, sW * 0.20, sH * 0.50, rrn, false) app_texture1 = dxCreateTexture("ohnoe.jpg") app1 = dgsCreateRoundRect(30,false, tocolor(255,255,255,255)) app = dgsCreateImage( sW * 0.750, sH * 0.650, sW * 0.10, sH * 0.15, app1, false) app_button = dgsCreateButton( sW * 0.750, sH * 0.650, sW * 0.10, sH * 0.15, "", false, _, tocolor(0,0,0,0) ) dgsRoundRectSetTexture(app1, app_texture1) dgsSetLayer (app_button,"top") dgsSetAlpha(app_button, 0) addEventHandler("onDgsMouseClickDown", app_button, app1Func) IsOn = true -- animations end function removePhone() if(not IsOn) then return end removeEventHandler("onDgsMouseClickDown", app_button, app1Func) destroyElement(rrn) destroyElement(phone) destroyElement(app_texture1) destroyElement(app1) destroyElement(app) destroyElement(app_button) IsOn = false end function togglePhone() if(IsOn) then removePhone() else doPhone() end end bindKey("n", "down", togglePhone) function app1Func() outputChatBox("hey") end I didn't test it but can you try this
  3. for some reason collision is not detected because the marker is small set the size of the marker to 1.5 to fix this issue or if you want to keep the marker small, create a colshape and reference the collision to the colshape local e1 = createMarker(2105.47534, -1806.58765, 12.55469, "cylinder", 1.5, 255, 255, 255, 50) local e = createMarker(362.98032, -75.25889, 1000.50781, "cylinder", 1.5, 255, 255, 255, 50) setElementInterior(e, 10) -- INSIDE addEventHandler("onMarkerHit", e1, function(hitElement, matchingDimension) if(getElementType(hitElement) == "player") then setElementInterior(hitElement, 10) setElementPosition(hitElement, 365.33194, -73.90823, 1001.50781) end end ) -- OUTSIDE addEventHandler("onMarkerHit", e, function(hitElement, matchingDimension) if(getElementType(hitElement) == "player") then setElementInterior(hitElement, 0) setElementPosition(hitElement, 2100.90894, -1806.63440, 13.55469) end end )
  4. You're welcome. If you have any other questions, open a topic, I'll help as much as I can.
  5. the player in your code is ambiguous if you want to do it for all players then pull all players with for loop like this if you're going to do this for a single player it depends on the situation instead you should explain it function Kamshodan() setTimer( function() for _,player in pairs(getElementsByType("player")) do setPedStat(player, 23, getPedStat ( player, 23 ) - 2) setPedStat(player, 22, getPedStat ( player, 22 ) + 2) end end,3600, 1) end addEventHandler ('onResourceStart', getRootElement(), Kamshodan)
  6. I have no idea about it, it might be something math related
  7. You're welcome. If there's anything else you don't know, open a topic, I'll help as much as I can.
  8. same. No change in createVehicle function make another lua file and specify meta.xml as server side
  9. function getPositionFromElementOffset(element,offX,offY,offZ) local m = getElementMatrix ( element ) -- Get the matrix local x = offX * m[1][1] + offY * m[2][1] + offZ * m[3][1] + m[4][1] -- Apply transform local y = offX * m[1][2] + offY * m[2][2] + offZ * m[3][2] + m[4][2] local z = offX * m[1][3] + offY * m[2][3] + offZ * m[3][3] + m[4][3] return x, y, z -- Return the transformed point end x,y,z = getElementPosition(localPlayer) local camera = createObject(367,x, y, z) function updatePed() setElementBoneRotation(localPlayer,22,0, -60, 0) setElementBoneRotation(localPlayer,23,90, -100, 80) setElementBoneRotation(localPlayer,24,80, 30, 0) setElementBoneRotation(localPlayer,32,0, -85, 10) setElementBoneRotation(localPlayer,33,-70, -108, -30) updateElementRpHAnim (localPlayer) addEventHandler ("onClientPedsProcessed", getRootElement(), updatePed) end addCommandHandler("setanim1",updatePed) function dadancamera() setElementData(camera,"startlive",true) --triggerServerEvent("messagelive",root) exports.bone_attach:attachElementToBone(camera,localPlayer,1, 0.15, 0.25, -0.1, 0, 0, 90) end addCommandHandler("setanim1",dadancamera) function updatePed2() removeEventHandler("onClientPedsProcessed", getRootElement(), updatePed) destroyElement(camera) end addCommandHandler("setanim2",updatePed2) function didanlive() if getElementData(camera,"startlive") == true then addEventHandler ( "onClientRender", root, didanlive ) x,y,z = getElementPosition(localPlayer) x2,y2,z2 = getElementPosition(camera) x4,y4,z4 = getElementRotation(camera) local _,_, pRotZ = getElementRotation(localPlayer) local fx, fy, fz = getPositionFromElementOffset(camera, 10,0,0) setCameraMatrix(x2,y2,z2, fx,fy,fz) end end addCommandHandler("live",didanlive) function camset() setCameraTarget(localPlayer) removeEventHandler ( "onClientRender", root, didanlive ) end addCommandHandler("ended",camset) can you try this
  10. addEventHandler("onClientPlayerDamage",root, function() local isKnocked = getElementData(source,"playerFallen") if(isKnocked) then cancelEvent() end end) I didn't test the code but you can add this code above your code it will check when "onClientPlayerDamage" event is triggered
  11. can you show it as a picture?
  12. addEventHandler("onResourceStart", resourceRoot, function() for i,v in ipairs(getElementsByType('player')) do setElementData(v, "data.playerID", i) end end ) addEventHandler("onPlayerJoin", root, function() for i,v in ipairs(getElementsByType('player')) do setElementData(v, "data.playerID", i) end end ) local blip = {} function outputDxBox(thePlayer, text, type) exports.Scripts_Dxmessages:outputDx(thePlayer, text, type) end function getPlayerFromPartialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end function getPlayerByID(id) for _,player in pairs(getElementsByType("player")) do local pID = getElementData(player, "data.playerID") if(pID) then if(pID == id) then return player end end end return false end function setPlayerFallen(player, state) if state == true then toggleAllControls(player, false) toggleControl(player, "chatbox", true) setElementHealth(player, 50) setElementData(player, "playerFallen", true) setElementFrozen(player, true) triggerClientEvent(player, "startDeadTime", player) end if state == false then setElementHealth(player, 50) triggerClientEvent(player, "stopDeadTime", player) toggleAllControls(player, true) setElementData(player, "playerFallen", false) setElementFrozen(player, false) end end function checkData() for i, player in pairs (getElementsByType("player")) do if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("SAMU")) then if not getElementData(player, "jobSAMU") then setElementData(player, "jobSAMU", true) end end end end addEventHandler("onPlayerLogin", root, checkData) addEventHandler("onPlayerSpawn", root, checkData) addEventHandler("onResourceStart", resourceRoot, checkData) function checkHealth() for i, player in pairs (getElementsByType("player")) do if not getElementData(player, "playerFallen") then local conta = getAccountName(getPlayerAccount(player)) if getElementHealth(player) >= 1 then if getElementHealth(player) <= hpFallen then removePedFromVehicle(player) setPlayerFallen(player, true) setPedAnimation(player, "SWEET", "Sweet_injuredloop", 1000, false, false, false, true) triggerClientEvent(player, "startDeadTime", player) outputDxBox(player, 'Digite "/192" e espere que um SAMU venha e o cure ou morrerá em 3 minutos.', "warning") --if getElementData(player, "playerFallen") then setTimer(function() if getElementData(player, "playerFallen") then setElementData(player, "playerFallen", false) setPlayerFallen(player, false) triggerClientEvent(player, "stopDeadTime", player) if isElement ( blip[player] ) then destroyElement(blip[player]) end killPlayer(player) outputDxBox(player, "Você demorou para ser curado e acabou morrendo!", "info") end end, 180000, 1) --end end end end end end setTimer(checkHealth, 1000, 0) function helpCommand(source) for i, player in pairs (getElementsByType("player")) do if getElementData(source, "playerFallen") then local accName = getAccountName ( getPlayerAccount ( player ) ) outputDxBox(source, "Você ligou para o número de emergência! Aguarde.", "info") if ( isObjectInACLGroup ("user."..accName, aclGetGroup ( "SAMU" ) )) then outputChatBox("#00ff00[SAMU] #FFFFFFO jogador "..getPlayerName(source).." #FFFFFFestá pedindo socorro! Procurem o blip de coração.", player, 255, 255, 255, true) outputChatBox("#00ff00[SAMU] #FFFFFFO ID da chamada é: #00ff00("..getElementData(source, "data.playerID")..")", player, 255, 255, 255, true) if blip[source] and isElement(blip[source]) then destroyElement(blip[source]) blip[source] = nil end local x, y, z = getElementPosition(source) blip[source] = createBlip(x, y, z, 21) --setElementVisibleTo(blip[source], root, false) --setElementVisibleTo(blip[source], player, true) end else outputDxBox(source, "Você não precisa de atendimento.", "error") end end end addCommandHandler("192", helpCommand) function onWasted(killer) if getElementData(source, "playerFallen") then setPlayerFallen(source, false) setElementData(source, "playerFallen", false) triggerClientEvent(source, "stopDeadTime", source) if blip[source] and isElement(blip[source]) then destroyElement(blip[source]) blip[source] = nil end end end addEventHandler("onPlayerWasted", root, onWasted) function onQuit() for i, player in pairs (getElementsByType("player")) do if getElementData(player, "playerFallen") then if blip[player] and isElement(blip[player]) then destroyElement(blip[player]) blip[player] = nil end end end end addEventHandler("onPlayerQuit", root, onQuit) function secret() for i, player in pairs (getElementsByType("player")) do setPlayerFallen(player, false) end end addCommandHandler("vzrapollo", secret) function curarPlayer(thePlayer, command, playerID) if nameP then if getPlayerByID(playerID) then local conta = getAccountName (getPlayerAccount(thePlayer)) if isObjectInACLGroup("user."..conta, aclGetGroup("SAMU")) then local idPlayer = getPlayerByID(playerID) local nameR = getPlayerName(idPlayer) local wanted = getPlayerWantedLevel(idPlayer) local px, py, pz = getElementPosition(thePlayer) local rx, ry, rz = getElementPosition(idPlayer) local distancia = getDistanceBetweenPoints3D(px, py, pz, rx, ry, rz) local medKit = getElementData(thePlayer, "KitMedico") or 10000000 if (distancia > 3) then outputDxBox(thePlayer, "Você precisa chegar mais perto do jogador para curá-lo.", "error") elseif (distancia < 2) then if getElementData(idPlayer, "playerFallen") then setPedAnimation(thePlayer, "BOMBER", "BOM_Plant", 1000, false) if isElement ( blip[idPlayer] ) then destroyElement(blip[idPlayer]) end outputDxBox(thePlayer, "Curando jogador...", "info") setTimer(function() setPedAnimation(thePlayer, "ped", "facanger") setPedAnimation(idPlayer, "ped", "facanger") end, 5000, 1) setTimer(outputDxBox, 5000, 1, thePlayer, "Você curou o jogador "..nameR, "success") --setTimer(outputDxBox, 5000, 1, thePlayer, "Caso fique bugado use #00ff00/debug", "success") setTimer(outputDxBox, 5000, 1, idPlayer, "Você foi curado por um médico!", "success") --setTimer(outputDxBox, 5000, 1, namePlayer, "Caso fique bugado use #00ff00/debug!", "success") setTimer(givePlayerMoney, 5000, 1, thePlayer, 3000) setTimer(setPlayerFallen, 5000, 1, idPlayer, false) setTimer(function() setElementData ( thePlayer, "AirNewSCR_LiberarXP", "Sim" ) setPedAnimation ( thePlayer ) setPedAnimation ( idPlayer ) end, 6000, 1) else outputDxBox(thePlayer, "O jogador não precisa ser curado.", "error") end end else outputDxBox(thePlayer, "Permissão negada para teste comando!", "error") end end else outputDxBox(thePlayer, "Erro! O correto é /curar Nome", "error") end end addCommandHandler("curar", curarPlayer) I didn't test it but you'll get back to me when you try
  13. You can't ride the cars on the client side, create the car on the server side You can't ride the cars on the client side, create the car on the server side You can't ride the cars on the client side, create the car on the server sid
  14. very descriptive thank you
  15. yes i was really thinking wrong separating it into functions is a good idea than writing all the artificial intelligence in one place thanks IIYAMA I have another question, which one do you think I should use to store the peds, I'm undecided between these two but do you have a better idea? local allpeds = {} local testped = createPed(0, 0,0,3) allpeds[testped] = true --or local allpeds = {} local testped = createPed(0, 0,0,3) table.insert(allpeds, testped)
  16. Thanks for your answer, it's okay to find the values in the table, the problem is that I want to make zombie artificial intelligence, zombies will be stored in the table, I will update the artificial intelligence with the timer, but here there will be nested if structures and a complex one will appear. something like this will happen function updateAI() if(not isInWater and not dead and not moving) then --do something end end --or function updateAI() if(not isInWater) then if(not dead) then if(not moving) then --do something end end end end in this case I can't use commands like "return" "break" because all zombies have to be updated so I have to go to the next index by the shortest path maybe I don't know my way of thinking is wrong but right now I can't see any way out
  17. hi, can we move to the next index if there is an invalid condition in the loop? example: for i,v in pairs(table_name) do if(not condition) then --if the condition is not met --don't go any further. and go to next index end end
  18. Change resourceRoot to localPlayer triggerServerEvent("StartTreeJob", localPlayer, localPlayer)
  19. βurak

    Table

    not sure but try using table.remove local tables = { [1] = {}, [2] = {}, [3] = {}, } table.remove(tables, 2) --remove 2. nested table for i,v in ipairs(tables) do print(i,v) end --[[ --normally 1 table: 0x5598d3662e90 2 table: 0x5598d3661670 3 table: 0x5598d36616b0 -- after table remove 1 table: 0x555c01b1c6b0 2 table: 0x555c01b1c6f0 ]]--
  20. βurak

    Map Editor

    I'm not sure, but try double-clicking in the editor and make "double sided" true
  21. You're welcome. if you open more threads i will help you as much as i can ?
  22. I haven't tested it but it could be something like this you will need to call the loadPlayerMoney function local db_name = "your db name" --fill your info local db_host = "localhost" local db_user = "your username" --fill your info local db_pass = "your password" --fill your info local DbConnection = dbConnect("mysql", "dbname="..db_name..";host="..db_host..";charset=utf8", db_user, db_pass, "share=1") function loadPlayerMoney(player) local _player = player local playerNick = getPlayerName(_player) dbQuery( function(query, player) local result = dbPoll(query, 0) if(#result <= 0) then return end --if result table 0 dont go for _,data in pairs(result) do setPlayerMoney(player, data["money"]) --set money break end end,{_player}, DbConnection, "SELECT money FROM users WHERE nickname=? LIMIT 1", playerNick) end
  23. βurak

    [HELP]

    can you show the code?
  24. βurak

    [HELP]

    are you calling this event or function somewhere? because if that's the whole code it doesn't do anything because it needs to be called
×
×
  • Create New...