Jump to content

error403 ツ

Members
  • Posts

    53
  • Joined

  • Last visited

  • Days Won

    1

error403 ツ last won the day on December 6 2020

error403 ツ had the most liked content!

5 Followers

About error403 ツ

  • Birthday 12/06/1996

Details

  • Gang
    Combo Extremo
  • Location
    Venezuela
  • Occupation
    Diseñador & Programador
  • Interests
    Trabajar

Recent Profile Visitors

2,761 profile views

error403 ツ's Achievements

Snitch

Snitch (10/54)

2

Reputation

  1. Buenas, Quisiera saber si esta dispuesto a compartir su Gamemode de Day Z.

  2. necesitas el modulo mta.mysql.so de x64 bits.... Para que pueda iniciar la conexion con la base de datos.
  3. 1.muestra el código para ver que error tienes. 2.Revisa si tu spawn predeterminado tiene el el siguiente evento onPlayerWasted .
  4. Bienvenido @tobi_emetea Especifica mejor lo que quieres!
  5. function playerGetDamageDayZ(attacker, weapon, bodypart, loss) cancelEvent() local occupiedvehicle = getPedOccupiedVehicle(localPlayer); if occupiedvehicle and getElementModel(occupiedvehicle) == 528 then return; end showPlayerDamageScreen(0,"up"); local headshot = false; if weapon == 37 then setElementData(localPlayer,"blood",getElementData(localPlayer,"blood")-10000) return elseif weapon == 51 or weapon == 59 or weapon == 63 or weapon == 16 then setElementData(localPlayer,"blood",getElementData(localPlayer,"blood")-12001) end if attacker and getElementType(attacker) == "player" then setElementData(localPlayer,"lastattacker",attacker) end damage = 100 headshot = false if attacker then if isElement(sleepText) then setElementData(localPlayer,"isSleeping",false) destroyElement(sleepText) triggerServerEvent("getDamageSleep", localPlayer) end if attacker and getElementType(attacker) and getElementType(attacker) == "vehicle" and not getElementData(getLocalPlayer(), "godmode") and not getElementData(getLocalPlayer(), "greenzone") then if loss >= 30 then setElementData(getLocalPlayer(),"blood",12001) end speedx, speedy, speedz = getElementVelocity(attacker) actualspeed = (speedx^2 + speedy^2 + speedz^2)^(0.5) kmh = actualspeed * 180 if kmh >= 100 then setElementData(getLocalPlayer(),"blood",-10) else setElementData(getLocalPlayer(), "blood", getElementData(getLocalPlayer(), "blood") - 500) end setElementData(localPlayer,"lastattacker",getVehicleOccupant(attacker)) end if attacker then if getElementData(attacker, "zombie") then setElementData(getLocalPlayer(),"blood",getElementData(getLocalPlayer(),"blood")-gameplayVariables["zombiedamage"]) sendClientMessage ( '-'..gameplayVariables["zombiedamage"], 1, 'left' ) local number = math.random(1, 9) playSound("Sonidos/Ataque-Zombies/attack_"..number..".mp3") if number == 4 then setElementData(getLocalPlayer(),"infection",true) setElementData(getLocalPlayer(), "bleeding", getElementData(getLocalPlayer(), "bleeding") + math.floor(loss*10)) end end end end -- DAÑO DE LOS PUÑOS if attacker then if weapon == 0 and getElementType(attacker) == "player" then setElementData(localPlayer,"blood",getElementData(localPlayer,"blood")-150) end end -- if (weapon == 16) then local aX,aY,aZ = getElementPosition(attacker) local tX,tY,tZ = getElementPosition(localPlayer) if isLineOfSightClear(aX,aY,aZ,tX,tY,tZ,true,false,false,true) then setElementData(localPlayer, "blood", getElementData(localPlayer, "blood") - math.random(20000*0.8, 20000*1.2)); end end -- if weapon == 49 then if loss > 30 then setElementData(getLocalPlayer(),"brokenbone",true) setPedControlState ("jump",true) setElementData(getLocalPlayer(),"blood",getElementData(getLocalPlayer(),"blood")-math.floor(loss*10)) sendClientMessage ( '-'..math.floor(loss*10), 1, 'left' ) setElementData(getLocalPlayer(),"blood",getElementData(getLocalPlayer(),"blood")-math.floor(loss*5)) sendClientMessage ( '-'..math.floor(loss*5), 1, 'left' ) end end if weapon == 63 or weapon == 51 or weapon == 19 or weapon == 50 then local aX,aY,aZ = getElementPosition (localPlayer) local tX,tY,tZ = getElementPosition (localPlayer) if isLineOfSightClear(aX, aY, aZ, tX, tY, tZ, true, false, false, true) then setElementData(getLocalPlayer(), "blood", -300) if getElementData(getLocalPlayer(), "blood") <= 1 then if not getElementData(getLocalPlayer(), "isDead") == true then triggerServerEvent("kilLDayZPlayer",getLocalPlayer(), attacker, headshot) end end end if weapon and weapon > 1 and attacker and getElementType(attacker) == "player" then setElementData(localPlayer,"lastAttacker",attacker) damage = getWeaponDamage(weapon,attacker) local x1,y1,z1 = getElementPosition(localPlayer) local x2,y2,z2 = getElementPosition(attacker) local distancia = getDistanceBetweenPoints3D(x1,y1,z1,x2,y2,z2) local damage = math.random(distancia*5, distancia*6) if bodypart == 9 then damage = damage*gameplayVariables["headshotdamage_player"] sendClientMessage ( '-'..gameplayVariables["headshotdamage_player"], 1, 'left' ) headshot = true end if attacker then if weapon == 17 and getElementType(attacker) == "player" then setElementData(localPlayer,"blood",getElementData(localPlayer,"blood")-10) end end if bodypart == 7 or bodypart == 8 then setElementData(localPlayer,"brokenbone",true) end if getElementData(localPlayer,"humanity") >= 5000 then if damage <= 1000 then damage = 0 else damage = damage end end setElementData(localPlayer,"blood",getElementData(localPlayer,"blood")-math.floor(damage)) if damage >= 6000 then end local number = math.random(1,8) if number >= 6 and number <= 8 then if damage > 0 then setElementData(localPlayer,"bleeding",getElementData(localPlayer,"bleeding") + math.floor(loss*10)) end end local number = math.random(1,7) if number == 2 then setElementData(localPlayer,"pain",true) end ----------------------------------------- playRandomHitSound() local myKills = 200 - ((getElementData(localPlayer,"murders") / 3) * 150) local rawDamage = math.floor(math.sqrt((damage/55.55))) local humanityHit = -(myKills * rawDamage) if humanityHit > -800 then humanityHit = -800 end if not getElementData(localPlayer,"bandit") then triggerServerEvent("onPlayerChangeStatus",attacker,"humanity",math.floor(humanityHit)) if getElementData(attacker,"humanity") < 0 then setElementData(attacker,"bandit",true) end else triggerServerEvent("onPlayerChangeStatus",attacker,"humanity",math.floor(humanityHit)) if getElementData(attacker,"humanity") > 5000 then setElementData(attacker,"humanity",5000) end if getElementData(attacker,"humanity") > 2000 then setElementData(attacker,"bandit",false) end end if getElementData(localPlayer,"blood") <= 0 then if not getElementData(localPlayer,"isDead") then triggerServerEvent("kilLDayZPlayer",localPlayer,attacker,headshot,getWeaponNameFromID(weapon)) setElementData(localPlayer,"isDead",true) end end if weapon == 54 or weapon == 63 or weapon == 49 or weapon == 51 then local sangre = math.random( 100, 1000 ) setElementData(getLocalPlayer(),"blood",getElementData( getLocalPlayer(),"blood") - sangre ) sendClientMessage ( '-'..sangre, 1, 'left' ) local number = math.random(1,5) if loss > 30 then setElementData(localPlayer,"brokenbone",true) setPedControlState("jump",true) end if loss >= 100 then setElementData(localPlayer,"blood",49) setElementData(localPlayer,"bleeding",50) end local number = math.random(1,11) if number == 3 then setElementData(localPlayer,"pain",true) end end if getElementData(getLocalPlayer(),"blood")<= 0 and not getElementData(getLocalPlayer(),"isDead")== true then triggerServerEvent("kilLDayZPlayer",getLocalPlayer(),(getElementData(localPlayer, "lastattacker") or attacker),headshot,getWeaponNameFromID (weapon)) setElementData(getLocalPlayer(),"isDead",true) end end end addEventHandler("onClientPlayerDamage", getLocalPlayer(), playerGetDamageDayZ) prueba esto. Y dime si te resulta.
  6. siguimientos = {} function dogFollow( theprisoner) if siguimientos[theprisoner] == nil then else if not theprisoner then return end policia = siguimientos[theprisoner] local copx, copy, copz = getElementPosition ( siguimientos[theprisoner] ) local prisonerx, prisonery, prisonerz = getElementPosition ( theprisoner ) copangle = ( 360 - math.deg ( math.atan2 ( ( copx - prisonerx ), ( copy - prisonery ) ) ) ) % 360 setPedRotation ( theprisoner, copangle ) local dist = getDistanceBetweenPoints2D ( copx, copy, prisonerx, prisonery ) if getElementInterior(siguimientos[theprisoner]) ~= getElementInterior(theprisoner) then setElementInterior(theprisoner, getElementInterior(siguimientos[theprisoner])) end if getElementDimension(siguimientos[theprisoner]) ~= getElementDimension(theprisoner) then setElementDimension(theprisoner, getElementDimension(siguimientos[theprisoner])) end if dist >= 200 then local x,y,z = getElementPosition(siguimientos[theprisoner]) setElementPosition(theprisoner, x, y, z) elseif dist >= 9 then setPedAnimation(theprisoner, "ped", "sprint_civi") elseif dist >= 6 then setPedAnimation(theprisoner, "ped", "run_player") elseif dist >= 3 then setPedAnimation(theprisoner, "ped", "WALK_player") else setPedAnimation(theprisoner, false) end if isPedInVehicle ( policia ) then car = getPedOccupiedVehicle ( policia ) for i = 0, getVehicleMaxPassengers( car ) do local p = getVehicleOccupant( car, i ) if not p and not isVehicleLocked(car) then warpPedIntoVehicle ( theprisoner, car, i ) end end else if isPedInVehicle ( theprisoner ) then removePedFromVehicle ( theprisoner ) end end local zombify = setTimer ( dogFollow, 750, 1, theprisoner ) end end addCommandHandler("esposar", function(player, cmd, other) if not player or isPedDead(player) then return end if exports.factions:isPlayerInFaction(player, 1) then if exports.items:has(player, 35,4) then if other then target, targetName = exports.players:getFromName( player, other ) if not target or isPedDead(target) then return end x1, y1, z1 = getElementPosition ( player ) x2, y2, z2 = getElementPosition ( target ) distance = getDistanceBetweenPoints3D ( x1, y1, z1, x2, y2, z2 ) if ( distance < 2) then if siguimientos[target] == nil then siguimientos[target] = player dogFollow(target) exports.chat:me(player, "pone las esposas a ".. targetName) showCursor(target, true) toggleControl ( target, "chatbox ", true ) setElementData(target, "esposado", true) else siguimientos[target] = nil exports.chat:me (player, "quita las esposas a ".. targetName) showCursor(target, false) toggleAllControls ( target, true ) setElementData(target, "esposado", false) end else outputChatBox("Estas demasiado lejos del fugetivo para esposarlo", player, 255, 0,0) end end else outputChatBox("(( No llevas las esposas en tu cinturón tactico ))", player, 255, 0, 0) end end end ) Hola aqui tienes una base, espero que te sirva
  7. function msg(source,cmd,...) local cuenta = getAccountName(getPlayerAccount(source)) local nombre = getPlayerName ( source ):gsub ( '#%x%x%x%x%x%x', '' ) mensaje = table.concat ( { ... }, " " ) if not ... end not mensaje then return outputChatBox ( "Syntax: /"..cmd.." [Texto]", source, 255, 255, 0 ) end if isObjectInACLGroup("user."..cuenta,aclGetGroup("Admin")) then outputChatBox("#00FF00"..nombre.." #00FF00dice: #FDFEFE"..""..mensaje..".",root,255,255,0,true) else outputChatBox("No eres Admin") end end addCommandHandler("d",msg)
  8. local sx, sy = guiGetScreenSize() local mostrando = true -- Configuration local settings = { disableGTASAhealthbar = true, -- disable GTASA's HUD health display disableGTASAarmorbar = true, -- disable GTASA's HUD armour display disableGTASAoxygenbar = true, -- disable GTASA's HUD oxygen display displayScale = 0.3*sy, -- width of radar (30% of screen width) aspectRatio = 3/2, -- 3:2 ratio, height is displayScale divided by this safeX = 0.025*sx, -- offset from left edge of screen safeY = 0.025*sy, -- offset from bottom edge of screen map = { image = "assets/world.jpg", alwaysRender = false, -- false = render only in interior world 0 backgroundColor = tocolor(124, 167, 209), -- rendered behind map (water color) }, bar = { -- generic health/armor/oxygen bar settings backgroundAlpha = 100, valueAlpha = 190, }, healthbar = { colorOk = {102, 204, 102}, colorLow = {200, 200, 0}, colorCritical = {200, 0, 0}, }, armorbar = { color = {0, 102, 255}, }, oxygenbar = { alwaysRender = false, -- false = only when oxygen not full or player is in water color = {255, 255, 0}, }, blips = { enabled = true, sizeFactor = 12, northBlip = true, drawProjectiles = true, projectilesAll = false, projectileColor = tocolor(255, 0, 0) }, } --------------------------------------------------------------------------- -- Do not modify anything below unless you're sure of what you're doing. -- --------------------------------------------------------------------------- -- Prepare rendertarget local rt = dxCreateRenderTarget(290, 290/settings.aspectRatio) local rtW, rtH = dxGetMaterialSize(rt) -- Prepare map image local map = dxCreateTexture(settings.map.image, "dxt5", true, "wrap") local mW, mH = dxGetMaterialSize(map) -- Precompute constants local mapScaleFactor = 6000/mW local mapDisplayWidth = settings.displayScale local mapDisplayHeight = settings.displayScale / settings.aspectRatio local armorBg = tocolor(settings.armorbar.color[1], settings.armorbar.color[2], settings.armorbar.color[3], settings.bar.backgroundAlpha) local armorVal = tocolor(settings.armorbar.color[1], settings.armorbar.color[2], settings.armorbar.color[3], settings.bar.valueAlpha) local oxygenBg = tocolor(settings.oxygenbar.color[1], settings.oxygenbar.color[2], settings.oxygenbar.color[3], settings.bar.backgroundAlpha) local oxygenVal = tocolor(settings.oxygenbar.color[1], settings.oxygenbar.color[2], settings.oxygenbar.color[3], settings.bar.valueAlpha) local function init() showPlayerHudComponent("radar", false) if settings.disableGTASAhealthbar then showPlayerHudComponent("health", false) end if settings.disableGTASAarmorbar then showPlayerHudComponent("armour", false) end if settings.disableGTASAoxygenbar then showPlayerHudComponent("breath", false) end end addEventHandler("onClientResourceStart", resourceRoot, init) local function getMaxHealth(p) return 100 + (getPedStat(p, 24) - 569) / 4.31 end local function getMaxOxygen(p) return 1000 + getPedStat(p, 225) * 1.5 end local minVel = 0.3 local minDist = 1 local maxVel = 1 local maxDist = 1/2 local ratio = (maxDist-minDist)/(maxVel-minVel) local function getRadarRadius() if not localPlayer.vehicle then return minDist else if localPlayer.vehicle.vehicleType == "Plane" then return maxDist end local speed = localPlayer.vehicle.velocity.length if speed <= minVel then return minDist elseif speed >= maxVel then return maxDist end local streamDistance = speed - minVel streamDistance = streamDistance * ratio streamDistance = streamDistance + minDist return math.ceil(streamDistance) end end -- Draws map to render target local function updateRT() dxSetRenderTarget(rt, true) if settings.map.alwaysRender or Camera.interior == 0 then local pos = Vector2(localPlayer.position) local X, Y = rtW/2 - (pos.x/mapZoomScale), rtH*(3/5) + (pos.y/mapZoomScale) dxDrawRectangle(0, 0, rtW, rtH, settings.map.backgroundColor) --render background local zmW, zmH = mW * getRadarRadius(), mH * getRadarRadius() dxDrawImage(X - (zmW)/2, Y - (zmH)/2, zmW, zmH, map, Camera.rotation.z, pos.x/mapZoomScale, -(pos.y/mapZoomScale), 0xFFFFFFFF) end dxSetRenderTarget() end -- Triggered on every frame function render() if not mostrando then return end mapZoomScale = mapScaleFactor / getRadarRadius() if (not isPlayerMapVisible()) then updateRT() local offset = 5 -- Calculations local barsHeight = 10 local barsWidth = mapDisplayWidth local radarWidth = mapDisplayWidth + offset + offset local radarHeight = mapDisplayHeight + offset + barsHeight + offset + offset local radarLeft = settings.safeX local radarTop = sy - settings.safeY - radarHeight local mapWidth = mapDisplayWidth local mapHeight = mapDisplayHeight local mapLeft = radarLeft + offset local mapTop = radarTop + offset local barsLeft = radarLeft + offset local barsTop = radarTop + offset + mapHeight + offset local barsOffset = 5 -- Draw radar dxDrawRectangle(radarLeft, radarTop, radarWidth, radarHeight, tocolor(0, 0, 0, 175)) dxSetBlendMode("add") dxDrawImage(mapLeft, mapTop, mapWidth, mapHeight, rt, 0, 0, 0, tocolor(255, 255, 255, 150)) dxSetBlendMode("blend") -- Calculate percentage values local health = getElementHealth(localPlayer) / getMaxHealth(localPlayer) local armor = getPedArmor(localPlayer) / 100 local oxygen = getPedOxygenLevel(localPlayer) / getMaxOxygen(localPlayer) -- Compute healthbar color local r, g, b = settings.healthbar.colorOk[1], settings.healthbar.colorOk[2], settings.healthbar.colorOk[3] if health >= 0.25 then interpolateBetween( settings.healthbar.colorOk[1], settings.healthbar.colorOk[2], settings.healthbar.colorOk[3], settings.healthbar.colorLow[1], settings.healthbar.colorLow[2], settings.healthbar.colorLow[3], math.floor(health*20)/10, "InOutQuad" ) else r, g, b = interpolateBetween( settings.healthbar.colorCritical[1], settings.healthbar.colorCritical[2], settings.healthbar.colorCritical[3], settings.healthbar.colorLow[1], settings.healthbar.colorLow[2], settings.healthbar.colorLow[3], math.floor(health*20)/10, "InOutQuad" ) end local healthBg = tocolor(r, g, b, 100) local healthVal = tocolor(r, g, b, 190) -- Draw health bar local healthbarLeft = barsLeft local healthbarWidth = barsWidth/2 - barsOffset/2 dxDrawRectangle(healthbarLeft, barsTop, healthbarWidth, barsHeight, healthBg) dxDrawRectangle(healthbarLeft, barsTop, healthbarWidth*health, barsHeight, healthVal) if settings.oxygenbar.alwaysRender or (oxygen < 1 or isPedInWater(localPlayer)) then -- draw armor bar local armorLeft = barsLeft + barsWidth/2 + barsOffset/2 local armorWidth = barsWidth/4 - barsOffset dxDrawRectangle(armorLeft, barsTop, armorWidth, barsHeight, armorBg) dxDrawRectangle(armorLeft, barsTop, armorWidth*armor, barsHeight, armorVal) -- draw oxygen bar local oxygenLeft = barsLeft + barsWidth/2 + barsWidth/4 + barsOffset/2 local oxygenWidth = barsWidth/4 - barsOffset/2 dxDrawRectangle(oxygenLeft, barsTop, oxygenWidth, barsHeight, oxygenBg) dxDrawRectangle(oxygenLeft, barsTop, oxygenWidth*oxygen, barsHeight, oxygenVal) else -- draw armor bar (extended length) local armorLeft = barsLeft + barsWidth/2 + barsOffset/2 local armorWidth = barsWidth/2 - barsOffset/2 dxDrawRectangle(armorLeft, barsTop, armorWidth, barsHeight, armorBg) dxDrawRectangle(armorLeft, barsTop, armorWidth*armor, barsHeight, armorVal) end local rx, ry, rz = getElementRotation(localPlayer) local centerX, centerY = mapWidth/2, mapHeight*(3/5) -- Draw heat-seeking rockets targeting the local player if settings.blips.drawProjectiles then for k, v in ipairs(getElementsByType("projectile")) do local blipPos = v.position local dist = (localPlayer.position - v.position).length if v.dimension == localPlayer.dimension and v.interior == Camera.interior and (settings.blips.projectilesAll or v.target == localPlayer or (localPlayer.vehicle and v.target == localPlayer.vehicle)) then local radius = dist/mapZoomScale local direction = math.atan2(v.position.x - localPlayer.position.x, v.position.y - localPlayer.position.y) + math.rad(Camera.rotation.z) local blipX, blipY = centerX + math.sin(direction) * radius, centerY - math.cos(direction) * radius if blipX >= 0 and blipX <= mapWidth and blipY >= 0 and blipY <= mapHeight then local path = "assets/blips/0.png" local blipColor = settings.blips.projectileColor local blipSize = settings.blips.sizeFactor dxDrawImage(mapLeft + blipX - blipSize/2, mapTop + blipY - blipSize/2, blipSize, blipSize, path, 0, 0, 0, blipColor) end end end end -- Draw blips for k, v in ipairs(getElementsByType("blip")) do local blipPos = v.position local dist = (localPlayer.position - v.position).length local maxdist = v.visibleDistance if dist <= maxdist and v.dimension == localPlayer.dimension and v.interior == Camera.interior then local radius = dist/mapZoomScale local direction = math.atan2(v.position.x - localPlayer.position.x, v.position.y - localPlayer.position.y) + math.rad(Camera.rotation.z) local blipX, blipY = centerX + math.sin(direction) * radius, centerY - math.cos(direction) * radius local blipX = math.max(0, math.min(blipX, mapWidth)) -- clamp position between 0 and mapWidth local blipY = math.max(0, math.min(blipY, mapHeight)) -- clamp position between 0 and mapHeight local blipRot = getElementData(v, "blipRotation") or 0 if type(blipRot) ~= "number" then blipRot = 0 end local path = "assets/blips/"..v.icon..".png" do local custom = getElementData(v, "customIcon") if custom and custom:sub(1, 1) == ":" then path = custom elseif custom then path = "assets/blips/"..custom..".png" end end local blipColor = (type(v.icon) == "number" and v.icon >= 1 and v.icon <= 63) and 0xFFFFFFFF or tocolor(getBlipColor(v)) local blipSize = v.size * settings.blips.sizeFactor dxDrawImage(mapLeft + blipX - blipSize/2, mapTop + blipY - blipSize/2, blipSize, blipSize, path, blipRot, 0, 0, blipColor) end end -- Draw north blip if settings.blips.northBlip then local direction = math.rad(-Camera.rotation.z + 180) local radius = math.sqrt((mapWidth/2)^2 + (mapHeight*(3/5))^2) local blipX, blipY = centerX + math.sin(direction) * radius, centerY + math.cos(direction) * radius local blipX = math.max(0, math.min(blipX, mapWidth)) -- clamp position between 0 and mapWidth local blipY = math.max(0, math.min(blipY, mapHeight)) -- clamp position between 0 and mapHeight local path = "assets/blips/4.png" local blipColor = 0xFFFFFFFF local blipSize = 2 * settings.blips.sizeFactor dxDrawImage(mapLeft + blipX - blipSize/2, mapTop + blipY - blipSize/2, blipSize, blipSize, path, 0, 0, 0, blipColor) end -- Draw local player blip local blipSize = 2 * settings.blips.sizeFactor dxDrawImage(mapLeft + centerX - blipSize/2, mapTop + centerY - blipSize/2, blipSize, blipSize, "assets/player.png", Camera.rotation.z-localPlayer.rotation.z, 0, 0) end end addEventHandler("onClientRender", root, render, false) function show() mostrando = not mostrando if mostrando then outputChatBox("On", 0, 255, 0) else outputChatBox("Off", 255, 0, 0) end end addCommandHandler("openHud", show) addCommandHandler("closeHud", show)
  9. Es parecido como darte admin en el archivo ACL, en vez de user.cuenta vas a colocar resource.nombre_del_recurso.
  10. ●MTA DayZ | Last Day On Earth Re-apertura del servidor Last Day On Earth (de los mismos creadores de Survival Instintict y Global Infection) regresan con un nuevo modo para disfrutar y rememorar grandes momentos pasados. Cuenta con VIP Gratis (1 semana) para los usuarios que entren este mes de marzo. Contamos con un gran VPS libre de lagg, gamemode optimizado y grandes recursos entre ellos *Variación de armas *Interiores en hospitales,comisarias y zonas importantes (El resto sigue en trabajo) *Servidor Survival *Sistema de bases con protección *Autosprivados *Skinsprivados *VIP *Bases *Personalización de personaje *Chalecos y cascos *Trampas *Drogas *Animales salvajes *Base gratis por 3 meses a clanes con 10 usuarios activos Entra y demuestra que eres la salvación o la perdición.. mtasa://144.217.86.190:27115 mtasa://144.217.86.190:27115
  11. addEventHandler( "onResourceStart", resourceRoot, function( ) -- load all vehicles local result = exports.sql:query_assoc( "SELECT * FROM vehicles ORDER BY vehicleID ASC" ) if result then for key, data in ipairs( result ) do if data.inactivo == 0 and data.cepo == 0 then local vehicle = createVehicle( data.model, data.posX, data.posY, data.posZ, data.rotX, data.rotY, data.rotZ ) setElementFrozen(vehicle, true) setElementAlpha(vehicle, 127) setElementCollisionsEnabled(vehicle, false) setTimer(setElementCollisionsEnabled, 2000, 1, vehicle, true) setTimer(setElementAlpha, 2000, 1, vehicle, 255) -- tables for ID -> vehicle and vehicle -> data vehicleIDs[ data.vehicleID ] = vehicle vehicles[ vehicle ] = { vehicleID = data.vehicleID, respawnInterior = data.respawnInterior, respawnDimension = data.respawnDimension, characterID = data.characterID, engineState = not doesVehicleHaveEngine( vehicle ) or data.engineState == 1, tintedWindows = data.tintedWindows == 1, fuel = data.fuel, km = data.km, pinturas = data.pinturas, motor = data.motor, mejoramotor = data.mejoramotor, frenos = data.frenos, mejorafrenos = data.mejorafrenos, model = data.model } setElementHealth( vehicle, data.health ) if data.health <= 300 then vehicles[ vehicle ].engineState = false end if data.color1 and data.color2 then r, g, b = HEX2RGB(data.color1) r2, g2, b2 = HEX2RGB(data.color2) setVehicleColor( vehicle, r, g, b, r2, g2, b2 ) end if data.color3 then r, g, b = HEX2RGB(data.color3) setVehicleHeadLightColor ( vehicle, r, g, b ) end setVehiclePlateText(vehicle, tostring(addZero( data.vehicleID, 4 ))) setVehicleRespawnPosition( vehicle, data.respawnPosX, data.respawnPosY, data.respawnPosZ, data.respawnRotX, data.respawnRotY, data.respawnRotZ ) setElementInterior( vehicle, data.interior ) setElementDimension( vehicle, data.dimension ) if data.alarma == 1 then setElementData(vehicle, "havealarm", true) end setVehicleLocked( vehicle, true ) setVehicleEngineState( vehicle, false ) setVehicleOverrideLights( vehicle, data.lightsState + 1 ) setElementData( vehicle, "fuel", data.fuel ) if data.cepo == 1 then setVehicleEngineState( vehicle, false ) setElementData( vehicle, "cepo", 1 ) end setVehiclePaintjob ( vehicle, data.pinturas ) setElementData(vehicle, "km", data.km) setElementData(vehicle, "idowner", data.characterID) setElementData(vehicle, "idveh", data.vehicleID) exports.vehicles_auxiliar:applyTunning(vehicle) setElementData(vehicle, "model", data.model) setElementData(vehicle, "fasemotor", data.fasemotor) setElementData(vehicle, "fasefrenos", data.fasefrenos) if data.diasLimpio > 0 then -- Solicitamos limpiarlo a todos los conectados y además lo guardamos. -- Preparado para una reforma futura setElementData(vehicle, "limpio", true) end if data.marchas == 1 then setElementData(vehicle, "marchas", 1) end if data.marchas == 0 then setElementData(vehicle, "marchas", 0) end if data.fasemotor > 0 then exports.vehicles_auxiliar:solicitarMejora(vehicle, 1, data.fasemotor) end if data.fasefrenos > 0 then exports.vehicles_auxiliar:solicitarMejora(vehicle, 2, data.fasefrenos) end end end end -- bind a key for everyone for key, value in ipairs( getElementsByType( "player" ) ) do bindKey( value, "num_3", "down", "lockvehicle" ) bindKey( value, "num_1", "down", "toggleengine" ) bindKey( value, "num_2", "down", "togglelights" ) bindKey( value, "num_0", "down", toggleFreezeStatus ) bindKey( value, "n", "down", toggleFreezeStatus ) bindKey( value, "k", "down", "lockvehicle" ) bindKey( value, "j", "down", "toggleengine" ) bindKey( value, "l", "down", "togglelights" ) bindKey( value, "c", "down", "cinturon" ) end -- -- Fuel update setTimer( function( ) for vehicle, data in pairs( vehicles ) do if not isElement( vehicle ) or getElementType( vehicle ) ~= "vehicle" then vehicles[ vehicle ] = nil elseif data.engineState and data.fuel and not isVehicleEmpty( vehicle ) and doesVehicleHaveEngine( vehicle ) and doesVehicleHaveFuel( vehicle ) and not ( models [ getElementModel ( vehicle ) ] ) then local vx, vy, vz = getElementVelocity( vehicle ) local speed = math.sqrt( vx * vx + vy * vy ) local loss = ( speed > 0.65 and 2 * speed or speed ) * 0.5 + 0.005 data.fuel = math.max( data.fuel - loss, 0 ) if math.floor( data.fuel + 0.5 ) ~= getElementData( vehicle, "fuel" ) then setElementData( vehicle, "fuel", math.floor( data.fuel + 0.5 ) ) end if data.fuel == 0 then setVehicleEngineState( vehicle, false ) setElementData (vehicle, "sinGasolina", true) for seat = 0, getVehicleMaxPassengers( vehicle ) do local player = getVehicleOccupant( vehicle, seat ) if player then triggerClientEvent( player, "gui:hint", player, "Sin gasolina", "Tu " .. getVehicleName( vehicle ) .. " No arranca sin gasolina!\nPara que no te vuelva a pasar esto recarga cada un tiempo.", 3 ) setVehicleEngineState( vehicle, false ) end end end end end end, 10000, 0 ) -- KM update setTimer( function( ) for vehicle, data in pairs( vehicles ) do if not isElement( vehicle ) or getElementType( vehicle ) ~= "vehicle" then vehicles[ vehicle ] = nil elseif data.engineState and not isVehicleEmpty( vehicle ) and doesVehicleHaveEngine( vehicle ) then local vx, vy, vz = getElementVelocity( vehicle ) local speed = math.sqrt( vx * vx + vy * vy ) local loss = (( speed > 0.65 and 2 * speed or speed ) * 0.8 + 0.005)*15 if data.km and data.km > 0 then data.km = math.max( data.km + loss, 0 ) else data.km = math.max( loss, 0 ) end if math.floor( data.km ) ~= getElementData( vehicle, "km" ) then setElementData( vehicle, "km", math.floor( data.km ) ) end end end end, 10000, 0 ) end ) function reloadVehicle(vehicleID) if vehicleID then if getVehicle(tonumber(vehicleID)) then destroyElement(getVehicle(tonumber(vehicleID))) end local data = exports.sql:query_assoc_single("SELECT * FROM vehicles WHERE vehicleID = "..vehicleID) if not data then return false end if data.inactivo == 0 then local vehicle = createVehicle( data.model, data.posX, data.posY, data.posZ, data.rotX, data.rotY, data.rotZ ) setElementFrozen(vehicle, true) setElementAlpha(vehicle, 127) setElementCollisionsEnabled(vehicle, false) setTimer(setElementCollisionsEnabled, 2000, 1, vehicle, true) setTimer(setElementAlpha, 2000, 1, vehicle, 255) -- tables for ID -> vehicle and vehicle -> data vehicleIDs[ data.vehicleID ] = vehicle vehicles[ vehicle ] = { vehicleID = data.vehicleID, respawnInterior = data.respawnInterior, respawnDimension = data.respawnDimension, characterID = data.characterID, engineState = not doesVehicleHaveEngine( vehicle ) or data.engineState == 1, tintedWindows = data.tintedWindows == 1, fuel = data.fuel, km = data.km, pinturas = data.pinturas, motor = data.motor, mejoramotor = data.mejoramotor, frenos = data.frenos, mejorafrenos = data.mejorafrenos, model = data.model } setElementHealth( vehicle, data.health ) if data.health <= 300 then vehicles[ vehicle ].engineState = false end if data.color1 and data.color2 then r, g, b = HEX2RGB(data.color1) r2, g2, b2 = HEX2RGB(data.color2) setVehicleColor( vehicle, r, g, b, r2, g2, b2 ) end if data.color3 then r, g, b = HEX2RGB(data.color3) setVehicleHeadLightColor ( vehicle, r, g, b ) end setVehiclePlateText(vehicle, tostring(addZero( data.vehicleID, 4 ))) setVehicleRespawnPosition( vehicle, data.respawnPosX, data.respawnPosY, data.respawnPosZ, data.respawnRotX, data.respawnRotY, data.respawnRotZ ) setElementInterior( vehicle, data.interior ) setElementDimension( vehicle, data.dimension ) if data.alarma == 1 then setElementData(vehicle, "havealarm", true) end setVehicleLocked( vehicle, true ) setVehicleEngineState( vehicle, false ) setVehicleOverrideLights( vehicle, data.lightsState + 1 ) setElementData( vehicle, "fuel", data.fuel ) if data.cepo == 1 then setVehicleEngineState( vehicle, false ) setElementData( vehicle, "cepo", 1 ) end setVehiclePaintjob ( vehicle, data.pinturas ) setElementData(vehicle, "km", data.km) setElementData(vehicle, "idowner", data.characterID) setElementData(vehicle, "idveh", data.vehicleID) exports.vehicles_auxiliar:applyTunning(vehicle) setElementData(vehicle, "model", data.model) setElementData(vehicle, "fasemotor", data.fasemotor) setElementData(vehicle, "fasefrenos", data.fasefrenos) if data.marchas == 1 then setElementData(vehicle, "marchas", 1) end if data.marchas == 0 then setElementData(vehicle, "marchas", 0) end if data.fasemotor > 0 then exports.vehicles_auxiliar:solicitarMejora(vehicle, 1, data.fasemotor) end if data.fasefrenos > 0 then exports.vehicles_auxiliar:solicitarMejora(vehicle, 2, data.fasefrenos) end return true end end end addCommandHandler( { "createvehicle", "makevehicle" }, function( player, commandName, ... ) model = table.concat( { ... }, " " ) model = getVehicleModelFromName( model ) or tonumber( model ) if model then local x, y, z, rz = getPositionInFrontOf( player ) local vehicle = createVehicle( model, x, y, z, 0, 0, rz ) if vehicle then local r,g,b,r2,g2,b2 = getVehicleColor( vehicle ) local luz1, luz2, luz3 = getVehicleHeadLightColor ( vehicle ) local c1 = RGB2HEX (r or 255, g or 255, b or 255) local c2 = RGB2HEX (r2 or 255, g2 or 255, b2 or 255) local c3 = RGB2HEX (luz1 or 255, luz2 or 255, luz3 or 255) local vehicleID, error = exports.sql:query_insertid("INSERT INTO vehicles (model, posX, posY, posZ, rotX, rotY, rotZ, color1, color2, color3, respawnPosX, respawnPosY, respawnPosZ, respawnRotX, respawnRotY, respawnRotZ, interior, dimension, respawnInterior, respawnDimension, numberplate) VALUES (" .. table.concat( { model, x, y, z, 0, 0, rz,"'".. c1 .."'", "'".. c2 .."'", "'".. c3 .."'", x, y, z, 0, 0, rz, getElementInterior( player ), getElementDimension( player ), getElementInterior( player ), getElementDimension( player ), "'".. getVehiclePlateText( vehicle ) .."'" }, ", " ) .. ")" ) if vehicleID then -- tables for ID -> vehicle and vehicle -> data vehicleIDs[ vehicleID ] = vehicle vehicles[ vehicle ] = { vehicleID = vehicleID, respawnInterior = getElementInterior( player ), respawnDimension = getElementDimension( player ), characterID = 0, engineState = false, tintedWindows = false, fuel = 100 } -- some properties setElementInterior( vehicle, getElementInterior( player ) ) setElementDimension( vehicle, getElementDimension( player ) ) setVehicleEngineState( vehicle, false ) setVehicleOverrideLights( vehicle, 1 ) setElementData(vehicle, "idveh", vehicleID) setElementData( vehicle, "fuel", 100 ) setElementData( vehicle, "km", 0 ) setElementData( vehicle, "marchas", 0 ) setVehiclePlateText(vehicle, vehicleID) exports.vehicles_auxiliar:saveColors(vehicle) -- success message outputChatBox( "Has creado un " .. getVehicleName( vehicle ) .. " con el ID " .. vehicleID .. ".", player, 0, 255, 0 ) else destroyElement( vehicle ) outputChatBox( "MySQL-Query failed.", player, 255, 0, 0 ) end else outputChatBox( "El nombre del vehículo es incorrecto. Vuelve a intentarlo.", player, 255, 0, 0 ) end else outputChatBox( "Syntax: /" .. commandName .. " [modelo]", player, 255, 255, 255 ) end end, true ) addCommandHandler( { "deletevehicle", "delvehicle" }, function( player, commandName, vehicleID ) if hasObjectPermissionTo( player, "command.createvehicle", false ) or hasObjectPermissionTo( player, "command.temporaryvehicle", false ) then vehicleID = tonumber( vehicleID ) if vehicleID and vehicleID ~= 0 then if ( vehicleID >= 0 and not hasObjectPermissionTo( player, "command.createvehicle", false ) ) or ( vehicleID < 0 and not hasObjectPermissionTo( player, "command.temporaryvehicle", false ) ) then outputChatBox( "No puedes borrar este vehículo.", player, 255, 0, 0 ) else local vehicle = vehicleIDs[ vehicleID ] if vehicle then if vehicleID < 0 or exports.sql:query_free( "DELETE FROM vehicles WHERE vehicleID = " .. vehicleID ) then outputChatBox( "Has borrado el vehículo con ID " .. vehicleID .. " (" .. getVehicleName( vehicle ) .. ").", player, 0, 255, 153 ) if vehicleID > 0 then exports.logs:addLogMessage("delveh", "Vehículo ID "..vehicleID.. ", borrado por "..getPlayerName(player)..".\n") end -- remove from vehicles list vehicleIDs[ vehicleID ] = nil vehicles[ vehicle ] = nil destroyElement( vehicle ) else outputChatBox( "MySQL-Query failed.", player, 255, 0, 0 ) end else outputChatBox( "Vehículo no encontrado.", player, 255, 0, 0 ) end end else outputChatBox( "Syntax: /" .. commandName .. " [id]", player, 255, 255, 255 ) end end end ) function deleteVehicle ( vehicle ) if not vehicle then return end local data = vehicles[ vehicle ] vehicleID = tonumber( data.vehicleID ) if vehicleID then if vehicleID < 0 or exports.sql:query_free( "DELETE FROM vehicles WHERE vehicleID = " .. vehicleID ) then vehicleIDs[ vehicleID ] = nil vehicles[ vehicle ] = nil destroyElement( vehicle ) return true else return false end else return false end end function saveVehicle( vehicle, force ) if vehicle then if models [getElementModel(vehicle)] and not force then return false end if getOwner(vehicle) and getOwner(vehicle) <= -1 and not force then return end local data = vehicles[ vehicle ] if data and data.vehicleID > 0 then local x, y, z = getElementPosition( vehicle ) local rx, ry, rz = getVehicleRotation( vehicle ) local km = getElementData(vehicle, "km") local success, error = exports.sql:query_free( "UPDATE vehicles SET respawnPosX = " .. x .. ", respawnPosY = " .. y .. ", respawnPosZ = " .. z .. ", respawnRotX = " .. rx .. ", respawnRotY = " .. ry .. ", respawnRotZ = " .. rz .. ", respawnInterior = " .. getElementInterior( vehicle ) .. ", respawnDimension = " .. getElementDimension( vehicle ) .. ", posX = " .. x .. ", km = " .. km .. ", posY = " .. y .. ", posZ = " .. z .. ", rotX = " .. rx .. ", rotY = " .. ry .. ", rotZ = " .. rz .. ", health = " .. math.min( 1000, math.ceil( getElementHealth( vehicle ) ) ) .. ", interior = " .. getElementInterior( vehicle ) .. ", dimension = " .. getElementDimension( vehicle ) .. ", fuel = " .. data.fuel .. " WHERE vehicleID = " .. data.vehicleID ) end end end addEventHandler( "onResourceStop", resourceRoot, function( ) for k, v in pairs( getElementsByType("vehicle") ) do saveVehicle( v ) end vehicles = { } vehicleIDs = { } end ) addEventHandler( "onVehicleRespawn", resourceRoot, function( ) local data = vehicles[ source ] if data and data.vehicleID > 0 then setElementInterior( source, data.respawnInterior ) setElementDimension( source, data.respawnDimension ) saveVehicle( source ) end end ) Aqui tienes una ayuda, para que puedas ver el link completo del codigo (aqui)
  12. Prueba con esto! function Apagar_Vehiculos ( ) local Vehiculos = getElementsByType ( "vehicle" ) for _, vehicle in pairs(Vehiculos) do setVehicleEngineState(vehicle, false) end end addEventHandler ( "onResourceStart", getRootElement(), Apagar_Vehiculos )
  13. Significa que el recurso sql no ha iniciado, ya que el recurso bank exporta una función de ese recurso.
×
×
  • Create New...