-
Posts
21,935 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Castillo
-
Try this: DeliveryLocations = { "-1838, 14, 16, 0", "-1708, 12, 4, 0", "-2464, 787, 36, 0", "-1935, 272, 42, 0", "653, 1691, 8, 0", "1052, 2088, 11, 0", "2185, 1976, 11, 0", "2868, 2577, 11, 0", "2244, 2234, 11, 0", "2351, 1891, 11, 0", "2842, 899, 11, 0", "2793, -2417, 14, 0", "2057, -2195, 14, 0", "1619, -1554, 14, 0", "988, -913, 43, 0", "1340, 285, 20, 0", "2260, -85, 27, 0", "708, -607, 17, 0", "202, -173, 2, 0", "-546, -499, 26, 0", "-1019, -649, 33, 0", "-165, 1016, 21, 0", "273, 1344, 12, 0" } ----------------------------------------------------------- local sWidth,sHeight = guiGetScreenSize() local loca = {} local DeliveryLocationTableSize = table.maxn ( DeliveryLocations ) local randomLocationIdx = math.random ( 1, DeliveryLocationTableSize ) local locString = tostring( DeliveryLocations[randomLocationIdx] ) loca.Location = split ( locString, string.byte( "," ) ) local DelX = loca.Location[1] local DelY = loca.Location[2] local DelZ = loca.Location[3] JobStart = createColSphere( -50, -271, 5.7, 1 ) JobStartM = createMarker( -50, -271, 5.7, "cylinder", 1, 0, 200, 0 ) JobStartB = createBlipAttachedTo( JobStart, 58 ) local vehicle = nil local trailer = nil function giveVehicle( theElement ) if ( theElement == getLocalPlayer() ) then removeEventHandler("onClientColShapeHit",JobStart,giveVehicle) triggerServerEvent("start",root, theElement) addEventHandler("onClientRender",root,renderHP) destroyElement(JobStart) destroyElement(JobStartM) destroyElement(JobStartB) end end addEventHandler("onClientColShapeHit",JobStart,giveVehicle) addEvent("HP",true) addEventHandler("HP",root, function(mVehicle, mTrailer) vehicle = mVehicle trailer = mTrailer end ) function renderHP() if (isElement(vehicle) and isElement(trailer)) then TruckHP = getElementHealth(vehicle) TrailerHP = getElementHealth(trailer) TruckHP2 = tonumber(TruckHP) TrailerHP2 = tonumber(TrailerHP) TruckHPF = math.ceil(TruckHP2) TrailerHPF = math.ceil(TrailerHP2) truHP = dxDrawText("HP(Truck): " .. tostring(TruckHPF) .. "", sWidth/1.2,sHeight-47, sWidth, sHeight ) traHP = dxDrawText("HP(Trailer): " .. tostring(TrailerHPF) .. "", sWidth/1.2,sHeight-57, sWidth, sHeight ) end end addEvent("trailerAtt",true) addEventHandler("trailerAtt",root, function() Destiny = createColSphere( DelX, DelY, DelZ, 3 ) DestinyM = createMarker( DelX, DelY, DelZ, "cylinder", 3, 0, 200, 0 ) DestinyB = createBlipAttachedTo( Destiny, 52 ) addEventHandler("onClientColShapeHit",Destiny,Reward) end ) addEvent("trailerDet",true) addEventHandler("trailerDet",root, function() removeEventHandler("onClientRender",root,renderHP) destroyElement(Destiny) destroyElement(DestinyM) destroyElement(DestinyB) end ) addEvent("markersOn",true) addEventHandler("markersOn",root, function() JobStart = createColSphere( -50, -271, 5.7, 1 ) JobStartM = createMarker( -50, -271, 5.7, "cylinder", 1, 0, 200, 0 ) JobStartB = createBlipAttachedTo( JobStart, 58 ) addEventHandler("onClientColShapeHit",JobStart,giveVehicle) end ) addEvent("destroyWin",true) addEventHandler("destroyWin",root, function( theElement ) if ( theElement == getLocalPlayer() ) then removeEventHandler("onClientRender",root,renderHP) JobStart = createColSphere( -50, -271, 5.7, 1 ) JobStartM = createMarker( -50, -271, 5.7, "cylinder", 1, 0, 200, 0 ) JobStartB = createBlipAttachedTo( JobStart, 58 ) addEventHandler("onClientColShapeHit",JobStart,giveVehicle) end end ) addEvent("destroyFail",true) addEventHandler("destroyFail",root, function() removeEventHandler("onClientRender",root,renderHP) if (Destiny) then if (DestinyM) then if (DestinyB) then removeEventHandler("onClientRender",root,renderHP) destroyElement(Destiny) destroyElement(DestinyM) destroyElement(DestinyB) end end end end ) addEvent("destroyFailE",true) addEventHandler("destroyFailE",root, function() removeEventHandler("onClientRender",root,renderHP) if (Destiny) then if (DestinyM) then if (DestinyB) then destroyElement(Destiny) destroyElement(DestinyM) destroyElement(DestinyB) end end end end ) function Reward( theElement ) if ( theElement == getLocalPlayer() ) then removeEventHandler("onClientRender",root,renderHP) triggerServerEvent("win",root, theElement) destroyElement(Destiny) destroyElement(DestinyM) destroyElement(DestinyB) end end
-
Solo usa: getElementPosition para obtener la posicion del jugador.
-
function crearVehiculoParaJugador(elJugador, nombreDelComando, modeloDeVehiculo) local x,y,z = getElementPosition(elJugador) x = x + 5 local vehiculoCreado = createVehicle(tonumber(modeloDeVehiculo),x,y,z) if (vehiculoCreado == false) then outputChatBox("Error al crear vehículo.",elJugador,255,0,0) -- Color rojo = 255, 0, 0. end end addCommandHandler("crearvehiculo", crearVehiculoParaJugador)
-
No se que tiene quever los coches nuevos con este problema.
-
El problema son los acentos, Lua no los soporta. function crearVehiculoParaJugador(elJugador, nombreDelComando, modeloDeVehiculo) local x,y,z = getElementPosition(elJugador) x = x + 5 local vehiculoCreado = createVehicle(tonumber(modeloDeVehiculo),x,y,z) if (vehiculoCreado == false) then outputChatBox("Error al crear vehículo.",elJugador) end end addCommandHandler("crearvehiculo", crearVehiculoParaJugador)
-
Es muy facil: addEventHandler("onGamemodeMapStart", root, function ( mapres ) outputChatBox( "Mapa: ".. getResourceName( mapres ) ) outputChatBox( "Autor: ".. getResourceInfo( mapres, "author" ) ) outputChatBox( "Version: ".. getResourceInfo( mapres, "version" ) ) end ) Es server side.
-
local tabla = {"Uno", "Dos", "Tres", "Cuatro", "Cinco"} for index, value in ipairs(tabla) do outputChatBox(index .." = ".. value) end
-
local streamURL = "http://dc162.4shared.com/img/1136148919/682088a1/dlink__2Fdownload_2FyLCwlhkI_3Ftsid_3D20120225-64913-6b58cda0/preview.mp3" function onResourceStart() sound = playSound(streamURL, true) end function toggleSong() if not isSoundPaused(song) then setSoundPaused(song, true) removeEventHandler("onClientPlayerRadioSwitch",getRootElement(),makeRadioStayOff) else setSoundPaused(song, false) setRadioChannel(0) addEventHandler("onClientPlayerRadioSwitch",getRootElement(),makeRadioStayOff) end end addEventHandler("onClientResourceStart",resourceRoot,onResourceStart) addEventHandler("onClientPlayerRadioSwitch",getRootElement(),makeRadioStayOff) addEventHandler("onClientPlayerVehicleEnter",getRootElement(),makeRadioStayOff) addCommandHandler("music",toggleSong) bindKey("m","down",toggleSong)
-
Just freeze the ped. setElementFrozen
-
No estoy seguro, nunca probe con peds. Pero, no va a pasar nada por probarlo.
-
I think Paper want's you to explain why: exports.mapmanager:getMapsCompatibleWithGamemode(getThisResource()) isn't the same as: function getMapsForGm( name ) local running = getResourceFromName( name ) or exports.mapmanager:getRunningGamemode( ) if running then return exports.mapmanager:getMapsCompatibleWithGamemode( running ) end return false end
-
My code would have worked with the new DB functions, I have never used Ryden's module. Edit: table.insert(_top,{row.name,row.Money,row.point}) -- You forgot a comma after row.Money.
-
addCommandHandler("get", function () local result = mysql_query(handler, "SELECT * FROM some_table") if (result) then for index, data in ipairs(result) do outputChatBox(data.playername .." - ".. data.Money .." - ".. data.points) end mysql_free_result(result) end end )
-
You're welcome.
-
"teste.lua" will load before "textlib.lua" does.
-
guiSetProperty(myLabel, "AlwaysOnTop", "true" )
-
The items are being added, but the height isn't enough. local mujNick = string.gsub(getPlayerName(getLocalPlayer()), "#%x%x%x%x%x%x", "") seznam = guiCreateComboBox(103,38,132,25,mujNick,false,statsGui)--It's created.. with my nick. function testPurposes(cmd, value) outputChatBox("nuze")--It outputs guiComboBoxAddItem( seznam, value )--Do nothing outputChatBox("done")--Also outputs local x, y = guiGetSize(seznam, false) guiSetSize(seznam, x, y+25, false) end addCommandHandler("testik", testPurposes)
-
No hay de que.
-
Y cual es el problema? que es lo que funciona.
-
staffTeam = createTeam ("Staff", 255, 255, 255) setTeamFriendlyFire (staffTeam, false) function joinTeam (thePlayer) local accName = getAccountName (getPlayerAccount (thePlayer)) if ( isObjectInACLGroup ("user." .. accName, aclGetGroup("Admin")) or isObjectInACLGroup ("user." .. accName, aclGetGroup ("Moderator")) or isObjectInACLGroup ("user." .. accName, aclGetGroup ("SuperModerator")) ) then if (staffTeam) then setPlayerTeam (thePlayer, staffTeam) setElementData( thePlayer, "Occupation", "Head Staff", true ) outputChatBox ( "You are now Staff.", thePlayer, 0,255, 0 ) end end end addCommandHandler ("staff", joinTeam)
-
No entiendo de que estas hablando, el script que funciona con comando anda perfectamente.
-
criminalTeam = createTeam ("Criminal", 255, 0, 0) function joinTeam (thePlayer) setElementData( thePlayer, "Job", "Criminal", true ) setPlayerTeam (thePlayer, criminalTeam) setElementModel (thePlayer, 29) end addCommandHandler ("criminal", joinTeam)