Jump to content

Castillo

Retired Staff
  • Posts

    21,935
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Castillo

  1. Posting your code would help us to help you.
  2. Castillo

    dxscoreboard

    Moved to "Scripting" section. ---------------------------------- function win ( killer ) if ( killer and getElementType ( killer ) == "player" ) then local H = tonumber ( getElementData ( killer, "ExP" ) ) or 0 local S = getElementData ( killer, "Level" ) setElementData ( killer, "ExP", H + 1 ) if ( levels [ H ] ) then setElementData ( killer, "Level", "Lvl ".. tostring ( levels [ H ] ) .." !" ) triggerClientEvent ( killer, "playSound", killer ) end end end addEvent ( "onZombieWasted", true ) addEventHandler ( "onZombieWasted", getRootElement(), win )
  3. We'll not make it for you, you must try to do it and then we can help you fix your errors. https://wiki.multitheftauto.com/wiki/Scr ... troduction http://www.lua.org/pil/index.html http://lua-users.org/wiki/TutorialDirectory http://www.lua.org/manual/5.1/#index
  4. This will never work because you're checking if the userdata of the vehicle is on the table, you must get the vehicle model instead. local tVehicles = { [ 411 ] = true; } addEventHandler ( 'onClientVehicleEnter', root, function ( uPlayer ) if ( tVehicles [ getElementModel ( source ) ) ] ) then -- if vehicle is any of the ids in the table triggerEvent ( 'checkForData', uPlayer ); -- trigger event [ THAT'S JUST AN EXAMPLE ] end end )
  5. Castillo

    police help

    You'll need to make it client side as well, in the MTA community there's "j-jobs", it has the ped-follow-cop thing, you could look on how it's done.
  6. addEvent ( "truckerMarker", true ) addEventHandler ( 'truckerMarker', root, function ( ) x, y, z = getRandomLocation ( ); truckMarker = createMarker ( x, y, z, 'cylinder', 2, 250, 250, 250 ); truckBlip = createBlipAttachedTo ( truckMarker, 53 ); local location = getZoneName ( x, y, z ) outputChatBox ( "Drive to: ".. location .. "!" ) end ) addEventHandler ( 'onClientMarkerHit', root, function ( hitElement ) if ( hitElement == localPlayer and source == truckerMarker ) then triggerServerEvent ( 'arrivedLocation', localPlayer ) end end )
  7. No, eso no tiene sentido. local toDraw = "" local screenWidth, screenHeight = guiGetScreenSize ( ) addEventHandler('onClientPlayerJoin', root, function ( ) toDraw = getPlayerName ( source ) .." se a unido al servidor." end ) addEventHandler('onClientPlayerQuit', root, function ( ) toDraw = getPlayerName ( source ) .." se fue del servidor." end ) function drawText ( ) dxDrawText ( toDraw, 44, screenHeight - 41, screenWidth, screenHeight, tocolor ( 0, 0, 0, 255 ), 1.02, "pricedown" ) dxDrawText ( toDraw, 44, screenHeight - 43, screenWidth, screenHeight, tocolor ( 255, 255, 255, 255 ), 1, "pricedown" ) end addEventHandler ( "onClientRender", root, drawText )
  8. Castillo

    Ayuda :/

    Necesitas hacer el script client side y server side, asi podes cancelar el daño que hace el medico. -- client side: function healing ( attacker, attackerweapon, bodypart, loss ) local health = getElementHealth ( source ) if ( attacker and getElementType ( attacker ) == "player" ) and ( attackerweapon == 41 ) and ( loss > 1 ) and ( health < 95 ) then if ( not skin [ getElementModel ( attacker ) ] ) then return end else cancelEvent ( ) if ( not isTimer ( waitTimer ) ) then triggerServerEvent ( "healPlayer", localPlayer, attacker, health ) waitTimer = setTimer ( function ( ) end, 2000, 1 ) end end end addEventHandler ( "onClientPlayerDamage", getRootElement(), healing ) -- server side: addEvent ( "healPlayer", true ) addEventHandler ( "healPlayer", root, function ( medic, health ) if ( health < 99 ) then setElementHealth ( source, health + 15 ) givePlayerMoney ( medic, 1.7 * health ) takePlayerMoney ( source, 1.9 * health ) end end )
  9. You mean clicking on "air" it'll close the GUI?
  10. function markerHit ( hitPlayer ) if ( hitPlayer == localPlayer ) then GUIEditor_Window[1] = guiCreateWindow(0.6006,0.4867,0.1992,0.45,"GUI Casas",true) GUIEditor_Label[1] = guiCreateLabel(25,36,262,20,"Dueño de la casa : \"\"",false,GUIEditor_Window[1]) GUIEditor_Label[2] = guiCreateLabel(25,58,231,19,"Precio : \"\"",false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(9,107,179,30,"Comprar Casa",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(9,107,179,30,"Comprar Casa",false,GUIEditor_Window[1]) GUIEditor_Button[3] = guiCreateButton(9,141,179,30,"Vender Casa",false,GUIEditor_Window[1]) GUIEditor_Button[4] = guiCreateButton(9,175,179,30,"Bloquear Casa",false,GUIEditor_Window[1]) GUIEditor_Button[5] = guiCreateButton(10,208,179,32,"Entrar a la Casa",false,GUIEditor_Window[1]) end end addEventHandler ( "onClientMarkerHit", maker, markerHit ) "==" es: Igual a. "~=" es: Diferente a.
  11. Castillo

    car mods

    If I'm right, it'll jus treplace your Honda CRV with the Hummer H3.
  12. I actually recommend to use the built-on (My)SQL functions dbConnect dbExec dbQuery dbPoll dbFree To drop a MySQL table you can do this: dbExec ( handler, "DROP TABLE `myTable`" )
  13. Your problem is the "blockChatMessage" function, it'll cancel all chat messages, no matters if is not a team message, you have to use cancelEvent on "sendMessageToNearbyPlayers" function. local chatRadius = 50 function sendMessageToNearbyPlayers ( message, messageType ) if ( messageType == 0 ) then local posX, posY, posZ = getElementPosition ( source ) local chatSphere = createColSphere ( posX, posY, posZ, chatRadius ) local nearbyPlayers = getElementsWithinColShape ( chatSphere, "player" ) destroyElement ( chatSphere ) for index, nearbyPlayer in ipairs( nearbyPlayers ) do local red, green, blue = getPlayerNametagColor ( source ) outputChatBox( getPlayerName ( source )..": #ffffff".. message, nearbyPlayer, red, green, blue, true ) end cancelEvent ( ) end end addEventHandler ( "onPlayerChat", getRootElement(), sendMessageToNearbyPlayers )
  14. Son lo mismo, que yo sepa. La unica diferencia que yo conozco es que el onPlayerDamage no se puede cancelar, y que es server side .
  15. addEventHandler ( "onClientPlayerDamage", root, function ( attacker ) if ( attacker and getElementType ( attacker ) == "vehicle" ) then -- Si existe el atacante y el atacante es un vehiculo. cancelEvent ( ) -- Cancelamos el evento. end end )
  16. You've got many things wrong there. 1: You're not executing the function "VerPing" at all. 2: You don't need to use: hasObjectPermisionTo, you don't have to create the function "kickear" at all actually. 3: You're not passing any argument to "kickear" function. local kickTimers = { } function VerPing ( ) for index, player in ipairs ( getElementsByType ( "player" ) ) do local ping = getPlayerPing ( player ) if ( ping > 600 and not kickTimers [ player ] ) then outputChatBox ( "Cuidado Tu ping es muy alto : ".. ping ..", Seras Kickeado " ) kickTimers [ player ] = setTimer ( kickPlayer, 5000, 1, player ) end end end setTimer ( VerPing, 2000, 0 ) Every 2 seconds it'll check all player pings.
  17. Tenes bastantes problemas. 1: No estas ejecutando la funcion "VerPing". 2: No necesitas el hasObjectPermisionTo, osea, no necesitas la funcion "kickear". 3: No estas pasando ningun argumento a la funcion "kickear". local kickTimers = { } function VerPing ( ) for index, player in ipairs ( getElementsByType ( "player" ) ) do local ping = getPlayerPing ( player ) if ( ping > 600 and not kickTimers [ player ] ) then outputChatBox ( "Cuidado Tu ping es muy alto : ".. ping ..", Seras Kickeado " ) kickTimers [ player ] = setTimer ( kickPlayer, 5000, 1, player ) end end end setTimer ( VerPing, 2000, 0 ) Cada 2 segundos va a verificar el ping de todos los jugadores.
  18. Sin ofender, pero eso es un huevo de dinosaurio? osea, no entiendo que intentan crear, un efecto de luz?
  19. This is arc_'s animation library. --[[ Client animation library by arc_ Version 1.0.0 Licence ---------------- You are free to modify this file and redistribute it with your changes. However, always mention that you changed it (and eventually what changes you made) and keep the original author, version number and licence intact. Selling this script or a derivative of it is not allowed. Documentation ---------------- Terminology - Animation: a sequence of phases that act on one or more elements and follow each other sequentially in time. Multiple animations can be running at the same time. All defined animations run in parallel. An animation is in fact one phase with several subphases (see below), with animation specific functions available. - Phase: a part of an animation sequence. A phase consists of a paramater that linearly goes from a given starting value to a given ending value, over the specified amount of time, and is applied to one certain element. While a phase is running, its callback function will be called onClientRender with the following arguments: phase.fn(element elem, float param, table phase) Specifying time and callback function is optional. If no time is specified but a function is, phase.fn(elem) will be called once. If no function is specified but a time is, the phase consists of simply waiting during that time, doing nothing. A phase can be run once, repeated multiple times or loop infinitely. Phases can also contain phases. In that case the parent phase consists of completing all child phases, in order. This allows you to f.e. make an element move left and right continuously: define a phase for moving it to the left, followed by a phase for moving it back to the right, and encapsulate these two phases in a parent phase that loops forever. Phases can be nested to arbitrary depth. The element a subphase works on is inherited from its parent phase (or, if the parent phase doesn't specify an element, from the grandparent, etc). Definition of a phase A phase is simply a table containing properties and (optionally) subphases. Available phase properties are: (the values for the properties are examples, not default values) phase = { from = 0, -- the starting value of the parameter to = 1, -- the ending value of the parameter [time = 1000,] -- the time (in ms) in which to go from start to end [fn = callback,] -- the function to call on each frame update [repeats = 5,] -- how many times to run this phase before going on to -- the next. defaults to 1 [subphase1,] -- optional subphases. if one or more of these are included, [subphase2,] -- only the "repeats" property is valid for this parent phase ... } Available functions anim = Animation.create(elem, phase1, phase2, ...) Creates and returns a new animation. This means nothing more than creating a new phase, putting the specified phases in it as subphases, and making the functions of the Animation class available to it. Once an animation is created, it is not yet running. anim = Animation.createAndPlay(elem, phase1, phase2, ...) Creates a new animation and immediately starts playing it. anim = Animation.createNamed(name, elem, ...) If an animation with the specified name exists, returns that animation. Otherwise creates a new named animation. You can look the animation up again later with Animation.getNamed(name). anim = Animation.createNamedAndPlay(name, elem, ...) Self explanatory. anim = Animation.getNamed(name) Returns the animation with the specified name if it exists, false otherwise. anim:play() Start playing a newly created animation or resume a paused animation. anim:pause() Pauses the animation. Resume it later with anim:play() or delete it with anim:remove(). anim:remove() Deletes the animation completely. It can not be resumed anymore. anim:isPlaying() Returns true if the animation is currently playing, false if not. Animation.playingAnimationsExist() Returns true if there is any animation that is currently playing. anim:addPhase(phase3), phase2:addPhase(phase3) Appends a new subphase to the animation or phase. Can be done while the animation is playing. Note that to be able to use phase2:addPhase(), phase2 first has to be processed (default values filled in, made part of the Phase class) by being passed as an argument to Animation.create[AndPlay] or addPhase. Examples Fade in a picture: local pict = guiCreateStaticImage(...) Animation.createAndPlay(pict, { from = 0, to = 1, time = 2000, fn = guiSetAlpha }) Fade in a picture using a preset (for more presets, see the end of this file): local pict = guiCreateStaticImage(...) Animation.createAndPlay(pict, Animation.presets.guiFadeIn(2000)) Move a label to the right while fading it in: local label = guiCreateLabel(10, 100, 150, 20, 'Test', false) Animation.createAndPlay(label, Animation.presets.guiMove(200, 100, 2000)) Animation.createAndPlay(label, Animation.presets.guiFadeIn(2000)) Move a label left and right forever, without presets: function guiSetX(elem, x) local curX, curY = guiGetPosition(elem, false) guiSetPosition(elem, x, curY, false) end local label = guiCreateLabel(10, 100, 150, 20, 'Test', false) Animation.createAndPlay( label, { repeats = 0, { from = 10, to = 200, time = 2000, fn = guiSetX }, { from = 200, to = 10, time = 2000, fn = guiSetX } } ) ]]-- Phase = {} Phase.__index = Phase Animation = setmetatable({}, { __index = Phase }) Animation.__index = Animation Animation.collection = {} function Animation.create(elem, ...) local anim = setmetatable({ elem = elem, ... }, Animation) anim:_setup() return anim end function Animation.createAndPlay(elem, ...) local anim = Animation.create(elem, ...) anim:play() return anim end function Animation.createNamed(name, elem, ...) local anim = Animation.getNamed(name) or Animation.create(elem, ...) anim.name = name return anim end function Animation.createNamedAndPlay(name, elem, ...) local anim = Animation.createNamed(name, elem, ...) anim:play() return anim end function Animation.getNamed(name) local i, anim = table.find(Animation.collection, 'name', name) return i and anim end function Animation:isPlaying() return self.playing or false end function Animation.playingAnimationsExist() return table.find(Animation.collection, 'playing', true) and true end function Animation:play() if self.playing then return end if not table.find(Animation.collection, self) then table.insert(Animation.collection, self) end if not Animation.playingAnimationsExist() then addEventHandler('onClientRender', getRootElement(), updateAnim) end self.playing = true end function Animation:pause() self.playing = false if not Animation.playingAnimationsExist() then removeEventHandler('onClientRender', getRootElement(), updateAnim) end end function Animation:remove() table.removevalue(Animation.collection, self) if not Animation.playingAnimationsExist() then removeEventHandler('onClientRender', getRootElement(), updateAnim) end self.playing = false end function Phase:_setup(parent) self.parent = parent if self[1] then for i,phase in ipairs(self) do if type(phase) == 'function' then phase = { fn = phase } self[i] = phase end setmetatable(phase, Phase) phase:_setup(self) end self.curphase = 1 elseif self.time then self.from = self.from or 0 self.to = self.to or 1 self.speed = (self.to - self.from) / self.time end self.repeats = self.repeats
  20. I can't help you if you don't give me the full code.
  21. name1 = guiCreateLabel(50,10,410,20,"test1",false) name2 = guiCreateLabel(50,25,410,20,"test2",false) money1 = guiCreateLabel(300,10,410,20,"20000",false) money2 = guiCreateLabel(300,25,410,20,"17000",false) function show ( ) local playerMoney = getPlayerMoney ( ) local name = getPlayerName ( localPlayer ) if ( playerMoney >= tonumber ( guiGetText ( money1 ) ) ) then guiSetText ( name2, guiGetText ( name1 ) ) guiSetText ( name1, "The Name: ".. name ) guiSetText ( money2, guiGetText ( money1 ) ) guiSetText ( money1, tostring ( playerMoney ) ) end end addEventHandler ( "onClientRender", getRootElement(), show ) You had to convert the number to a string.
  22. I don't really understand what are you trying to achieve.
  23. Castillo

    Entire value?

    Woah, got it, thanks. /lock please Someone may have the same problem, there's no point on closing it .
×
×
  • Create New...