Search the Community
Showing results for tags 'bindkey'.
-
function onInventory(source) if not isGuestAccount(getPlayerAccount(source)) then triggerClientEvent(source, "N3xT.onOpenInventory", source) else messageS(source, "Você precisa estar logado para abrir o inventário!", "error") end end function onResStart() for index, player in ipairs(getElementsByType("player")) do bindKey(player, config.bind, "down", onInventory) if not isGuestAccount(getPlayerAccount(player)) then local acc = getAccountName(getPlayerAccount(player)) loadItens(player, acc) end end end addEventHandler("onResourceStart", resourceRoot, onResStart) function onPlayerJoin() bindKey(source, config.bind, "down", onInventory) end addEventHandler("onPlayerJoin", getRootElement(), onPlayerJoin) function cleanAll() for index, player in ipairs(getElementsByType("player")) do unbindKey(player, config.bind, "down", onInventory) bindKey ( player, "F1", "down", onInventory ) end end addEventHandler("onResourceStop", resourceRoot, cleanAll)
-
Estou tentando por o addcommandhandler mas não consigo de forma nenhuma, se alguém tiver a solução para algum dos 3 scripts a baixo me avisa fznd o favor estou tentando abrir painel DX por comando ao em vez de por bindkey porem não consigo, já tentei de vários jeitos e formas porem nn vai, já pesquisei aqui no fórum, no YouTube porem nn vai function Pdx ( ) dxDrawRectangle(504, 197, 314, 397, tocolor(255, 0, 0, 100), false) dxDrawRectangle(554, 238, 218, 72, tocolor(255, 255, 255, 255), false) dxDrawRectangle(554, 347, 218, 72, tocolor(255, 255, 255, 255), false) dxDrawRectangle(554, 455, 218, 72, tocolor(255, 255, 255, 255), false) end function abrir (_,state) if painel == false then showCursor(true) addEventHandler("onClientRender", root, Pdx) painel = true else showCursor(false) removeEventHandler("onClientRender", root, Pdx) painel = false end end addCommandHandler("disappear", abrir) addCommandHandler("v", abrir) tabem tentei fazer uma versão para uma bussola: --2017 ~ Mark Gyori https://markgyori.eu/ --Contact: [email protected] local sx, sy = guiGetScreenSize() local top = 30 local font1 = dxCreateFont("font.otf", 11) local font2 = dxCreateFont("font.otf", 10) local exibir_bulssola = false local cords = { {0, "N"}, {15, 15}, {30, 30}, {45, "NE"}, {60, 60}, {75, 75}, {90, "E"}, {105, 105}, {120, 120}, {135, "SE"}, {150, 150}, {165, 165}, {170, "S"}, {195, 195}, {210, 210}, {225, "SW"}, {240, 240}, {255, 255}, {270, "W"}, {285, 285}, {300, 300}, {315, "NW"}, {330, 330}, {345, 345} } function draw ( ) local show = 15 local center = math.ceil(show / 2) - 1 local _, _, r = getElementRotation(getCamera()) local pos = math.floor(r / 15) local slotwidth = 40 local smooth = ((r - (pos * 15)) / 15) * slotwidth local left = sx / 2 - ((show + 2) * slotwidth)/2 for i=1, show do local id = i + pos - center if(id > #cords)then id = id - #cords end if(id <= 0)then id = #cords - math.abs(id) end if(cords[id])then local alpha = (tonumber(cords[id][2]) or 0 > 0) and 175 or 255 if(i < center)then alpha = alpha * (i/center) end if(i > center)then alpha = alpha * ((show-i)/center) end dxDrawRectangle(left + slotwidth * i - smooth + (slotwidth / 2 - 1) + 1, top + 10 + 1, 2, 10, tocolor(0, 0, 0, alpha * 0.5)) dxDrawRectangle(left + slotwidth * i - smooth + (slotwidth / 2 - 1), top + 10, 2, 10, tocolor(255, 255, 255, alpha)) dxDrawText(cords[id][2], left + slotwidth * i - smooth + 1, top + 20, left + slotwidth * (i+1) - smooth + 2, top + 40, tocolor(0, 0, 0, alpha * 0.5), 1, font2, "center", "center") dxDrawText(cords[id][2], left + slotwidth * i - smooth, top + 20, left + slotwidth * (i+1) - smooth, top + 40, tocolor(255, 255, 255, alpha), 1, font2, "center", "center") end end dxDrawText("➤", left + 4, top + 26 + 2, left + ((show + 3) * slotwidth) + 30, 0, tocolor(0, 0, 0, 160), 1, font1, "center", "top", false, false, false, false, false, 90) dxDrawText("➤", left, top + 26, left + ((show + 3) * slotwidth) + 30, 0, tocolor(255, 255, 255, 255), 1, font1, "center", "top", false, false, false, false, false, 90) end addCommandHandler("m1", function() if exibir_bulssola = false then addEventHandler("onClientRender", getRootElement(), draw) exibir_bulssola = true else removeEventHandler("onClientRender", getRootElement(), draw) exibir_bulssola = false end end) --->--->--->---> (inclusive tentei mudar a direção a qual ele gira não consegui se alguém souber como avisa)<---<---<---<--- e também tentei para ativar e desativar primeira pessoa na arma através de comando: function zoomarma (thePlayer) setWeaponProperty ( 30 , "poor" , "flag_aim_1st_person" , true ) setWeaponProperty ( 30 , "std" , "flag_aim_1st_person" , true ) setWeaponProperty ( 30 , "pro" , "flag_aim_1st_person" , true ) end addCommandHandeler ("m1", zoomarma ) esse addCommandHandeler não funciona de jeito nenhum
-
Hola buenas, aclaro que no entiendo mucho sobre programación, he aprendiendo poco a poco viendo tutoriales y modificando una que otra cosa que descargo. El punto es que quiero hacer que este script de TP funcione con autos, que se pueda activar tocando el Claxon del vehículo, para que pueda Tpearme con el mismo vehiculo a un punto en especifico, y así darle un uso para "TP de Garaje", intenté cambiar el BindKey por "horn" y de un interior a otro me lleva a otras cordenadas y de un exterior no se teletransporta, estaría bastante agradecido si me pudiesen ayudar. local interiors = { -- {Ext"X", Ext"Y", Ext"Z", | IDInt, IDDim | IntX, IntY, IntZ | IDInt, IDDim | "Nombre"}, {1177.90234375, -1338.9755859375, 14.912269592285, 0, 0, 447, 2520, -98, 10, 0, "LSMD"}, {1195.3037109375, -1354.92578125, 13.389284133911, 0, 0, 1198.0654296875, -1402.2587890625, 13.257797241211, 0, 0, "Prueba"}, } enterPickup = nil exitPickup = nil local bind = "Enter" local screenW, screenH = guiGetScreenSize() addEventHandler("onClientResourceStart", resourceRoot, function() for i,v in pairs (interiors) do local enterPickup = createPickup(v[1], v[2], v[3], 3, 1318, 1) setElementInterior(enterPickup, v[4]) setElementDimension(enterPickup, v[5]) local exitPickup = createPickup(v[6], v[7], v[8], 3, 1318, 1) setElementInterior(exitPickup, v[9]) setElementDimension(exitPickup, v[10]) addEventHandler("onClientRender", root, function() if (isElementWithinPickup(localPlayer, enterPickup)) and getElementInterior(localPlayer) == getElementInterior(enterPickup) and getElementDimension(localPlayer) == getElementDimension(enterPickup) then dxDrawHelp("Propiedad : "..v[11], "Presiona "..bind.." para entrar.") elseif (isElementWithinPickup(localPlayer, exitPickup)) and getElementInterior(localPlayer) == getElementInterior(exitPickup) and getElementDimension(localPlayer) == getElementDimension(exitPickup) then dxDrawHelp("Propiedad : "..v[11], "Presiona "..bind.." para salir.") end end) bindKey(bind, "down", function() if (isElementWithinPickup(localPlayer, enterPickup)) and getElementInterior(localPlayer) == getElementInterior(enterPickup) and getElementDimension(localPlayer) == getElementDimension(enterPickup) then triggerServerEvent("warpPlayer", localPlayer, localPlayer, v[6], v[7], v[8], v[9], v[10]) elseif (isElementWithinPickup(localPlayer, exitPickup)) and getElementInterior(localPlayer) == getElementInterior(exitPickup) and getElementDimension(localPlayer) == getElementDimension(exitPickup) then triggerServerEvent("warpPlayer", localPlayer, localPlayer, v[1], v[2], v[3], v[4], v[5]) end end) end end) local blips = { -- blip ekleye bilirsiniz. {810.4853515625, -1616.16015625, 13.546875, 10}, } for i,v in pairs (blips) do createBlip(v[1], v[2], v[3], v[4], 2, 255, 255, 255, 255, 0, 100) end function guiGridListGetSelectedItemText ( gridList, column ) local item = guiGridListGetSelectedItem ( gridList ) if item then return guiGridListGetItemText ( gridList, item, column or 1 ) end return false end -- function isElementWithinPickup(theElement, thePickup) if (isElement(theElement) and getElementType(thePickup) == "pickup") then local x, y, z = getElementPosition(theElement) local x2, y2, z2 = getElementPosition(thePickup) if (getDistanceBetweenPoints3D(x2, y2, z2, x, y, z) <= 1) then return true end end return false end function round(num) if ( num >= 0 ) then return math.floor( num + .5 ) else return math.ceil( num - .5 ) end end function convertNumber( number ) local formatted = number while true do formatted, k = string.gsub( formatted, "^(-?%d+)(%d%d%d)", '%1 %2' ) if ( k==0 ) then break end end return formatted end function guiComboBoxAdjustHeight ( combobox, itemcount ) if getElementType ( combobox ) ~= "gui-combobox" or type ( itemcount ) ~= "number" then error ( "Invalid arguments @ 'guiComboBoxAdjustHeight'", 2 ) end local width = guiGetSize ( combobox, false ) return guiSetSize ( combobox, width, ( itemcount * 20 ) + 20, false ) end
-
Estou tentando colocar a opção de mudar a tecla em um shared mas nao estou conseguindo
-
testdoor = createObject(1499, 1580.03149, -1631.73987, 13.38281) bindKey(source, "e", "down", function() local currentFreezeStatus = isElementFrozen ( testdoor ) if currentFreezeStatus then setElementFrozen ( testdoor, not currentFreezeStatus ) outputChatBox("You have closed the door!",255,255,255) else setElementFrozen ( testdoor, currentFreezeStatus ) outputChatBox("You have opened the door!",255,255,255) end end) its showing an error bad argument @ 'bindkey' [expected player argument 1, but nil]
-
What's wrong? scirpt: plalyer-> seat to vehicle-> pres space and draw handbrake image debugscript errors :((( code: function hand ( thePlayer ) local theVehicle = getPedOccupiedVehicle ( thePlayer ) if theVehicle then dxDrawImage(200,110,100,100,"hand.png", 255,255,255,true, theVehicle, thePlayer) end end bindKey("space","down", hand)
- 1 reply
-
- dxdrawimage
- bindkey
-
(and 3 more)
Tagged with:
-
Is there a function similar to ToogleControl but with Binds? I mean, there is such a function attached to BindKey (under the "k" key), and I would like to press the "k" function just like in ToggleControl, where we clicked eg left mouse button to shoot
-
Eu só queria saber como eu faço pra trocar essa função de comando, para uma de tecla. Ao invés de ter que digitar o comando, eu queria que apenas pressionasse "F"
-
Tenho 2 scripts, um de animação por binds e outro de assaltos, queria saber como faço para não cancelar a animação do roubo e fazer o jogador continuar fazendo o roubo, para ele não sair do freeze do roubo e pegar o dinheiro fora do local já, tentei com flags e getElementData e nada. Animação function animcruzabraco () if getElementData ( localPlayer, "cruzabracodt" ) == false then setElementData(localPlayer, "cruzabracodt", true) setElementFrozen ( localPlayer, true ) triggerServerEvent("animcruzabraco",localPlayer) else setElementFrozen ( localPlayer, false ) setElementData(localPlayer, "cruzabracodt", false) triggerServerEvent("paraanim",localPlayer) end end bindKey("b", "both", animcruzabraco) Roubo function sistema1(source) if source then if isElementWithinMarker(source, loja1) then local weaponType = getPedWeapon ( source ) if weaponType == 0 then outputChatBox ( "#727272Você está desarmado. #464646Tenha uma arma para assaltar.", source, 255, 255, 255, true ) else outputChatBox(" ", source, 255, 255, 255, true) outputChatBox("#cf3f3fINDFO: #e2e2e2Você está começando a roubar o banco Caixa #727272(Aguarde 4 minutos ou será punido). #e41c1cAs autoridades estão vindo.", source, 255, 255, 255, true) outputChatBox(" ", source, 255, 255, 255, true) setElementVisibleTo( loja1ass, root, true) setElementFrozen( source, true ) setPedAnimation( source, "bomber", "bom_plant_loop", 240000, true, false, false, false ) setMarkerSize(loja1, 0) outputChatBox(" ", source, 255, 255, 255, true) outputChatBox("#cf3f3fINFO: #e41c1cAtenção todas as autoridades. #e2e2e2O banco Caixa está sendo assaltado, compareçam ao local urgentemente!", root, 255, 255, 255, true) outputChatBox(" ", source, 255, 255, 255, true) setTimer(function(source) givePlayerMoney(source, GranaBanco) setElementFrozen( source, false ) setPlayerWantedLevel( source, 6 ) outputChatBox("#cf3f3fINFO: #e41c1cVocê assaltou o banco Caixa e ganhou R$ "..GranaBanco, source, 255, 255, 255, true) end,240000,1,source) setTimer(function(source) setMarkerSize(loja1, 2.5) setElementVisibleTo( loja1ass, root, false) end,1800000,1,source) end end end end addCommandHandler("roubar", sistema1)
-
PL: Nie mogę używać wiążącego klucza na literę k aby silnik sie wyłączał. PL: Nie moge ustawić klawisza powiązania , ABY mozna bylo wykonać dziesięć Skrypt Za Pomocą funkcji „K” turnEngine (odtwarzacz) Lokalny Samochód = getPedOccupiedVehicle (odtwarzacz) if (Samochód i getVehicleController (Samochód) == gracz), A następnie ustawVehicleEngineState (Samochód, (not getVehicleEngineState (car))) if (getVehicleEngineState (car)) następnie outputChatBox („Silnik: Twój silnik wyposażony wyposażony.”, player, 0, 255, 0) else outputChatBox („Silnik: Twój silnik dostępny wyłączony.” , 255, 0, 0) koniec koniec koniec addCommandHandler („k”,
-
Estava fazendo um sistema que em uma parte dele seria preciso utilizar uma bind dentro de um marker para criar um veiculo. Fiz tudo certo, porém, fiz no client-side e acabei sabendo que veículos criados no client-side serviriam apenas para "enfeite", tentei então aprender a como fazer bind no server-side, li na wiki do mta e vi videos relacionados a ela, mas não consegui fazer da maneira correta. Ainda estou confuso com a função bindKey, então se tiver alguém que possa me explicar um pouco dela ou pelo menos me ajudar dizendo o que esta de errado no código, ficarei grato. local g1 = createMarker (1517.796, -694.59, 92.00, "cylinder", 3.0, 184,0,0, 150) function buffalo () bindKey (source, "e", "down", function(thePlayer, player) if isElementWithinMarker(thePlayer, g1) then createVehicle(551, 1517.6644287109,-689.70690917969,94.75) end end) end addEventHandler ("onPlayerLogin", getRootElement(), buffalo)
-
Estou fazendo um sistema que ao passar pelo marker e apertar "e", spawnaria um veiculo, porem esta spawnando 2 veiculos (quando aperta e quando solta a tecla), mas queria que spawnasse apenas quando apertasse. O código esta assim: local g1 = createMarker (1517.796, -694.59, 92.00, "cylinder", 3.0, 184,0,0, 150) addEventHandler ("onClientMarkerHit", g1, function() addEventHandler ("onClientKey", root, function (button, press) if isElementWithinMarker (localPlayer, g1) then if button == "e" then createVehicle ( 402, 1517.172, -690.4, 94.75, 0, 0, 100) end end end ) end )
-
Client.lua: function processLockUnlock(vehicle) if vehicle then local vehicleID = tonumber(getElementData(vehicle, "veh:id")) or -1 local vehFaction = tonumber(getElementData(vehicle, "veh:faction")) or 0 local vehOwner = tonumber(getElementData(vehicle, "veh:owner")) or -1 local vehJobID = tonumber(getElementData(vehicle, "veh:jobvehID")) or -1 local locked = isVehicleLocked(vehicle) local vehID = getElementModel(vehicle) local vehName = getVehicleRealName(vehID) if isPedInVehicle(localPlayer) then playSounds("lockin") else playSounds("lockout") end if locked then triggerServerEvent("vehicleLock", localPlayer,localPlayer, vehicle, false) else triggerServerEvent("vehicleLock", localPlayer,localPlayer, vehicle, true) end else outputChatBox("#FFFFFF Nincs kulcsod ehhez a járműhöz.", 169,139,101, true) end end local klikkTimer = false function setVehicleLockState() if klikkTimer then return end if isTimer(klikkTimerRun) then return end klikkTimer = true klikkTimerRun = setTimer(function() klikkTimer = false end,1000,1) local vehicle = getPedOccupiedVehicle ( localPlayer ) if vehicle then processLockUnlock(vehicle) else local int2 = getElementInterior(localPlayer) local dim2 = getElementDimension(localPlayer) local mx,my,mz = getElementPosition(localPlayer) local interior = getElementData(localPlayer, "interior") or false if not interior then for k,v in ipairs(getElementsByType("vehicle")) do local x,y,z = getElementPosition(v) local int = getElementInterior(v) local dim = getElementDimension(v) local dist = getDistanceBetweenPoints3D(x,y,z,mx,my,mz) if dist <= 3 and int2 == int and dim2 == dim then processLockUnlock(v) return end end end end end bindKey("k", "down", setVehicleLockState) setTimer(function() if not bindKey("k", "down", setVehicleLockState) then bindKey("k", "down", setVehicleLockState) end end, 1000, 0) Server.lua: addEvent("vehicleLock",true) addEventHandler("vehicleLock",getRootElement(),function(player,veh,value) setVehicleLocked(veh, value) veh:setData("veh:status", value) end) No errors / warnings in debugscript... if i press the [K] button, nothing happens... what wrong in this code? how to fix?
-
como eu ativo meu teamsay para as team? por que quando eu entro na team e digito cai no chat say não no teamsay.
-
- privcomando
- bindkey
-
(and 1 more)
Tagged with:
-
Gente como eu privaria isso para 1 grupo só? addCommandHandler("fogo", function(lp) local x,y,z=getElementPosition(lp) local Rocket=createObject(3790,x,y,z-1.5,0,90,0) setTimer(function() moveObject(Rocket,500, x+math.random(0,5), y+math.random(0,5), z+math.random(20,50), 0, 0, math.random(0,200)) triggerClientEvent(root, "startSilvesterRocket", root, x, y, z) setTimer(function() local xr,yr,zr=getElementPosition(Rocket) createExplosion(xr,yr,zr,9,lp) createExplosion(xr,yr,zr,4,lp) destroyElement(Rocket) end,500,1) end,2000,1) end) MaxRocketPack = 3 RocketPack = 0
-
function rights () outputChatBox("", getRootElement(), 0, 255, 0, false) end addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),rights) function permission (source) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Staff")) or isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Moderator")) then triggerClientEvent(source, "openAdmin", getRootElement()) end end addCommandHandler("mod", permission) function info (player) info = {} local user = getPlayerFromName(player) if not isGuestAccount(getPlayerAccount(user)) then local username = getAccountName(getPlayerAccount(user)) local team = getTeamName(getPlayerTeam(user)) local wanted = getPlayerWantedLevel(user) local ip = getPlayerIP(user) local serial = getPlayerSerial(user) local money = getPlayerMoney(user) local veh = getVehicleName(getPedOccupiedVehicle(user)) triggerClientEvent(source, "sendInformationClient",root,username,team,wanted,ip,serial,money,veh) end end addEvent("sendInfoServer", true) addEventHandler("sendInfoServer", getRootElement(), info) function mute (client) player = getPlayerFromName(client) if isPlayerMuted(player) == false then setPlayerMuted(player, true) outputChatBox(getPlayerName(player).." has been muted by "..getPlayerName(source), getRootElement(), 255, 0, 0, false) elseif isPlayerMuted(player) == true then setPlayerMuted(player, false) outputChatBox(getPlayerName(player).." has been unmuted by "..getPlayerName(source), getRootElement(), 0, 255, 0, false) end end addEvent("mutePlayer", true) addEventHandler("mutePlayer", getRootElement(), mute) function freeze (client) player = getPlayerFromName(client) if isPedFrozen(player) == false then setElementFrozen(player, true) outputChatBox(getPlayerName(player).." has been frozen by "..getPlayerName(source), getRootElement(), 255, 0, 0, false) elseif isPedFrozen(player) == true then setElementFrozen(player, false) outputChatBox(getPlayerName(player).." has been unfrozen by "..getPlayerName(source), getRootElement(), 0, 255, 0, false) end end addEvent("freezePlayer", true) addEventHandler("freezePlayer", getRootElement(), freeze) function warpto (thePlayer) local player = getPlayerFromName(thePlayer) local x,y,z = getElementPosition(player) if isPedInVehicle(source) == true then removePedFromVehicle(source,getPedOccupiedVehicle(source)) setElementPosition(source, x, y+1, z+1) outputChatBox("You have warped to "..getPlayerName(player), source, 0, 255, 0, false) elseif isPedInVehicle(source) == false then setElementPosition(source, x, y+1, z+1) outputChatBox("You have warped to "..getPlayerName(player), source, 0, 255, 0, false) end end addEvent("warptoPlayer", true) addEventHandler("warptoPlayer", getRootElement(), warpto) function warphere (thePlayer) local player = getPlayerFromName(thePlayer) local x,y,z = getElementPosition(source) if isPedInVehicle(player) == true then removePedFromVehicle(player,getPedOccupiedVehicle(player)) setElementPosition(player, x, y+1, z+1) outputChatBox("You have been warped to "..getPlayerName(source), player, 0, 255, 0, false) elseif isPedInVehicle(player) == false then setElementPosition(player, x, y+1, z+1) outputChatBox("You have been warped to "..getPlayerName(source), player, 0, 255, 0, false) end end addEvent("warpPlayerhere", true) addEventHandler("warpPlayerhere", getRootElement(), warphere) function killgay (gay) setElementHealth(getPlayerFromName(gay),0) end addEvent("kill:O", true) addEventHandler("kill:O", getRootElement(), killgay) function wantedlvl (client, amount) player = getPlayerFromName(client) setPlayerWantedLevel(player, amount) outputChatBox(getPlayerName(player).."'s wanted level has been changed to "..amount.." by "..getPlayerName(source), getRootElement(), 255, 0, 0, false) end addEvent("setPlayerwanted", true) addEventHandler("setPlayerwanted", getRootElement(), wantedlvl) function kickgay (client, respon, reason) player = getPlayerFromName(client) kickPlayer(player, respon, reason) outputChatBox(getPlayerName(player).." has been kicked by "..getPlayerName(respon), getRootElement()) end addEvent("kickPlayeraway", true) addEventHandler("kickPlayeraway", getRootElement(), kickgay) function setskin (client, ID) player = getPlayerFromName(client) setElementModel(player, ID) outputChatBox("Your skin has been changed to "..ID.." by "..getPlayerName(source), player, 255, 255, 0, false) end addEvent("setPlayerskin", true) addEventHandler("setPlayerskin", getRootElement(), setskin) function setHP (client, amount) player = getPlayerFromName(client) setElementHealth(player, amount) outputChatBox("Your health has been changed to "..amount.." by "..getPlayerName(source), player, 0, 255, 255, false) end addEvent("setPlayerhealth", true) addEventHandler("setPlayerhealth", getRootElement(), setHP) function setArmor (client, amount) player = getPlayerFromName(client) setPedArmor(player, amount) outputChatBox("Your armor has been changed to "..amount.." by "..getPlayerName(source), player, 0, 255, 255, false) end addEvent("setPlayerarmor", true) addEventHandler("setPlayerarmor", getRootElement(), setArmor) function announce (text) outputChatBox("*ADMIN* "..text, getRootElement(), 255, 0, 0, false) end addEvent("adminAnnounce", true) addEventHandler("adminAnnounce", getRootElement(), announce) function destroycar (client) player = getPlayerFromName(client) car = getPedOccupiedVehicle(player) if isPedInVehicle(player) then destroyElement(car) outputChatBox("Your car has been destroyed by "..getPlayerName(source), player, 255, 0, 0, false) outputChatBox("You have destroyed "..getPlayerName(player).."'s car", source, 255, 0, 0, false) else outputChatBox(getPlayerName(player).." isn't in a vehicle", source, 255, 0, 0, false) end end addEvent("destroyveh", true) addEventHandler("destroyveh", getRootElement(), destroycar) function fixcar (client) player = getPlayerFromName(client) car = getPedOccupiedVehicle(player) if isPedInVehicle(player) then fixVehicle(car) outputChatBox("Your car has been fixed by "..getPlayerName(source), player, 255, 0, 0, false) outputChatBox("You have fixed "..getPlayerName(player).."'s car", source, 255, 0, 0, false) else outputChatBox(getPlayerName(player).." isn't in a vehicle", source, 255, 0, 0, false) end end addEvent("fixveh", true) addEventHandler("fixveh", getRootElement(), fixcar) hello good before all this script is mine only to edit it to make it panel moderator l have a problem that only to open the panel is addCommandHandler and I have done many BindKey functions and then I would like someone to help me make the bindKey and be able to Positioning to the "Server.Lua" what I just put there is all the Server.Lua and want to position the bindkey somewhere but that is on the Server.Lua Help Please I do.
-
I have been trying to bindkeys to a command clientside and save them inside a xml file. But the mta binding cache is stacking up. Keys: 'x', 'u', 'x' See screenshot bellow. The problem shows up when you edit the bindkey in the settings menu and load the xml file after saving it. To use the bindkeys, you have to bind it with any key on your keyboard. To know which bindkeys are bound to a command with your previous visit, you have to bind any key of your keyboard to that command in order to use: getBoundKeys / getKeyBoundToCommand If you use unbindKey, it will unbind the command for all other keys, but not remove it from the cache. And another problem, I can't remove keys/'alternative keys' from the cache unless I click on the 'Load defaults button on the right bottom'. This is the code I have been testing with:
-
Greetings, i am making a new script to chatBox, but i have some problem making a script to binds with my new chatBox. The user when want make the bind (example: /bind 4 drawLineInScreen colorR colorG colorB) i take the string drawLineInScreen, but when i want make te bind using bindKey, there are 2 options. option 1 bool bindKey ( player thePlayer, string key, string keyState, function handlerFunction, [ var arguments, ... ] ) option 2 bool bindKey ( player thePlayer, string key, string keyState, string commandName, [ string arguments ] ) In option 1 i can add 1 or more arguments, in option 2 i can add 1 only argument. The data than i have is the commandName, I need the function to my commandName and i can use very arguments with the option 1. PLS HELP ME.
- 2 replies
-
- addcommandhandler
- bindkey
-
(and 1 more)
Tagged with:
-
Hey I need some help, regarding "bindKey" so what I basicly want to do is check if the player is pressing down a button, and when he does, I want to return a boolean value. function keyInput(player, key, keyState) if(keyState == "down") then end outputChatBox("Pressing: " .. key) end function bindKeysWhenPlayerJoin() bindKey(source, "lalt", "down", keyInput) end addEventHandler("onPlayerJoin", getRootElement(), bindKeysWhenPlayerJoin) So basicly I have the basics down, when the player joins the server the keys will bind, and when I press "lalt" then it gets printed out to the player's chat box. The issue here is though, that I can't use this, for like anything, since I cannot return a value that I can later use. Let me give an example. Psuedo code: I want to check if - The player is colliding with a static pickup - The player is pressing lalt then print a message Code: function playerPickupCollision(pickup, dimension) -- Jobs for i = 1, #pickupInformation do if(pickup == pickupInformation[i][PICKUP_ID]) then outputChatBox(i, source) if(pickupInformation[i][TYPE] == "Job" && pressing_key("lalt")) then outputChatBox("Press LALT to become a " .. pickupInformation[i][DESCRIPTION], source) end if(pickupInformation[i][TYPE] == "Property" && pressing_key("lalt")) then outputChatBox("This is the " .. pickupInformation[i][DESCRIPTION], source) end end end end addEventHandler("onPlayerPickupHit", getRootElement(), playerPickupCollision) (pressing_key isn't an actual function. it's the kind of function I want to create) Thank you!
-
análisis de la función () Ventana = guiCreateWindow (207, 164, 442, 357, "Panel De Mods Beta | Servidor", false) guiWindowSetSizable (Ventana, falsa) guiSetVisible (Ventana, falsa) ShowCursor (falso) armaon = guiCreateButton (9, 69, 39, 19, "On", falsa, ventana) guiSetProperty (armaon, "NormalTextColour", "FFAAAAAA") armaoff = guiCreateButton (58, 69, 39, 19, "Off", falsa, Ventana) guiSetProperty (armaoff, "NormalTextColour", "FFAAAAAA") labe = guiCreateLabel (31, 44, 43, 15, "Armas:", falsa, ventana) guiSetFont (Labe, "default-negrita-pequeño") AUTOON = guiCreateButton (127, 69, 39, 19, "On", falsa, ventana) guiSetProperty (AUTOON, "NormalTextColour", "FFAAAAAA") autoof = guiCreateButton (176, 69, 39, 19, "Off", falsa, ventana) guiSetProperty (autoof, "NormalTextColour", "FFAAAAAA") de la nariz = guiCreateLabel (141, 44, 64, 15, "Vehiculos:", falsa, ventana) guiSetFont (nariz, "default-negrita-pequeño") Mucho = guiCreateLabel (274, 44, 34, 15, "Skins:", falsa, ventana) guiSetFont (mucho, "default-negrita-pequeño") skinon = guiCreateButton (245, 69, 39, 19, "On", falsa, ventana) guiSetProperty (skinon "NormalTextColour", "FFAAAAAA") skinoff = guiCreateButton (294, 69, 39, 19, "Off", falsa, ventana) guiSetProperty (skinoff, "NormalTextColour", "FFAAAAAA") Hudon = guiCreateButton (344, 69, 39 19, "On", falsa, ventana) guiSetProperty (Hudon, "NormalTextColour", "FFAAAAAA") hudoff = guiCreateButton (393, 69, 38, 19, "Off", falsa, ventana) guiSetProperty (hudoff, "NormalTextColour" "FFAAAAAA") HUD = guiCreateLabel (373, 44, 23, 15, "Hud", falsa, ventana) busque = guiCreateLabel (8, 126, 266, 15, "* Bienvenidos al Servidor .", falsa, ventana) guiSetFont (Bien, "default-negrita-pequeño") guiLabelSetColor (BIEN, 37, 142, 249) masss = guiCreateLabel (8, 201, 423, 15, "* Estós hijo Los Siguientes Mods Que PUEDES Desactivar para Ganar mas fps.", falso, ventana) guiSetFont (masss, "default-negrita-pequeño") guiLabelSetColor (masss, 37, 142, 249) Raios = guiCreateLabel (8, 176, 346, 15, "* Para Desactivar ALGÚN mod Debes apretar haga clic en Off / On "., falsa, ventana) guiSetFont (Raios," por defecto-bold-pequeño ") guiLabelSetColor (Raios, 37, 142, 249) raioss = guiCreateLabel (8, 151, 423, 15," * Selecciona Los mods Que quieras Desactivar Y viceversa, ganas mas fps ", falsa, ventana). guiSetFont (raioss," default-negrita-pequeño ") guiLabelSetColor (raioss, 37, 142, 249) REE = guiCreateLabel (8, 226, 423, 15," - Vehiculos (Pronto Mejora un uno Desactivar uno por) ", falsa, ventana) guiSetFont (ree," default-negrita-pequeño ") guiLabelSetColor (REE, 37, 142, 249) reeb = guiCreateLabel (8, 251, 302, 15," - Pieles (. Pronto Mejora Para Desactivar Uno por Uno) ", falsa, ventana) guiSetFont (Reeb," default-negrita-pequeño ") guiLabelSetColor (Reeb, 37, 142, 249) ifo = guiCreateLabel (8, 276, 37, 15, "-. Hud", falsa, ventana) guiSetFont (ifo, "default-negrita pequeña") guiLabelSetColor (ifo, 37, 142, 249) iforr = guiCreateLabel (8, 301, 54, 15, "- Armas. ", falsa, ventana) guiSetFont (iforr," ") default-negrita-pequeña guiLabelSetColor (iforr, 37, 142, 249) ncluso = guiCreateLabel (8, 326, 423, 15," * es Una versión beta 1.0, insecto CUALQUIER Contactarse con Algún personal. ", falsa, ventana) guiSetFont (ven," default-negrita-pequeño ") guiLabelSetColor (ven, 37, 142, 249) final AddEventHandler (" onClientResourceStart ", getRootElement (), el panel) la función de abrir () si guiGetVisible (ventana) == true entonces guiSetVisible (Ventana, falsa) ShowCursor (falso) lo demás guiSetVisible (Ventana, true) ShowCursor (verdadero) extremo final bindKey ( "F2", "abajo", para abrir) - Funciones ------
-
Una pregunta un poca tonta, pero en fin. Mi problema es éste: function key() setElementPosition(theObject, x+1,y,z) end for i,v in ipairs(getElementsByType("player")) do bindKey(v,"w","down",key) end El objeto se mueve hacia adelante, pero solo una vez, o sea, preciono 'w' una vez y se mueve, pero si preciono la tecla de nuevo no pasa nada, no sé si es porque estoy haciendo un for para sacar al jugador, pero si pongo ' source ' me da error.