βurak
Members-
Posts
376 -
Joined
-
Last visited
-
Days Won
22
Everything posted by βurak
-
try this for models https://mtaclub.eu/pcrypt
-
addEventHandler("onClientVehicleEnter", root, function(player) local vehicleID = getElementModel(source) if(vehicleID == 425) then toggleControl("vehicle_fire", false) --rockets toggleControl("vehicle_secondary_fire", false) --hunter's minigun end end ) addEventHandler("onClientVehicleExit", root, function(player) local vehicleID = getElementModel(source) if(vehicleID == 425) then toggleControl("vehicle_fire", true) --rockets toggleControl("vehicle_secondary_fire", true) --hunter's minigun end end ) you can do it this way i didn't test it but
- 1 reply
-
- 1
-
-
Can you give us the error written in debugscript so that we can help you? or tell what is not working
-
can you show the code and also show the error you got let's see what we can do
-
I think the mysql_connect function may not work properly anymore because it belongs to the old mysql module, it is very old, now try using dbConnect
-
addEvent("startMinerJob", true) function startJob(thePlayer) if not (getElementData(thePlayer, "Jobs") == "miner") then setElementData(thePlayer, "Jobs", "miner") end function plant(thePlayer) if (getElementData(thePlayer, "Jobs") == "miner") then x, y, z = getElementPosition(thePlayer) disx = 611.54028 disy = 878.61017 disz = -42.9609 if (getDistanceBetweenPoints3D(x, y, z, disx, disy, disz) < 90) then outputChatBox("Bomb Planted!", thePlayer, 255, 0, 0) setTimer(function() createExplosion(x, y, z, 10) stone1 = createObject(3930, x+0, y+1, z-0.5) stone2 = createObject(3930, x+1*2, y+3, z-0.5) stone3 = createObject(3930, x+2*2, y+2, z-0.5) stone4 = createObject(3930, x+3*2, y+5, z-0.5) stone5 = createObject(3930, x+4*2, y+4, z-0.5) x1, y1, z1 = getElementPosition(stone1) x2, y2, z2 = getElementPosition(stone2) x3, y3, z3 = getElementPosition(stone3) x4, y4, z4 = getElementPosition(stone4) x5, y5, z5 = getElementPosition(stone5) marker1 = createMarker(x1, y1, z1, "cylinder", 1.0, 0, 0, 0, 0) marker2 = createMarker(x2, y2, z2, "cylinder", 1.0, 0, 0, 0, 0) marker3 = createMarker(x3, y3, z3, "cylinder", 1.0, 0, 0, 0, 0) marker4 = createMarker(x4, y4, z4, "cylinder", 1.0, 0, 0, 0, 0) marker5 = createMarker(x5, y5, z5, "cylinder", 1.0, 0, 0, 0, 0) addEventHandler("onMarkerHit", marker1, function(thePlayer) setPedFrozen(thePlayer, true) setPedAnimation(thePlayer, "FIGHT_B", "FightB_G", -1, false, false, false, false) destroyElement(marker1) setTimer(function(stone1) destroyElement(stone1) setPedFrozen(thePlayer, false) givePlayerMoney(thePlayer, 300) end, 3000, 1,stone1) end) addEventHandler("onMarkerHit", marker2, function(thePlayer) setPedFrozen(thePlayer, true) setPedAnimation(thePlayer, "FIGHT_B", "FightB_G", -1, false, false, false, false) destroyElement(marker2) setTimer(function(stone2) destroyElement(stone2) setPedFrozen(thePlayer, false) givePlayerMoney(thePlayer, 300) end, 3000, 1,stone2) end) addEventHandler("onMarkerHit", marker3, function(thePlayer) setPedFrozen(thePlayer, true) setPedAnimation(thePlayer, "FIGHT_B", "FightB_G", -1, false, false, false, false) destroyElement(marker3) setTimer(function(stone3) destroyElement(stone3) setPedFrozen(thePlayer, false) givePlayerMoney(thePlayer, 300) end, 3000, 1,stone3) end) addEventHandler("onMarkerHit", marker4, function(thePlayer) setPedFrozen(thePlayer, true) setPedAnimation(thePlayer, "FIGHT_B", "FightB_G", -1, false, false, false, false) destroyElement(marker4) setTimer(function(stone4) destroyElement(stone4) setPedFrozen(thePlayer, false) givePlayerMoney(thePlayer, 300) end, 3000, 1,stone4) end) addEventHandler("onMarkerHit", marker5, function(thePlayer) setPedFrozen(thePlayer, true) setPedAnimation(thePlayer, "FIGHT_B", "FightB_G", -1, false, false, false, false) destroyElement(marker5) setTimer(function(stone5) destroyElement(stone5) setPedFrozen(thePlayer, false) givePlayerMoney(thePlayer, 300) end, 3000, 1, stone5) end) end, 5000, 1) end end end addCommandHandler("plant", plant) end addEventHandler("startMinerJob", root, startJob) --[[ Leave Miner Job Section ]] addEvent("leaveMinerJob", true) function leaveJob(thePlayer) if (getElementData(thePlayer, "Jobs") == "miner") then setElementData(thePlayer, "Jobs", nil) outputChatBox("you leaved miner job!", thePlayer, 0, 255, 0) end end addEventHandler("leaveMinerJob", root, leaveJob) try this
-
You're welcome. please open more topics i would like to help you
-
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
-
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 )
-
You're welcome. If you have any other questions, open a topic, I'll help as much as I can.
-
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)
-
You're welcome. If there's anything else you don't know, open a topic, I'll help as much as I can.
-
same. No change in createVehicle function make another lua file and specify meta.xml as server side
-
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
-
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
-
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
-
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
-
very descriptive thank you
-
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)
-
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
-
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
-
can you show the server side?
-
Change resourceRoot to localPlayer triggerServerEvent("StartTreeJob", localPlayer, localPlayer)
