Search the Community
Showing results for tags 'function'.
-
hi guys i want call marker from another function like this code local hidemark = createMarker(10,50,5,"cylinder",1,0,255,0) function mark(theplayer) markerveh =createMarker(0,0,5,"cylinder",1,0,255,0) end addEventHandler("onMarkerHit",marker1,mark) function job1(theplayer) setElementVisibleTo(markerveh,root,false)-- for here end addCommandHandler("hidemark",job1)
-
-
Hey everyone, I'm looking for a modeler and I'm willing to compensate for the service. I'm looking to have certain things done/modified on the Raindance such as: Adding seats into the interior Retexturing Making the sliding doors functional Feel free to pm me here, the sooner you reach out the better. Yours, Vseven
-
bom dia, Pessoal o devo fazer para dar refresh em uma col dentro de outra col. EX: Criei uma ColShope em um lugar e dentro dela eu vou montar um objeto que vai criar a colShope, porem como foi criada essa colShope ela nao da refresh e queria saber o que devo fazer. Obrigado
-
Bom dia, Preciso de uma ajuda, eu uso uma função em modo client para quando o player puxa o cabo o PACKT LOSS nao deixa ele transferir, porem mesmo assim os jogadores estão conseguindo burlar. Alguem sabe me dizer como eu posso corrigir? Qual função eu devo usar? Função: if getNetworkStats()["packetlossLastSecond"] > 1 then -- Client elseif source == EnviarButon then local itemName = guiGridListGetItemText(TranssWin,guiGridListGetSelectedItem(TranssWin),1) local row_ = guiGridListGetSelectedItem(TranssWin) local grilistSex = guiGridListGetItemData(TranssWin, row_, players2) local getMoneyToSend = guiGetText(PlayerTavb) if itemName ~= "" and getMoneyToSend ~= "" and grilistSex ~= "" then if getNetworkStats()["packetlossLastSecond"] > 1 then startRollMessage2("Inventory", "Conexão Ruim!",255,22,0) return else triggerServerEvent("MWEnviarMWC",getLocalPlayer(),itemName,grilistSex,getMoneyToSend) end guiSetVisible(TransferirWin,false) end end
-
boa tarde, queria saber como faço para adicionar 2 botao para executar uma função Ex: alt + c = abre um painel
-
Is there a way to check for collisions where the player is looking without aiming the gun as if the getWorldFromScreenPosition and GetPedTargetCollision functions were combined?
-
Olá pessoal do fórum, queria fazer um sistema de que quando eu clicasse no meu personagem iniciava uma função exp: abrir um painel cegui - realmente não sei por onde começar, também não quero o script pronto quero aprender e fazer do 0, quem poder me ajudar por favor agradeço desde já.
-
So the problem is that there is a function called "animate" https://wiki.multitheftauto.com/wiki/Animate and with this function we can animate the GUI etc ... but there is one problem, because I would like to stop this function at some point and stop animating at some point, there is a way to do that ?
-
I started scripting with GUI / dxDraw and would like to do some panning or alpha animation. And the question is how this animate works, I know it is shown on the MTA wiki, but I don't quite understand how, If someone would explain it to me, I would be grateful. By the way, I am sending the function I am talking about ... https://wiki.multitheftauto.com/wiki/Animate
-
Hello dear community. I'm doing a Error Tooltip Resource, I created an Error Client File for all the Errors from my Main Register Resource, and I tried to call that resource by Functions on the same resource, How can I call a Function from the same resource and get The Object File that I want?... This is my code - Error File (InitTooltipMessage.lua) ---•---•---•---•---•---•---•---•---•---•---•---•---•---•---•---•---•---•---•---•---•--- ---| |--- ---| Script by "Kyonax - Pilar Perfeccionista" Synchronous member |--- ---| Github: https://github.com/Kyonax • G-Mail: [email protected] |--- ---| Code Script from Montgomery Country RP |--- ---| Resource-Script: [init] |--- ---| Name-Script: [InitTooltipMessage] |--- ---| Function-Script: Save all the posible Script Errors |--- ---| |--- ---| DEV-DATE: 31/08/2020 |--- ---| Server Script |--- ---| number: 001 |--- ---| MIT License |--- ---| |--- ---•---•---•---•---•---•---•---•---•---•---•---•---•---•---•---•---•---•---•---•---•--- local tooltip = { error = { notDataDigit = { name = 'notDataDigit', syntax = 'NULL LABEL', message = 'El campo actual debe ser completado', description = 'El campo en donde te encuentras, es un campo de entrada, es decir necesitas ingresar información para poder continuar.', type = 'ERROR', number = '1' }, notFoundAccount={ name = 'notFoundAccount', syntax = 'NULL QUERY LOGIN', message = 'No se ha podido encontrar la cuenta en la Base de Datos.', description='Se ha recibido valor NULL al realizar la búsqueda Query del Usuario en la Base de Datos, es decir que el valor Buscado no existe en la Base de Datos.', type = 'ERROR', number = '2' }, notEqual = { name = 'notEqual', syntax = 'NOT EQUAL LABEL', message = 'Los datos ingresados no son iguales.', description = 'Se ha obtenido un ERROR de similitud a la hora de comparar dos valores que deben ser exactamente iguales.', type = 'ERROR', number = '3' } incorrectInformation ={ name = 'incorrectInformation', syntax = 'NOT EQUAL QUERY', message = 'La información ingresada es incorrecta.', description = 'La comparación de el dato obtenido de la Base de Datos y el Ingresado ha devuelto un ERROR de similitud, es decir los datos ingresados no son iguales a los registrados en la base de datos.', type = 'ERROR', number = '4' }, notFoundVariables = { name = 'notFoundVariables', syntax = 'NULL INFORMATION', message = 'Las variables esenciales tienen como valor NULL.', description = 'Variables necesarias para le ejecución del código son de valor NULL, lo que indica que los valores no han sido digitadas o que han sido corrompidos.', type = 'ERROR', number = '5' }, existAccount = { name = 'existAccount', syntax = 'MULTIPLE VALUES QUERY', message = 'El usuario digitado no se encuentra disponible.', description = 'El nombre de usuario para crear la cuenta ya se encuentra registrado en la Base de Datos, lo que causa un error de multiples valores registrados.', type = 'ERROR', number = '6' }, existDiscordID = { name = 'existDiscordID', syntax = 'MULTIPLE VALUES QUERY', message = 'La ID de Discord digitada ya se encuentra en uso.', description = 'La ID de Discord se encontró en la base de datos, lo que quiere decir que otra cuenta está registrada con esta ID.', type = 'ERROR', number = '7' }, notValidPassword = { name = 'notValidPassword', syntax = 'LOW SECURITY ACCOUNT', message = 'La contraseña no es segura', description = 'Existen algunos requerimientos para acceder al Servidor, uno de ellos es tener una contraseña de más de 6 carácteres.', type = 'ERROR', number = '8' } } } local function getError(name) return tooltip.error[name] end local function getTooltip(name) return tooltip.error[name].syntax...' '...tooltip.error[name].message...' '...' ['...tooltip.error[name].type...' #' ...tooltip.error[name].number...']' end and I tried to call the getTooltip Function from another File called - RegisterBackend.lua - It's a Server Lua File local test = exports['[init]']:getTooltip('notFoundAccount').message local test2 = exports['[init]']:getError('notFoundAccount').type Both Files are on the same Resource call [Init] And this is my Meta.xml Code <!--ERROR--> <file src="src/error/InitTooltipMessage.lua" type='client'></file> <!--Exported Functions--> <export function='getError' type='client'></export> <export function='getTooltip' type='client'></export> The error that I get when I run the Code is this What I need to do? to call correctly Plss I'm Stuck in this
-
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
-
Alguém consegue me responder pq a function finish n é chamada? function markerb1() if CurrentMarker >= 2 then destroyElement(marker) destroyElement(blip) end if CurrentMarker == 2 then --42 = ultima outputChatBox("Você terminou, entre na auto-escola para ver sua avaliação.", getRootElement(), 0, 255, 0) health = getElementHealth(car) fnh = createMarker(-2026.83, -114.85, 1034, "cylinder", 1.0, _,_,_,_, getRootElement()) setElementInterior(fnh, 3) destroyElement(car) addEventHandler("onMarkerHit", fnh, finish) else marker = createMarker(markersb[CurrentMarker][1], markersb[CurrentMarker][2], markersb[CurrentMarker][3], "checkpoint", 5.0, 255, 0, 0, 90, getRootElement()) blip = createBlipAttachedTo(marker, _, _, _, _, _, _, _, _, getRootElement()) CurrentMarker = CurrentMarker + 1 end end function finish(hitElement, matchingDimension) if health >= 900 then outputChatBox("Você aprovado, agora você possui habilitação tipo B.", getRootElement(), 0, 255, 0) account = getPlayerAccount(hitElement) setAccountData(account, "habilitacao.tipob", true) else outputChatBox("Você foi reprovado, tente novamente.", getRootElement(), 255, 0, 0) end started = false end Ele chega a me mostrar a mensagem de que terminou, e cria a marker dentro da auto-escola, mas qnd eu passo nela, nada acontece, já troquei o onMarkerHit pelo onPlayerMarkerHit, mas anyway, não funcionou
-
I made this: -- All other functions and GUI creation. -- [...] -- Created button called "fbumper". local function setFBumper() local theVeh7 = getPedOccupiedVehicle(localPlayer) if theVeh7 then setVehicleComponentVisible(theVeh7, "bump_front_dummy", false) end end addEventHandler("onClientGUIClick", fbumper, setFBumper, false) -- Everything else... It works. Then I wanted to have the button switch between true to false when clicked. Something like: local function setFBumper() local theVeh7 = getPedOccupiedVehicle(localPlayer) if theVeh7 then setVehicleComponentVisible(theVeh7, "bump_front_dummy", false) elseif getVehicleComponentVisible(theVeh7) == "false" then setVehicleComponentVisible(theVeh7, "bump_front_dummy", true) end end addEventHandler("onClientGUIClick", fbumper, setFBumper, false) guiSetVisible (vehmod, false) It doesn't work correctly. It sets it invisible, but it doesn't return the state to visible. I also thought about using the setVehicleComponentVisible (not setVehicleComponentVisible) to make it a little bit more compact. I'm using a setEngineState script to help myself, but I don't know how to use it with these arguments. DB 3 throws nothing. What am I doing wrong?
-
I decided to dive into the world of rotations. I know this might be incomplete and even incorrect: function openCapo() local theVeh = getPedOccupiedVehicle(localPlayer) local value1 = guiScrollBarGetScrollPosition(caposcroll) if theVeh and value1 then setVehicleComponentRotation (theVeh, bonnet_dummy, value1, rY, rZ) end end I've a GUI already created, and the visibility key bound. The first scrollbar (caposcroll) should affect the bonnet_dummy. This was made with absolute basic thinking process: "if I want doors to open, I need to get the position of the scrollbar". However, I know I still need to tell the game what's the math.min, what's the math.max, and, I think, to also give the order to respond only when the scrollbar is moved. I would appreciate a finger to point me in the right direction.
-
I have this: -- 2 points on each city. local spawnCoords = { {1125, -2036, 69.89, -90}, {2504, -1686, 13.55, 45}, {-1972, 643, 46.57, -45}, {-2720, -317, 7.85, 45}, {2023, 1008, 10.83, -90}, {1298, 2084, 12.83, -90}, } -- all skins. local validSkins = {0, 1, 2, 7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 66, 67, 68, 69, 70, 71, 72, 73, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312} function spawnPoints (player) local x,y,z,r = unpack(spawnCoords[math.random(1,#spawnCoords)]) spawnPlayer(source, x, y, z, r, validSkins[math.random(1,#validSkins)]) fadeCamera(source, true) setCameraTarget(source, source) end addEventHandler("onPlayerJoin", getRootElement(), spawnPoints) Althought it works, after giving it several tests, I realized the spawn locations where always in the same order, as well as the skins. Coincidentally, I've reached the tables subject in the MTA's tutorial, and I learned about <for key, value in pairs(table) do>. Contrary to "ipairs", "pairs" is supposed to give you a random reading throughout the table everytime the script is ran. I used 'broph.Lua' as a way to understand the process, and to make sure that if I do the same, it'll work. My small knowledge told me that, by adding <for key, value in pairs(spawnCoords) do> right after the beginning of the function, I would get the random effect of the table reading. However, the result is far from what I expected: it destroys the function, and the player doesn't spawn at all (black screen). I'm continuing the tutorial, but 'in pairs' is the last thing NanoBob mentions about the tables. This time, I'd like a bit of a challenge, so if you could give me the hints and point me in the right direction, I would appreciate that.
-
Sooo, how can I use (I think for you well known) dxDrawTextOnElement() (client-side function, MTA Wiki site: [click]) in server-side scripts? I tried to export, plus this code: addEventHandler("onPlayerChat", resourceRoot, function(message, type_) if(type_ == 0) then call(resourceRoot, "dxDrawTextOnElement", source, message, 1, 20, 255, 255, 255, 255, 1, "default-bold") end end) (export in meta.xml for proof): <meta> <info author="VaporZ" name="VaporZ's utility [PL]" description="(desc)" type="script" version="1.0.1"/> <script src="cars.Lua" type="server"/> <script src="bank.Lua" type="server"/> <script src="utility.Lua" type="server"/> <script src="utility-c.Lua" type="client"/> <script src="testy.Lua" type="server"/> <file src="bank/accounts.xml"/> <file src="bank/atms.xml"/> <file src="cars/saved.xml"/> <file src="cars/shops.xml"/> <export function="dxDrawTextOnElement" type="client"/> </meta> But this don't work. Any ideas? Okay, I got further, but still it's not good. Look at this one (console error): ERROR: systems\utility.Lua:108: call: failed to call 'systems:dxDrawTextOnElement'
- 2 replies
-
- dxdrawtext
- dxdrawtextonelement
-
(and 7 more)
Tagged with:
-
Today, I've made a event, for checking if player have mooved. At first, after success of detecting players' moovement, it was displaying a message for player, who have mooved.Then, I tried to trigger the event, and the problems started. Any idea? Code's here: ----------------------------------------- ---------------VaporZ (c)---------------- ----------------------------------------- toggleOnPlayerMove = true addEventHandler("onResourceStart", root, function() if(toggleOnPlayerMove == true) then addEvent("onPlayerMove", true) setTimer( function() for _, player in ipairs(getElementsByType("player")) do local x, y, z = getElementPosition(player) setTimer( function() local x_, y_, z_ = getElementPosition(player) if(x ~= x_) and (y ~= y_) and (z ~= z_) then triggerEvent("onPlayerMove", root, player) end end, 1, 1) end end, 1, 0) end end) function dispMsg(player) outputChatBox("You've mooved!", player, math.random(1, 255), math.random(1, 255), math.random(1, 255), true) end addEventHandler("onPlayerMove", root, dispMsg) It is just giving me no errors and no message. Idk wut is wrong.
- 3 replies
-
- custom
- custom event
-
(and 2 more)
Tagged with:
-
This function is for creating idle animations, on player's afk/idle. Aaand, u need to probably put this one in "onResourceStart" event, remember, to make it work. Here it comes: setTimer( function() for _, player in ipairs(getElementsByType("player")) do if(getPlayerIdleTime(player) > 10000) then local veh = getPedOccupiedVehicle(player) if veh then setPedAnimation(player, "car", "Sit_relaxed", -1, false, false, true, true, 250, false) else local anim = math.random(1, 5) if(anim == 1) then setPedAnimation(player, "playidles", "stretch", -1, false, false, false, false) elseif(anim == 2) then setPedAnimation(player, "playidles", "strleg", -1, false, false, false, false) elseif(anim == 2) then setPedAnimation(player, "playidles", "time", -1, false, false, false, false) elseif(anim == 2) then setPedAnimation(player, "playidles", "shldr", -1, false, false, false, false) elseif(anim == 2) then setPedAnimation(player, "playidles", "shift", -1, false, false, false, false) end end end end end 5000, 0) That's what I wanted to create, mentioning my latest post
-
CALL FUNCTION DOESN'T WORK I tried to use "handbrake" command from Vehicle System resource (link: https://github.com/FlyingSpoon/vehicle-system). Of course, I've called to function, that I had to create either, because there were only command handlers, but the error kept showing up in console: failed to call 'vsys:handbrakeA'. IMPORTANT: I've added mark to meta file of Vehicle System that I want to export a function, even, I set one .Lua file to <shared>. (Server-side) function: function garage(player) local veh = getPedOccupiedVehicle(player) local x, y, z = getElementPosition(player) if veh then setElementPosition(veh, 4651.0595703125, -15999.06640625, -0.55000001192093) call(getResourceFromName("vsys"), "handbrakeA", player) call(getResourceFromName("vsys"), "parkA", player) removePedFromVehicle(player) setElementPosition(player, x, y, z) outputChatBox ("#09ff00Gotowe!", player, 255, 255, 255, true) else outputChatBox("#ff1100Musisz być w pojeździe!",player, 255, 255, 255, true) end end *Do not teleport urself to the coordinates! ? *outputChatBox messages translations: 1st - Done!, 2nd - You need to be in vehicle! CAN SOMEONE HELP, PLEASE? ?
- 1 reply
-
- call_function
- call function
-
(and 3 more)
Tagged with:
-
Identical panels, only with different functions, giving interference, how to fix? the panels are separated by acl, but when I press the bind key, it opens the two, but it is not allowed to access the resources, but it gets in the way, because all corporation panels are the same, changing only the function and the acl group script: function SetCorpFT(player) if player and not isGuestAccount(getPlayerAccount(player)) then if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("BOPECMD")) then setElementData (player,resname..":soucmd", true) setElementData (player,resname..":gerenciar", true) setElementData (player,resname..":promover", true) setElementData (player,resname..":expulsar", true) setElementData (player,resname..":recrutar", true) setElementData (player,resname..":skin1", true) setElementData (player,resname..":skin2", true) setElementData (player,resname..":skin3", true) setElementData (player,resname..":vtr1", true) setElementData (player,resname..":vtr2", true) setElementData (player,resname..":vtr3", true) setElementData (player,resname..":vtr4", true) setElementData (player,resname..":soumembro", true) setElementData (player, "isPolice", true) return 1 end if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("BOPE6")) then setElementData (player,resname..":gerenciar", true) setElementData (player,resname..":promover", true) setElementData (player,resname..":expulsar", true) setElementData (player,resname..":recrutar", true) setElementData (player,resname..":skin1", true) setElementData (player,resname..":skin2", true) setElementData (player,resname..":skin3", true) setElementData (player,resname..":vtr1", true) setElementData (player,resname..":vtr2", true) setElementData (player,resname..":vtr3", true) setElementData (player,resname..":vtr4", true) setElementData (player,resname..":soumembro", true) setElementData (player, "isPolice", true) return 1 end if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("BOPE5")) then setElementData (player,resname..":gerenciar", true) setElementData (player,resname..":skin1", true) setElementData (player,resname..":skin2", true) setElementData (player,resname..":skin3", true) setElementData (player,resname..":vtr1", true) setElementData (player,resname..":vtr2", true) setElementData (player,resname..":vtr3", true) setElementData (player,resname..":vtr4", true) setElementData (player,resname..":soumembro", true) setElementData (player, "isPolice", true) return 1 end if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("BOPE4")) then setElementData (player,resname..":skin1", true) setElementData (player,resname..":skin2", true) setElementData (player,resname..":skin3", true) setElementData (player,resname..":vtr1", true) setElementData (player,resname..":vtr2", true) setElementData (player,resname..":vtr3", true) setElementData (player,resname..":vtr4", true) setElementData (player,resname..":soumembro", true) setElementData (player, "isPolice", true) return 1 end if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("BOPE3")) then setElementData (player,resname..":skin2", true) setElementData (player,resname..":skin3", true) setElementData (player,resname..":vtr1", true) setElementData (player,resname..":vtr2", true) setElementData (player,resname..":soumembro", true) setElementData (player, "isPolice", true) return 1 end if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("BOPE2")) then setElementData (player,resname..":skin2", true) setElementData (player,resname..":skin3", true) setElementData (player,resname..":vtr1", true) setElementData (player,resname..":soumembro", true) setElementData (player, "isPolice", true) return 1 end if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("BOPE1")) then setElementData (player,resname..":skin2", true) setElementData (player,resname..":skin3", true) setElementData (player,resname..":soumembro", true) return 1 end end end setTimer( function() for i, pl in pairs(getElementsByType("player")) do if pl ~= (false or nil) then SetCorpFT(pl) end end end, 10000, 0) function checkskinsBOPE ( ) if ( getElementType ( source ) == "player" ) then if ( getElementModel ( source ) == 255 ) then if getElementData(source,"vdbbopevtr1") == false and not (isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("BOPECMD")) then showBox(source,"info",""..corp..": Acesso negado") return end end if ( getElementModel ( source ) == 256 ) then if getElementData(source,"vdbbopevtr2") == false and not (isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("BOPECMD")) then showBox(source,"info",""..corp..": Acesso negado") return end end if ( getElementModel ( source ) == 257 ) then if getElementData(source,"vdbbopevtr3") == false and not (isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("BOPECMD")) then showBox(source,"info",""..corp..": Acesso negado") return end end end end addEventHandler("onElementModelChange",getRootElement(),checkskinsBOPE) function CorpSkinBOPE(id) if tonumber(id) then setElementModel ( source, id ) showBox(source,"info","Você pegou skin "..corp..":") end end addEvent(resname..":setarskin", true) addEventHandler(resname..":setarskin", root, CorpSkinBOPE) function CorpKitBOPE() setElementHealth(source, 200) setPedArmor(source, 100) giveWeapon(source, 3, 200, true) giveWeapon(source, 23, 200, true) giveWeapon(source, 26, 200, true) giveWeapon(source, 28, 200, true) giveWeapon(source, 31, 200, true) giveWeapon(source, 34, 200, true) giveWeapon(source, 14, 200, true) showBox(source,"info","Você pegou Kit da "..corp..":") end addEvent(resname..":corpkitbope", true) addEventHandler(resname..":corpkitbope", root, CorpKitBOPE) function CorpTeleBaseBOPE () local CorpVTR = getPedOccupiedVehicle(source) if (CorpVTR) then setElementPosition(CorpVTR,1521.5, -1661.3000488281, 13.5) else setElementPosition(source,1521.5, -1661.3000488281, 13.5 ) end showBox(source,"info","Você teleportou-se para base da "..corp..":") end addEvent(resname..":corpteleportebasebope", true) addEventHandler(resname..":corpteleportebasebope", root, CorpTeleBaseBOPE) local CorpVTRBOPE = {} function CorpVTRvdbBOPE(viatura) local veiculo = getPedOccupiedVehicle ( source ) if veiculo and getVehicleController(veiculo) == source and isElement( CorpVTRBOPE[source] ) and veiculo == CorpVTRBOPE[source] then if tonumber(viatura) == 1 then setElementModel (veiculo,tonumber(547)) elseif tonumber(viatura) == 2 then setElementModel (veiculo,tonumber(490)) setVehicleColor(veiculo,255,255,255,255,255,255) elseif tonumber(viatura) == 3 then setElementModel (veiculo,tonumber(427)) elseif tonumber(viatura) == 4 then setElementModel (veiculo,tonumber(497)) end else if CorpVTRBOPE[source] and isElement( CorpVTRBOPE[source] ) then destroyElement( CorpVTRBOPE[source] ) CorpVTRBOPE[source] = nil end local x,y,z = getElementPosition(source) if tonumber(viatura) == 1 then CorpVTRBOPE[source] = createVehicle(547, x,y,z) warpPedIntoVehicle (source,CorpVTRBOPE[source]) showBox(source,"info","Você pegou VTR da "..corp..":") return 1 end if tonumber(viatura) == 2 then CorpVTRBOPE[source] = createVehicle(490, x,y,z) warpPedIntoVehicle (source,CorpVTRBOPE[source]) setVehicleColor(CorpVTRBOPE[source],255,255,255,255,255,255) showBox(source,"info","Você pegou VTR da "..corp..":") return 1 end if tonumber(viatura) == 3 then CorpVTRBOPE[source] = createVehicle(427, x,y,z) setVehicleDamageProof() warpPedIntoVehicle (source,CorpVTRBOPE[source]) showBox(source,"info","Você pegou Moto da "..corp..":") return 1 end if tonumber(viatura) == 4 then CorpVTRBOPE[source] = createVehicle(497, x,y,z) warpPedIntoVehicle (source,CorpVTRBOPE[source]) showBox(source,"info","Você pegou Moto da "..corp..":") return 1 end end end addEvent(resname..":corpviatura", true) addEventHandler(resname..":corpviatura", root, CorpVTRvdbBOPE) function CorpDestruirVTRBOPE() if CorpVTRBOPE[source] and isElement( CorpVTRBOPE[source] ) then destroyElement( CorpVTRBOPE[source] ) CorpVTRBOPE[source] = nil showBox(source,"info","Viatura destruida") end end addEvent(resname..":corpdestruirviatura", true) addEventHandler(resname..":corpdestruirviatura", root, CorpDestruirVTRBOPE) addEventHandler ("onPlayerQuit", root, CorpDestruirVTRBOPE) p_lights = {} p_timer = {} p_lvar = {} function CorpLuzesBOPE() local veh = getPedOccupiedVehicle(source) local id = getElementModel(veh) if (id == 547) or (id == 490) or (id == 427) or (id == 497) or (id == 427) or (id == 523) or (id == 490) or (id == 416) then if(p_lights[veh] == 0) or(p_lights[veh] == nil) then p_lights[veh] = 1 showBox(source,"info","Luzes de Alerta ligadas") setVehicleOverrideLights ( veh, 2 ) p_timer[veh] = setTimer( function() if(p_lvar[veh] == 0) or (p_lvar[veh] == nil) then p_lvar[veh] = 1 -- 0 = vorne links 1 = vorne rechts 2 = hinten links 3 = hinten rechts setVehicleLightState ( veh, 1, 0) setVehicleLightState ( veh, 2, 0) setVehicleLightState ( veh, 0, 1) setVehicleLightState ( veh, 3, 1) setVehicleHeadLightColor(veh, 0, 0, 255) else setVehicleLightState ( veh, 3, 0) setVehicleLightState ( veh, 0, 0) setVehicleLightState ( veh, 1, 1) setVehicleLightState ( veh, 2, 1) setVehicleHeadLightColor(veh, 255, 0, 0) p_lvar[veh] = 0 end end, 500, 0) else p_lights[veh] = 0 showBox(source,"info","Luzes de Alerta desligadas") killTimer(p_timer[veh]) setVehicleLightState ( veh, 0, 0) setVehicleLightState ( veh, 1, 0) setVehicleLightState ( veh, 2, 0) setVehicleLightState ( veh, 3, 0) setVehicleHeadLightColor(veh, 255, 255, 255) setVehicleOverrideLights ( veh, 1 ) end else showBox(source,"info","Este Veiculo Não é uma Viatura") end end addEvent(resname..":corpluzesbope", true) addEventHandler(resname..":corpluzesbope", root, CorpLuzesBOPE() addEventHandler ( "onVehicleExplode", getRootElement(), function() if(p_lights[source] == 1) then killTimer(p_timer[source]) end end ) addEventHandler ( "onVehicleRespawn", getRootElement(), function() if(p_lights[source] == 1) then killTimer(p_timer[source]) end end ) addEventHandler("onElementDestroy", getRootElement(), function () if getElementType(source) == "vehicle" then if(p_lights[source] == 1) then killTimer(p_timer[source]) end end end) function CorpAbandonarBOPE(cargo) local acl = aclGetGroup(cargo) if (acl) then local conta = getAccountName(getPlayerAccount(source)) local checkacl = isObjectInACLGroup ( "user." ..conta, acl) if (checkacl) then aclGroupRemoveObject(acl, "user."..conta) showBox(source,"info",""..corp..": Você abandonou a Corporação") setElementData (source, "vdbsoumembroBOPE",false) outputServerLog("ABANDONOU "..corp..": "..getPlayerName(source):gsub("#%x%x%x%x%x%x","").." > "..cargo.."") end end end addEvent(resname..":abandonarcorpbope", true) addEventHandler(resname..":abandonarcorpbope", getRootElement(), CorpAbandonarBOPE) function IsCorpGroupBOPE ( thePlayer ) local account = getPlayerAccount ( thePlayer ) local InBOPE = false for _, group in ipairs ( {"BOPECMD","BOPE6","BOPE5","BOPE4","BOPE3","BOPE2","BOPE1"} ) do if isObjectInACLGroup ( "user.".. getAccountName ( account ), aclGetGroup ( group ) ) then InBOPE = true break end end return InBOPE end function CorpGetMembrosActBOPE(player) local info = {} for _,players in pairs(getElementsByType("player")) do if getElementDimension( players) == 0 and getElementInterior(players) == 0 and not isGuestAccount ( getPlayerAccount ( players ) ) then if ( IsCorpGroupBOPE ( players ) ) then table.insert(info,{getPlayerName(players),players}) end end end triggerClientEvent(player,resname..":ListaCorp",player,info) end addEvent(resname..":corpmembrosativobope",true) addEventHandler(resname..":corpmembrosativobope",root,CorpGetMembrosActBOPE) function CorpGetMembrosBOPE(player) local info = {} for _,players in pairs(getElementsByType("player")) do if ( IsCorpGroupBOPE ( players ) ) then table.insert(info,{getPlayerName(players),players}) end end triggerClientEvent(player,resname..":ListaCorp",player,info) end addEvent(resname..":corptodosmembrosbope",true) addEventHandler(resname..":corptodosmembrosbope",root,CorpGetMembrosBOPE) function CorpGetAllPlayersBOPE(player) local info = {} for _,players in pairs(getElementsByType("player")) do if not isGuestAccount ( getPlayerAccount ( players ) ) and not ( IsCorpGroupBOPE ( players ) ) then table.insert(info,{getPlayerName(players),players}) end end triggerClientEvent(player,resname..":ListaCorp",player,info) end addEvent(resname..":corpgetplayersbope",true) addEventHandler(resname..":corpgetplayersbope",root,CorpGetAllPlayersBOPE) function CorpIrBOPE(teleporter) irtp = teleporter playerair = getPlayerFromName(irtp) if playerair then local veiculotp = getPedOccupiedVehicle(source) if (veiculotp) then showBox(source,"error","Saia do Veiculo") return end if getElementData(playerair,"emCombate") == true then showBox(source,"info","Erro o jogador esta em Combate "..irtp.."") return end local x,y,z = getElementPosition(playerair) setElementPosition(source, x, y, z + 2) showBox(source,"info","Você se teleportou até o jogador "..irtp.."") outputServerLog("TELEPORTE BOPE: Foi "..getPlayerName(source):gsub("#%x%x%x%x%x%x","").." > "..irtp.."") end end addEvent(resname..":TeleIrCorpbope", true) addEventHandler(resname..":TeleIrCorpbope", root, CorpIrBOPE) function CorpPuxarBOPE(teleporter) irtp = teleporter playerair = getPlayerFromName(irtp) if playerair then local veiculotp = getPedOccupiedVehicle(playerair) if (veiculotp) then showBox(source,"error","O Jogador esta em um veiculo") return end if getElementData(playerair,"emCombate") == true then showBox(source,"info","Erro o jogador esta em Combate "..irtp.."") return end local x,y,z = getElementPosition(source) setElementPosition(playerair, x, y, z + 2) showBox(source,"info","Você puxou o jogador "..irtp.." ") showBox(playerair,"info",""..getPlayerName(source):gsub("#%x%x%x%x%x%x","").." puxou você") outputServerLog("TELEPORTE BOPE: Puxou "..getPlayerName(source):gsub("#%x%x%x%x%x%x","").." > "..irtp.."") end end addEvent(resname..":TelePuxarCorpbope", true) addEventHandler(resname..":TelePuxarCorpbope", root, CorpPuxarBOPE) function CorpRemoverMembroBOPE(player, cargo) local accountName = getAccountName(getPlayerAccount(client)) if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "BOPECMD" ) ) or isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "BOPE6" ) ) then arecrutar = getPlayerFromName(player) local contaarecrutar = getPlayerAccount(arecrutar) local cargoremove = aclGetGroup(cargo) if (cargoremove) then local contaaremover = getAccountName(contaarecrutar) local checkcargo = isObjectInACLGroup ( "user." ..contaaremover, cargoremove) if (checkcargo) then aclGroupRemoveObject(cargoremove, "user."..contaaremover) setElementData (arecrutar, "vdbsoumembroBOPE",false) showBox(arecrutar,"error",""..corp..": Você foi removido da Corporação") outputServerLog("EXPULSO "..corp..":: "..getPlayerName(arecrutar):gsub("#%x%x%x%x%x%x","").." > "..cargo.." > "..getPlayerName(source):gsub("#%x%x%x%x%x%x","").." ") end end end end addEvent(resname..":corpremovermembrobope", true) addEventHandler(resname..":corpremovermembrobope", getRootElement(), CorpRemoverMembroBOPE) function CorpRecrutarBOPE(player, cargo) local accountName = getAccountName(getPlayerAccount(client)) if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "BOPECMD" ) ) or isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "BOPE6" ) ) then arecrutar = getPlayerFromName(player) local contaarecrutar = getPlayerAccount(arecrutar) --for _, checkcorp in ipairs ({}) do for _, checkcorp in ipairs ({"Suporte"}) do if isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(arecrutar)), aclGetGroup( checkcorp )) then showBox(source,"error","o Jogador "..getPlayerName(arecrutar):gsub("#%x%x%x%x%x%x","").." pertence a outra Corp/Gang ["..checkcorp.."]") cancelEvent() return 1 end end local cargoset = aclGetGroup(cargo) if (cargoset) then local ncuenta = getAccountName(contaarecrutar) local checkrecrut = isObjectInACLGroup ( "user." ..ncuenta, cargoset) if (not checkrecrut) then aclGroupAddObject(cargoset, "user."..ncuenta) setElementData (arecrutar, "vdbsoumembroBOPE",false) showBox(arecrutar,"info",""..corp..": Você foi Recrutado (Aguarde 10 segundos até seu painel atualizar)") showBox(source,"info",""..corp..": Você Recrutou o "..getPlayerName(arecrutar):gsub("#%x%x%x%x%x%x","").." para "..corp.."") outputServerLog("RECRUTAMENTO "..corp..": "..getPlayerName(arecrutar):gsub("#%x%x%x%x%x%x","").." > "..cargo.." > "..getPlayerName(source):gsub("#%x%x%x%x%x%x","").." ") end end end end addEvent(resname..":corprecrutarbope", true) addEventHandler(resname..":corprecrutarbope", getRootElement(), CorpRecrutarBOPE) function CorpPromoverBOPE(player, cargo) local accountName = getAccountName(getPlayerAccount(client)) if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "BOPECMD" ) ) or isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "BOPE6" ) ) then arecrutar = getPlayerFromName(player) local contaarecrutar = getPlayerAccount(arecrutar) for _, checkcorp in ipairs ({"Suporte"}) do --for _, checkcorp in ipairs ({}) do if isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(arecrutar)), aclGetGroup( checkcorp )) then showBox(source,"error","o Jogador "..getPlayerName(arecrutar):gsub("#%x%x%x%x%x%x","").." pertence a outra Corp/Gang ["..checkcorp.."]") cancelEvent() return 1 end end local cargoset = aclGetGroup(cargo) if (cargoset) then local ncuenta = getAccountName(contaarecrutar) local checkrecrut = isObjectInACLGroup ( "user." ..ncuenta, cargoset) if (not checkrecrut) then aclGroupAddObject(cargoset, "user."..ncuenta) setElementData (arecrutar, "vdbsoumembroBOPE",false) showBox(arecrutar,"info",""..corp..": Você foi Promovido (Aguarde 10 segundos até seu painel atualizar)") showBox(source,"info",""..corp..": Você Promoveu o "..getPlayerName(arecrutar):gsub("#%x%x%x%x%x%x","").." para "..corp.."") outputServerLog("PROMOVEU "..corp..": "..getPlayerName(arecrutar):gsub("#%x%x%x%x%x%x","").." > "..cargo.." > "..getPlayerName(source):gsub("#%x%x%x%x%x%x","").." ") end end end end addEvent(resname..":corppromoverbope", true) addEventHandler(resname..":corppromoverbope", getRootElement(), CorpPromoverBOPE) function CorpOneACLBOPE(player, cargo) local accountName = getAccountName(getPlayerAccount(client)) if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "BOPECMD" ) ) or isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "BOPE6" ) ) then arecrutar = getPlayerFromName(player) local contaarecrutar = getPlayerAccount(arecrutar) local cargoremove = aclGetGroup(cargo) if (cargoremove) then local contaaremover = getAccountName(contaarecrutar) local checkcargo = isObjectInACLGroup ( "user." ..contaaremover, cargoremove) if (checkcargo) then aclGroupRemoveObject(cargoremove, "user."..contaaremover) setElementData (arecrutar, "vdbsoumembroBOPE",false) outputServerLog(""..corp..": CARGO ONE: "..getPlayerName(arecrutar):gsub("#%x%x%x%x%x%x","").." > "..cargo.." > "..getPlayerName(source):gsub("#%x%x%x%x%x%x","").." ") end end end end addEvent(resname..":CorpCagoOnebope", true) addEventHandler(resname..":CorpCagoOnebope", getRootElement(), CorpOneACLBOPE) function QuitRemoverCorpBOPE () if isObjectInACLGroup ("user."..getAccountName(getPlayerAccount(source)),aclGetGroup("BOPE1")) then aclGroupRemoveObject (aclGetGroup("BOPE1"), "user."..getAccountName(getPlayerAccount(source))) end end addEventHandler ( "onPlayerQuit", getRootElement(),QuitRemoverCorpBOPE) function CorpAcessoBOPE() showBoxBOPE(source,"error","Acesso não permitido") end addEvent("acessonegadobope", true) addEventHandler("acessonegadobope", root,CorpAcessoBOPE) function showBoxBOPE(player, value, str) if isElement(player) then triggerClientEvent(player, "CreateBox", getRootElement(), value, str) end end function corpmsgbope(source,type,msg) if source and type and msg then showBoxBOPE(source,type,msg) end end addEvent(resname..":corpmsgbope", true) addEventHandler(resname..":corpmsgbope", root, corpmsgbope)
-
- panels
- interference
-
(and 5 more)
Tagged with:
-
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?
-
function asdasdsas() playSound("http://www.convertmp3.io/fetch/?video=https://www.youtube.com/watch?v=iq7q82Cd6RI") end addCommandHandler("test",asdasdsas) what wrong? the API working fine, but the playSound not.. how to fix?
-
I have this: function Salir() if isElement(tableVehicles[source]) then destroyElement(tableVehicles[source]) end end addEventHandler("onPlayerVehicleExit",getRootElement(),Salir) This function destroys the vehicle when the player leaves, I want this to happen after a second and not immediately, i need to use "Set timer", but I do not know how to use it, I tried different ways but none of them