Jump to content

Castillo

Retired Staff
  • Posts

    21,935
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Castillo

  1. De nada. @NOD: No tiene sentido mencionar esa funcion, el que disparo el arma es el cliente.
  2. getElementData? es un chiste supongo. -- client side: addEventHandler ( "onClientPlayerWeaponFire", localPlayer, function ( weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement ) if ( hitElement and getElementType ( hitElement ) == "player" ) then triggerServerEvent ( "takeWeapons", localPlayer ) end end ) -- server side: addEvent ( "takeWeapons", true ) addEventHandler ( "takeWeapons", root, function ( ) takeAllWeapons ( source ) end )
  3. addEventHandler ( "onClientPlayerWeaponFire", localPlayer, function ( weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement ) if ( hitElement and getElementType ( hitElement ) == "player" ) then setPedWeaponSlot ( localPlayer, 0 ) end end ) Proba eso.
  4. Te las quite o te cambie de slot a 0?
  5. function dxsetText ( ) local text = "" local UP = tonumber ( getElementData ( localPlayer, "level" ) ) or 0 if ( UP == 1 ) then text = "/60" elseif ( UP == 2 ) then text = "/110" elseif ( UP == 3 ) then text = "/160" elseif ( UP == 4 ) then text = "/250" elseif ( UP == 5 ) then text = "/500" elseif ( UP == 6 ) then text = "/2000" elseif ( UP == 7 ) then text = "/4000" elseif ( UP == 8 ) then text = "/8000" elseif ( UP == 9 ) then text = "/12000" elseif ( UP == 10 ) then text = "/16000" elseif ( UP == 11 ) then text = "/20000" elseif ( UP == 12 ) then text = "/24000" elseif ( UP == 13 ) then text = "/28000" elseif ( UP == 14 ) then text = "/32000" elseif ( UP == 15 ) then text = "/36000" elseif ( UP == 16 ) then text = "/40000" elseif ( UP == 17 ) then text = "/44000" elseif ( UP == 18 ) then text = "/48000" elseif ( UP == 19 ) then text = "/52000" elseif ( UP == 20 ) then text = "/56000" elseif ( UP == 21 ) then text = "/66000" elseif ( UP == 22 ) then text = "/78000" elseif ( UP == 23 ) then text = "/87000" elseif ( UP == 24 ) then text = "/99000" elseif ( UP == 25 ) then text = "/110000" elseif ( UP == 26 ) then text = "/119000" elseif ( UP == 27 ) then text = "/127000" elseif ( UP == 28 ) then text = "/139000" elseif ( UP == 29 ) then text = "/148000" elseif ( UP == 30 ) then text = "/156000" elseif ( UP == 31 ) then text = "/166000" elseif ( UP == 32 ) then text = "/179000" elseif ( UP == 33 ) then text = "/187000" elseif ( UP == 34 ) then text = "/198000" elseif ( UP == 35 ) then text = "/209000" end GUIEditor_Label[5] = guiCreateLabel(706,159,63,13,text,false) guiSetFont ( GUIEditor_Label[5], "default-bold-small" ) end addEventHandler ( "onClientResourceStart", resourceRoot, dxsetText ) addEventHandler ( "onClientElementDataChange", localPlayer, function ( dataName ) if ( dataName == "level" ) then dxsetText ( ) end end )
  6. https://wiki.multitheftauto.com/wiki/OnC ... aponSwitch
  7. You can't add nitro to boats/planes, but you can set their handling and increase the speed. setVehicleHandling
  8. Castillo

    teleporting

    Maybe this: https://community.multitheftauto.com/ind ... ls&id=1960
  9. Not possible as far as I know.
  10. Doubt it, I think he's talking about the ACL groups. @jens: Just edit the privileges at the "acl.xml".
  11. Agreed. @S.K: You must start learning to script, then you can post again if you have problems.
  12. https://community.multitheftauto.com/index.php?p= ... ils&id=532 https://community.multitheftauto.com/index.php?p= ... ils&id=531
  13. Castillo

    GUI animations

    Yeah, that library has some bugs.
  14. If I understood correctly, he wants to lock vehicles to be driven only by a X player.
  15. Castillo

    GUI animations

    There is the animation library by arc_: --[[ 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
  16. This line: local xmlNewChild = xmlCreateChild(xmlLoadFile,"element") Should be: local xmlNewChild = xmlCreateChild ( xmlElements, "element" )
  17. https://wiki.multitheftauto.com/wiki/Interior_IDs
  18. createObject addCommandHandler moveObject
  19. Could you both stay on topic?
  20. function createLoginWindow ( ) local sWidth, sHeight = guiGetScreenSize() local width, height = 450, 450 local x = (sWidth/2) - (width/2) local y = (sHeight/2) - (height/2) loginWindow = guiCreateWindow(x,y, width, height, "Please Log-In", false) guiWindowSetMovable (loginWindow, false) guiWindowSetSizable (loginWindow, false) guiCreateLabel(190,50,35, 25, "Username", false, loginWindow) guiCreateLabel(190,100, 35,25, "Password", false, loginWindow ) editUser = guiCreateEdit(190,75,100,40, "", false, loginWindow) editPass = guiCreateEdit(190, 125, 100, 40, "", false, loginWindow) guiEditSetMaxLength(editUser, 50) guiEditSetMaxLength(editPass, 50) button = guiCreateButton (190, 250, 50, 50, "Submit", false, loginWindow) guiSetVisible(loginWindow, false) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function () createLoginWindow() outputChatBox("Wlcome to MTA:SA Cops & Robbers Server. Please Log-In") if loginWindow ~= nil then guiSetVisible(loginWindow, true) else outputChatBox("An error has occured") end end ) function submit (button, state) if button == "left" and state =="up" then local username = guiGetText(editUser) local password = guiGetText(editPass) if username and password then triggerServerEvent("submitLogin", getRootElement(), username, password) guiSetInputEnabled(false) guiSetVisible(loginWindow, false) showCursor(false) else outputChatBox("Please Enter Username And Password") end end end addEventHandler("onClientGUIClick", button, submit, false) It was because you put: guiEditSetMaxLenght ( editPass, 50 ) Instead of: guiEditSetMaxLength ( editPass, 50 ) The function name was wrong.
×
×
  • Create New...