-
Posts
163 -
Joined
-
Last visited
-
Days Won
3
Everything posted by alex17"
-
function tel1() if isCursorOverRectangle() then setElementPosition ( ) setTimer ( function() setElementPosition ( ) end end, 20000, 1 ) end end it's setTimer not settimer the function inside the timer must end with an end and you also had a comma in the function Finally you needed to close the first if with an end
-
local sx,sy = guiGetScreenSize() local px,py = 1280,720 local x, y = (sx/px), (sy/py) local localP = getLocalPlayer() local data = {} local positions = { {323.9013671875, 2490.8134765625, 15.484375}, {335.341796875, 2486.669921875, 15.484375}, {330.0751953125, 2496.310546875, 15.484375}, {325, 2480.7265625, 15.484375} } addEventHandler("onClientResourceStart", resourceRoot, function() for _, value in ipairs(positions) do local object = createObject(2427, value[1], value[2], value[3]) local colsphere = createColSphere (value[1], value[2], value[3], 1.5) local blip = createBlip(value[1], value[2], value[3], 33, 2.5, 255, 0, 0, 255, 0, 100) data[colsphere] = {object = object, blip = blip, colsphere = colsphere} setObjectScale(value.object, 1.5) addEventHandler("onClientColShapeHit", colsphere, onClientColShapeHit) addEventHandler("onClientColShapeLeave", colsphere, onClientColShapeLeave) end end ) function onClientColShapeHit(element, dimension) if not data[source] then return end if element == localP and dimension then bindKey('F','down', StartSeta, source) addEventHandler('onClientRender', getRootElement(), Text_Seta) end end function onClientColShapeLeave() unbindKey('F','down', StartSeta) removeEventHandler('onClientRender', getRootElement(), Text_Seta) end function StartSeta(_, _, colsphere) if data[colsphere] then unbindKey('F','down', StartSeta) removeEventHandler('onClientRender', getRootElement(), Text_Seta) removeEventHandler("onClientColShapeHit", colsphere, onClientColShapeHit) removeEventHandler("onClientColShapeLeave", colsphere, onClientColShapeLeave) destroyElement(data[colsphere].object) destroyElement(data[colsphere].blip) destroyElement(data[colsphere].colsphere) data[colsphere] = nil end end function Text_Seta () dxDrawText("Use (F) to pick this item", x*481, y*483, x*800, y*501, tocolor(255, 255, 255, 255), 1.35, "default-bold", "center", "top", false, false, false, false, false) end try this
-
local styles = { [280] = 128, [84] = 121, } addEventHandler("onPlayerSpawn", root, function() local model = getElementModel(source) local style = styles[model] if style then setPedWalkingStyle(source, style) end end )
-
because, you are multiplying width for sx dxDrawRoundedRectangle(24*sx, 271*sy, (width+5+5)*sx, 41*sy, 10, tocolor(35, 37, 62, 180), false) dxDrawRoundedRectangle(24*sx, 271*sy, width + (5 * sx), 41*sy, 10, tocolor(35, 37, 62, 180), false)
-
local width = dxGetTextWidth( lol:gsub("#%x%x%x%x%x%x", ""), 13/scale, font )
-
local skinID = exports.fs_sql:_QuerySingle("select * from users where pSkin = ? and username = ?", SkinTable, username) or local skinID = exports.fs_sql:_QuerySingle("select * from users where username = ? and pSkin = ?", username, SkinTable) or more simple local check = exports.fs_sql:_QuerySingle("select * from users where username = ? ", username) if check then local checkPass = check.password if (checkPass == password) then local pSkin = check.pSkin ... simple
-
Add the part of the code where you put the data of the gridlist in the function where to make the panel visible and place a gridListClear() on top of it all. function open() guiSetVisible(windows, true) ------------------------------------ guiGridListClear(Gridlist_Slot1) for i = 1, 2 do guiGridListAddRow(Gridlist_Slot1) end local Gold = exports.Points_system:getPlayerGold(localPlayer) guiGridListSetItemText(Gridlist_Slot1, 0, 1, "Gold Insignia", false, false) if Gold == 0 then guiGridListSetItemText(Gridlist_Slot1, 0, 2, ""..Gold, false, false) guiGridListSetItemColor(Gridlist_Slot1, 0, 2, 255, 0, 0, 255) end if Gold >= 1 then guiGridListSetItemText(Gridlist_Slot1, 0, 2, ""..Gold, false, false) guiGridListSetItemColor(Gridlist_Slot1, 0, 2, 0, 255, 0, 255) end local Silver = exports.Points_system:getPlayerSilver(localPlayer) guiGridListSetItemText(Gridlist_Slot1, 1, 1, "Silver Insignia", false, false) if Silver == 0 then guiGridListSetItemText(Gridlist_Slot1, 1, 2, ""..Silver, false, false) guiGridListSetItemColor(Gridlist_Slot1, 1, 2, 255, 0, 0, 255) end if Silver == 1 then guiGridListSetItemText(Gridlist_Slot1, 1, 2, ""..Silver, false, false) guiGridListSetItemColor(Gridlist_Slot1, 1, 2, 0, 255, 0, 255) end end
-
addEventHandler("onClientPlayerDamage", root, function(_, cause) if cause == 54 then local x, y, z = getElementPosition(source) setElementPosition(source, x, y, z) end end ) si quieres que no se ejecute la animación podrias usar esto Si quieres reemplazar la animación por otra, pues puedes usar engineReplaceAnimation
-
local data = {} function moveObjectTest(player) local x, y, z = getElementPosition (player) local r = getPedRotation(player) data.object = createObject(8417, x+math.sin(math.rad(-r))*(1.5),y+math.cos(math.rad(-r))*(1.5),z-0.2, 0, 0, r) data.marker = Marker(x, y, z, "corona", 1, 255, 255, 255, 0) data.timer = setTimer(onObjectStop, 700, 1) attachElements(marker, object) addEventHandler("onMarkerHit", data.marker, collision) moveObject (object,700,x+math.sin(math.rad(-r))*25,y+math.cos(math.rad(-r))*25,z-0.3,0,50,0) end addCommandHandler ("move", moveObjectTest) function collision(element, samedim) if dimension then removeEventHandler("onMarkerHit", data.marker, collision) killTimer(data.timer) destroyElement(data.marker) stopObject ( data.object ) end end function onObjectStop() removeEventHandler("onMarkerHit", data.marker, collision) destroyElement(data.marker) end you can use a marker to detect elements colliding with the object
-
There is the problem. use it like this triggerClientEvent( source, "StartEmoji", source )
- 6 replies
-
- 1
-
- triggerevent
- help
-
(and 1 more)
Tagged with:
-
si deja de funcionar al salir del servidor, es por que da un error, hay que añadir otra funciòn mas en el server addEventHandler("onPlayerQuit", root, function() if objects[source] then destroyObject(objects[source]) objects[source] = nil triggerClientEvent("water_walk", root, objects) end end )
-
You must be doing the trigger wrong and instead of triggering a single player it triggers the entire server post the trigger part
- 6 replies
-
- triggerevent
- help
-
(and 1 more)
Tagged with:
-
----- Server ---- local objects = {} --- comando para crear o destruir el objeto y almacenar en la tabla addCommandHandler("water", function(player) if not objects[player] then objects[player] = createObject(1221, 0, 0, 0) else destroyElement(objects[player]) objects[player] = nil end --- mandamos al client todos los objetos triggerClientEvent("water_walk", root, objects) end ) ---- si un jugador entra al server necesitamos mandarle la tabla de objetos addEventHandler("onPlayerResourceStart", root, function(loadedResource) if loadedResource == resource then triggerClientEvent(source, "water_walk", source, objects) end end ) ----- Client ---- local objects = {} addEvent("water_walk", true) addEventHandler("water_walk", root, function(o) objects = o ---- removemos el render por si la tabla esta vacia removeEventHandler("onClientRender", root, managewaterwalk) if objects and --- Si la tabla no esta vacía y hay al menos un objeto iniciamos el render for _, object, in pairs(objects) do if object then addEventHandler("onClientRender", root, managewaterwalk) return end end end end ) function managewaterwalk() for player, object in pairs(objects) do local x, y, z = getElementPosition(player) setElementPosition(object, x, y, z - .5) end end PD: no lo he probado así que me avisas si te sirve
-
local PedPlaces = { {-1556, 2355, 10, 350}, {-1346, 2255, 10, 250}, {-1256, 2155, 10, 123}, {-1217, 1667, 10, 69} } for i, v in pairs (PedPlaces) do v[5] = createPed(15,v[1],v[2],v[3], v[4]) end PedPlaces[1][5]:kill() setTimer(function() PedPlaces[1][5]:destroy() PedPlaces[1][5] = createPed(15, PedPlaces[1][1], PedPlaces[1][2], PedPlaces[1][3], PedPlaces[1][4]) end, 20000, 1)
-
Te dejo un pequeño ejemplo para que pruebes y cuando lo entiendas lo adaptas a lo que quieres hacer PD: en los bindkey tambien puedes usar los controles de mta en vez de teclas, en este caso coloque el claxón con bind ------ CLIENT ----- local interiors = { {1177.90234375, -1338.9755859375, 14.912269592285, 0, 0, 447, 2520, -98, 10, 0, "LSMD"}, {1195.3037109375, -1354.92578125, 13.389284133911, 0, 0, 1198.0654296875, -1402.2587890625, 13.257797241211, 0, 0, "Prueba"}, } bindKey("horn", "down", function() local vehicle = getPedOccupiedVehicle (localPlayer) if vehicle then -- interiors[1] = es la primera fila de datos de tu tabla, si quisieras obtener la posicion x,y,z de esa fila seria interiors[1][1], interiors[1][2], interiors[1][3] -- interiors[2] = es la segunda fila de datos de tu tabla, si quisieras obtener la posicion x,y,z de esa fila seria interiors[2][1], interiors[2][2], interiors[2][3] triggerServerEvent("warpVehicle", vehicle, interiors[1]) end end ) ------ SERVER ----- addEvent("warpVehicle", true) addEventHandler("warpVehicle", root) function(data) setElementPosition(source, data[1], data[2], data[3]) setElementRotation(source, data[4], data[5], data[6]) end )
-
I leave you an example of how you could make a grid list without using rendertarget local items = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10"} local scroll = 0 local maxRows = 5 local select local sx, sy = guiGetScreenSize() function onMouseScroll(bind,state) if state == "down" then if bind == "mouse_wheel_down" then if scroll < #items - maxRows then scroll = scroll + 1 end else if scroll > 0 then scroll = scroll - 1 end end end end bindKey("mouse_wheel_down", "down", onMouseScroll) bindKey("mouse_wheel_up", "down", onMouseScroll) addEventHandler("onClientClick", root, function(_, state) if state == "down" then local cache = 0 for i = 1 + scroll, maxRows + scroll do if isMouseInPosition(sx * .4, sy * .3 + cache, sx * .2, sy * 0.05) then select = i return end cache = cache + sy * 0.05 end end end ) addEventHandler("onClientRender", root, function() local cache = 0 for i = 1 + scroll, maxRows + scroll do if isMouseInPosition(sx * .4, sy * .3 + cache, sx * .2, sy * 0.05) or select == i then dxDrawRectangle(sx * .4, sy * .3 + cache, sx * .2, sy * 0.05, tocolor(255, 255, 255, 100)) dxDrawText(items[i], sx * .4, sy * .3 + cache, sx * .6, sy * 0.35 + cache, tocolor(255, 255, 255)) else dxDrawRectangle(sx * .4, sy * .3 + cache, sx * .2, sy * 0.05, tocolor(0, 0, 0, 100)) dxDrawText(items[i], sx * .4, sy * .3 + cache, sx * .6, sy * 0.35 + cache, tocolor(255, 255, 255)) end cache = cache + sy * 0.05 end -- // draw scroll rectangle local rx = sx * .6 local ry = sy * .3 local rw = sx * .01 local rh = sy * 0.05 * maxRows local rh2 = sy * 0.05 local pos = ((rh - rh2) / (#items - maxRows)) * scroll dxDrawRectangle(rx, ry, rw, rh, tocolor(255, 255, 255)) dxDrawRectangle(rx, ry + pos, rw, rh2, tocolor(0, 0, 0)) end )
-
no estoy seguro si de puede cancelar el evento onClientVehicleStartExit, pero si no puedes cancelarlo puedes usar toggleControl y deshabilitar el enter_exit del jugador y asi no podrán salir del vehículo
-
Tras una revisada rapida el problema esta aca if getVehicleByID(id) then exports.Script_Textos:createNewDxMessage("Su Vehiculo Ha Sido Spawneado", source, 255, 85, 0, true) else --- --- El primer if comprueba mediante el id si el vehiculo esta creado, de lo contrario en el else crearas el vehículo en la posición del jugador, hasta ahi todo va bien, pero tras revisar tu funcion getVehcileByID no esta spawneando ningún vehículo y ahi esta el por que no spawnea nada. Lo primero modificar la getVehcileByID para que nos retorne el vehículo y poder spawnearlo en la posición del jugador quedaría así function getVehicleByID(id) for i, veh in ipairs (getElementsByType("vehicle")) do if getElementData(veh, "ID") == id then return veh end end return false end y ahora en tu función del spawn crear el vehiculo addEvent("SpawnMyVehicle", true) addEventHandler("SpawnMyVehicle", root, function(id) if not playerVehicles[client] then playerVehicles[client] = {} end local vehicle = getVehicleByID(id) -- aca buscamos el vehículo con el id if vehicle then -- comprabamos si esta creado local x, y, z = getElementPosition(client) local _, _, r = getElementRotation(client) setElementPosition(vehicle, x, y, z) -- mandamos el vehículo a la posición del jugador setElementRotation(vehicle, 0, 0, r) exports.Script_Textos:createNewDxMessage("Su Vehiculo Ha Sido Spawneado", client, 255, 85, 0, true) else if #playerVehicles[client] >= 1 then -- esta funcion deberia ir aqui para que no deje crear un vehículo nuevo exports.Script_Textos:createNewDxMessage("Solo Puedes Spawnear Un Vehiculos a La Vez", client, 255, 85, 0, true) return end -- de lo contrario lo creamos -- si ya esta creado no necesitaremos los datos del sql por eso lo traslade a cuando lo necesitamos local data = dbPoll(dbQuery(db, "SELECT * FROM VehicleList WHERE Account = ? AND ID = ?", getAccountName(getPlayerAccount(client)), id), -1) if data ~= nil and type(data) == "table" and #data ~= 0 then local color = split(data[1]["Colors"], ',') local x, y, z = getElementPosition(client) local _, _, r = getElementRotation(client) local vehicle = createVehicle(data[1]["Model"], x, y, z, 0, 0, r) if vehicle then local fuelnu = data[1]["fuel"] or 100 local tune = fromJSON(data[1]["handling"]) local Paintjob = data[1]["Paintjob"] or 3 --outputChatBox(data[1]["handling"],source,255,0,0) --outputChatBox(tostring(tune),source,255,0,255) setVehicleColor(vehicle, color[1] or 255, color[2] or 255, color[3] or 255, color[4] or 255, color[5] or 255, color[6] or 255) setElementData(vehicle, "ID", id) setElementData(vehicle, "vehicleFuel", fuelnu) table.insert(playerVehicles[client],vehicle) setVehiclePaintjob(vehicle, Paintjob) if data[1]["HP"] <= 255.5 then data[1]["HP"] = 255 end setElementHealth(vehicle, data[1]["HP"]) setElementData(vehicle, "Owner", client) vv[vehicle] = setTimer( function(vehicle) if not isElement(vehicle) then killTimer(vv[vehicle]) vv[vehicle] = nil end if isElement(vehicle) and getElementHealth(vehicle) <= 255 then setElementHealth(vehicle, 255.5) -- setVehicleDamageProof(vehicle, true) setVehicleEngineState(vehicle, false) end end , 50, 0, vehicle) addEventHandler("onVehicleDamage", vehicle, function(loss) local account = getAccountName(getPlayerAccount(getElementData(source, "Owner"))) setTimer( function(source) if isElement(source) then dbExec(db, "UPDATE VehicleList SET HP = ? WHERE Account = ? AND Model = ?", getElementHealth(source), account, getElementModel(source)) updateVehicleInfo(getElementData(source, "Owner")) end end, 100, 1, source) end) addEventHandler("onVehicleEnter", vehicle, function(player) if getElementHealth(source) <= 255.5 then setVehicleEngineState(source, false) else if isVehicleDamageProof(source) then setVehicleDamageProof(source, false) end end end) exports.Script_Textos:createNewDxMessage("Tu Vehiculo Ha Sido Spawneado", client, 255, 85, 0, true) cur = getElementData(client,"spawnedcars") or {} table.insert(cur,getVehicleNameFromModel(data[1]["Model"])) setElementData(client,"spawnedcars",cur) end else exports.Script_Textos:createNewDxMessage("Ocurrio Un Error", client, 255, 85, 0, true) end end end )
-
key = {"lctrl", "f1", "f2" } for n, k in ipairs(keys) then if getControlState(player, k) then outputChatBox("Has presionado "..k) end end ahi te dejo un ejemplo de como puede recorrer tu tabla
-
local ANIMS = { { block = "PLAYIDLES", anim = "shift" }, { block = "123", anim = "123" }, } local random = math.random(1, #ANIMS) setPedAnimation(player, ANIMS[random].block, ANIMS[random].anim, ......) algo asi ?
-
local animaciones = { { block = "PLAYIDLES", anim = "shift" }, { block = "123", anim = "123" }, } addCommandHandler( "anim", function(player) setPedAnimation(player, animaciones[1].block, animaciones[1].anim) end ) addCommandHandler( "anim2", function(player) setPedAnimation(player, animaciones[2].block, animaciones[2].anim) end ) no entendi que quieres hacer, algo asi como el ejemplo ?
-
TE ELIMINE MUCHAS COSAS INNECESARIAS EN TU CODIGO QUE NO HACIAN NADA. PRUEBA Y ME AVISAS SI FUNCA local weed = { } local syncTimer = { } function startSmokingWeed ( thePlayer ) if not isPedInVehicle(thePlayer) then -- verificamos que no este en un auto if not weed[thePlayer] then -- verificamos que no tenga mota weed[thePlayer] = createObject(1485, 0,0,0) -- creamos su oregano bindKey( thePlayer, "mouse2", "down", "weedDMPS" ) bindKey( thePlayer, "mouse2", "down", "smokeweed_drag" ) bindKey( thePlayer, "M", "down", "smokeweed_drag" ) setTimer( function()--- los segundos que tarda en crearse el cigarro - 1600- exports.bone_attach:attachElementToBone(wed,thePlayer,12,0.05,0.1,0.13,0,-180,59) end , 1650, 1) else outputChatBox("Ya Tienes mota", thePlayer, 255, 0, 0) end end end function smokeWeedDrag( thePlayer ) if weed[thePlayer] then -- verificamos que tenga mota setPedAnimation( thePlayer, "GANGS", "smkcig_prtl", 0, false, true, false, true ) removeCommandHandler("smokeweed_drag", smokeWeedDrag ) -- removemos el comando hasta que termine de fumar su motita setTimer( function() weed[thePlayer] = nil -- como ya se la fumo eliminamos la mota para que pueda comprar otra addCommandHandler( "smokeweed_drag", smokeWeedDrag ) -- le habilitamos nuevamente el comando --setElementHealth ( thePlayer, getElementHealth(thePlayer) + 2 )--- WEED da +1 de salud end , 5000, 1) end end addCommandHandler( "smokeweed_drag", smokeWeedDrag )
-
pues esto es un foro solo de ayuda, muy poco probable que encuentres a alguien que te haga un script sin un pago. Sin embargo como te mencione arriba no es algo muy complicado de hacer y investigando un poco podrías hacerlo vos mismo y publicar tus dudas y acá se e va ayudando.
-
No es algo muy complicado de hacer, puedes darte una idea de como hacer un texto 3d con cualquier nametag de la comunidad o en todo caso usar la función dxDrawMaterialLine3D . Lo demas seria hacer los comando en el lado server y mandarlos al cliente para que dibuje el texto en 3d para todo el servidor.