Jump to content

alex17

Members
  • Posts

    302
  • Joined

  • Last visited

Everything posted by alex17

  1. Más de lo mismo, el archivo debe ser de tipo server, no? no debe ser tipo client
  2. lo siento puse mal el nombre del evento reemplaza esto addEventHandler ( "onClientplayerDamage", getRootElement(), cancelPedDamage ) por esto addEventHandler ( "onClientPlayerDamage", getRootElement(), cancelPedDamage )
  3. function cancelPedDamage ( attacker ) local team1 = getElementData(localPlayer, "gang") local team2 = getElementData(attacker , "gang") if team1 and team2 then if team1 == team2 then cancelEvent() end end end addEventHandler ( "onClientplayerDamage", getRootElement(), cancelPedDamage ) tal ves esto te sirva para que no se dañen los del mismo gang, en cuanto a lo de crear una gang con un comando debes mostrar que sistema de gang usas.
  4. es verdad copia lo que te paso @Sasu que ya esta corregido
  5. tal vez esto sirva no estoy muy seguro , tendrás que probarlo signos = {"$", "%", "!", "#"} function register() ------- ------- ------- for _, text in ipairs(signos) do if string.find(username, text) then return outputChatBox("No esta permitido este signo ( " ..text " )" ) end end end
  6. tal ves te sirva esta forma para que no estés haciendo botón por botón botones = { [1] = {posx = 0, posy = 0, width = 100, height = 100, r= 0, g = 0, b = 0, r2 = 100, g2 = 0, b2 = 0, title = "rifles", tr = 255, tg = 255, tb = 255, tr2 = 0, tg2 = 0, tb2 = 0}, [2] = {posx = 0, posy = 0, width = 100, height = 100, r= 0, g = 0, b = 0, r2 = 100, g2 = 0, b2 = 0, title = "click", tr = 255, tg = 255, tb = 255, tr2 = 0, tg2 = 0, tb2 = 0} } function menuRifles() for _, boton in ipairs(botones) do if isCursorOnElement(boton.posx, boton.posy, boton.width, boton.height) then dxDrawRectangle(boton.posx, boton.posy, boton.width, boton.height, tocolor(boton.r, boton.g, boton.b), false) dxDrawText (boton.tile, boton.posx, boton.posy, boton.posx + boton.width, boton.posy + boton.height, tocolor(boton.tr, boton.tg, boton.tb) , 1, "default-bold") else dxDrawRectangle(boton.posx, boton.posy, boton.width, boton.height, tocolor(boton.r2, boton.g2, boton.b2), false) dxDrawText (boton.tile, boton.posx, boton.posy, boton.posx + boton.width, boton.posy + boton.height, tocolor(boton.tr2, boton.tg2, boton.tb2) , 1, "default-bold") end end end function onBotonClick(button, state, px, py) if (button == "left" and state == "down") then for _, boton in ipairs(botones) do if isCursorOnElement(boton.posx, boton.posy, boton.width, boton.height) then ----- ----- ----- return end end end end function isCursorOnElement(x,y,w,h) local mx,my = getCursorPosition () local fullx,fully = guiGetScreenSize() cursorx,cursory = mx*fullx,my*fully if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then return true else return false end end
  7. reemplaza esta parte function entrar ( element ) if getElementType ( element ) == "player" then table.insert ( tabla, element ) if #tabla == 2 then for i = 1, 2 do local data = posiciones[i] local x, y, z, rot = data.posx, data.posy, data.posz, data.rot setElementPosition ( tabla[i], x, y, z ) setElementRotation ( tabla[i], 0, rot, 0 ) table.remove ( tabla, i ) end else outputChatBox ( "¡Necesitas otro jugador!", element, 255, 0, 0 ) end end end addEventHandler ( "onMarkerHit", root, entrar )
  8. me equivoque en algo prueba con esto Cplayer = {} Posiciones = { {posx = 0, posy = 0, posz = 0, rot = 0}, {posx = 0, posy = 0, posz = 0, rot = 0} } function markerJoin(element) if getElementType( element ) == "player" then table.insert(Cplayer, element) if #Cplayer >= 2 then for k, player in ipairs(Cplayer) do local data = Posiciones[k] local x, y, z, rot = data.posx, data.posy, data.posz, data.rot setElementPosition( player, x, y, z) setElementRotation( player, 0, rot, 0) tabel.remove(Cplayer, k) end end end end addEventHandler("onMarkerHit", root, markerJoin) function markerleave(element) if getElementType( element ) == "player" then for k, player in ipairs(Cplayer) do if player == element then tabel.remove(Cplayer, k) end end end end addEventHandler("onMarkerLeave", root, markerleave)
  9. Esto debería de funcionar. Cplayer = {} Posiciones = { {posx = 0, posy = 0, posz = 0, rot = 0}, {posx = 0, posy = 0, posz = 0, rot = 0} } function markerJoin(element) if getElementType( element ) == "player" then table.insert(Cplayer, element) if #Cplayer >= 2 then for k, player in ipairs(Cplayer) local data = Posiciones[k] local x, y, z, rot = data.posx, data.posy, data.posz, data.rot setElementPosition( player, x, y, z) setElementRotation( player, 0, rot, 0) tabel.remove(Cplayer, k) end end end end addEventHandler("onMarkerHit", root, markerJoin) function markerleave(element) if getElementType( element ) == "player" then for k, player in ipairs(Cplayer) if player == element then tabel.remove(Cplayer, k) end end end end addEventHandler("onMarkerLeave", root, markerleave)
  10. quieres que lo manden a distintas posiciones , pero a cada jugador mandarlo en especifico a una posición o a cualquiera de los 2 jugadores mandarlo a X posición y al otro a la otra posición ???
  11. algo así talvez te sirva Cplayer = {} function markerJoin(element) if getElementType( element ) == "player" then table.insert(Cplayer, element) if #Cplayer >= 2 then for k, player in ipairs(Cplayer) setElementPosition( player, ....) table.remove(Cplayer, k) end end end end addEventHandler("onMarkerHit", root, markerJoin) function markerleave(element) if getElementType( element ) == "player" then for k, player in ipairs(Cplayer) if player == element then table.remove(Cplayer, k) end end end end addEventHandler("onMarkerLeave", root, markerleave)
  12. function click () local playerName = guiGridListGetItemText ( playerList, guiGridListGetSelectedItem ( playerList ), 1 ) local player = getPlayerFromName(playerName) local dinero = tonumber(guiGetText(editbox)) triggerEvent ( "onSpecialEvent", getRootElement(), player, dinero ) end --- server --- addEvent ( "onSpecialEvent", true ) function givemoney ( thePlayer, amount) givePlayerMoney ( thePlayer, amount ) takePlayerMoney(client, ammount) end addEventHandler ( "onSpecialEvent", getRootElement(), givemoney )
  13. alex17

    [Fuego]

    Utiliza esto /fireme nombredeljugador rason addCommandHandler("fireme", function (thePlayer, _, name, rason) if not name then return end local player = findPlayerByName (name) local onFire = setTimer(setPedOnFire, 3000, 4, player, true) outputChatBox("* ".. getPlayerName(player) .." #0080FFesta en #FF8000fuego#0080FF! rason ("..rason..")",getRootElement(),255,255,255,true) end) function findPlayerByName (name) local player = getPlayerFromName(name) if player then return player end for i, player in ipairs(getElementsByType("player")) do if string.find(string.gsub(getPlayerName(player):lower(),"#%x%x%x%x%x%x", ""), name:lower(), 1, true) then return player end end return false end
  14. alex17

    [Fuego]

    prueba con esto debe funcionar addCommandHandler("fireme", function (thePlayer, _, name) if not name return end local player = findPlayerByName (name) local onFire = setTimer(setPedOnFire, 3000, 4, player, true) outputChatBox("* ".. getPlayerName(player) .." #0080FFesta en #FF8000fuego#0080FF!",getRootElement(),255,255,255,true) end) function findPlayerByName (name) local player = getPlayerFromName(name) if player then return player end for i, player in ipairs(getElementsByType("player")) do if string.find(string.gsub(getPlayerName(player):lower(),"#%x%x%x%x%x%x", ""), name:lower(), 1, true) then return player end end return false end
  15. tal ves sea por que en el codigo que te di te falta poner en el esta funcion function isCursorOnElement(posx, posy, ancho, alto) local x , y, w, h = screenW * posx, screenH * posy, screenW * ancho, screenH * alto local mx,my = getCursorPosition () if isCursorShowing() then else mx,my = x, y end local fullx,fully = screenW, screenH cursorx,cursory = mx*fullx,my*fully if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then return true else return false end end
  16. Esto deberia de funcionar pruebalo y me dices que tal te anda editbox = {} function getCharacter(character) if enableEdit then table.insert( editbox, character) end end function bindkey() table.remove( editbox, # editbox) end function onClick(mButton,state,ax,ay) if state == "down" then if isCursorOnElement(posx, posy, ancho, largo) then enableEdit = true else enableEdit = false end end end function dxDrawEditBox() local editText = table.concat(editbox,"") dxDrawRectangle(posx, posy, ancho, largo ....) dxDrawText(editText, posx, posy , posx + ancho, posy + largo, ......) end bindKey("backspace", "down", bindkey) addEventHandler("onClientCharacter", getRootElement(), getCharacter) addEventHandler("onClientClick",getRootElement(),onClick) addEventHandler("onClientRender", root, dxDrawEditBox)
  17. hour, minutes = getTime() if ZombieSpeed == 1 then if hour > 22 or hour < 6 then chaseanim = "Sprint_Wuzi" checkspeed = 1000 elseif hour < 22 or hour > 6 then chaseanim = "WALK_fatold" checkspeed = 2000 end end coloca eso despues de la linea 405
  18. interpolateBetween podrias usarlo mas para hacer animaciones mas compleja , para lo que vos quiere es suficiente con getTickCount
  19. es por esa parte que pusiste solo se ejecuta cuando inicias el script
  20. onClientElementDataChange onElementDataChange a lol se me paso eso buena aclaracion
  21. si es para comprobar datos que cambian constantemente la única otra forma seria con onClientRender pero seria una pesima idea por lo tanto creo que solo te queda usar timers
×
×
  • Create New...