SkillZNT

Members
  • Content Count

    53
  • Joined

  • Last visited

Community Reputation

0 Neutral

About SkillZNT

  • Rank
    Snitch

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Tem que ser Lua kkkkk Essa lingua não e Lua 'w'
  2. Eu tava querendo um codigo meio q basico se alguem poder ajudar tipo eu uso /darveiculo Joao 404 ele da o veiculo pro jogador com o getPlayerFromPartialName sabe mais q o comando funcione apenas no grupo acl (console)
  3. Alguma forma de colocar um time de 2 segundos pra ser removido
  4. Tem ums carinhas que usam nome invisivel no meu servidor eu queria saber se existe algum resource que não permite que ele troque o nome pra #000000 ou #FFFFFF pra não ficar invisivel no tab Tipo um mod pra não permitir que pessoas usem #000000 ou Qualquer cor sem uma letra no final Obrigado a todos que me ajudarem com esse probleminha ❤️
  5. Qual deles que falta O do sistema de level ou da agencia? aqui uma print do debug
  6. Opa eu quero ligar um sistema de level junto com uma agencia de empregos pois ela n ta funcionando abre o menu e na hr de selecionar o emprego n acontece nada Vou deixar os dois aqui Sistema Level Arc._c.Lua local sx,sy = guiGetScreenSize() local px,py = 1366,768 local x,y = (sx/px),(sy/py) function drawLevel () local levelProgress = (getElementData(localPlayer,"minutes") or 0) dxDrawRectangle(x*803, y*743, x*160/58*levelProgress, y*19, tocolor(0, 0, 0, 130), false) dxDrawRectangle(x*800, y*740, x*170, y*25, tocolor(0, 0, 0, 120), false) dxDrawText("LEVEL: "..(getElementData(localPlayer,"Level") or 0), x*854, y*746, x*10, y*10, tocolor(255, 255, 255, 255), x*0.9, "default", "left", "top", false, false, false, false, false) end addEventHandler("onClientRender",getRootElement(),drawLevel) Arc_s.Lua function upLevel (thePlayer) for i,player in ipairs(getElementsByType("player")) do if ( player ) then if ( getPlayerAccount(player) ) and not ( isGuestAccount(getPlayerAccount(player)) ) then setElementData(player,"minutes",(getElementData(player,"minutes") or 0) +1) if ( getElementData(player,"minutes") > 59 ) then setElementData(player,"minutes",0) setElementData(player,"Level",(getElementData(player,"Level") or 0) +1) local bonus = math.random(25,950) local interest = math.random(25,150) local value = (bonus-interest) givePlayerMoney(player,value) outputChatBox("#FFFFFF[ #FAAC58Level #FFFFFF]", player, 255, 255, 255, true ) outputChatBox("#FFFFFFPagamento : R$ #00FF00"..value, player, 255, 255, 255, true ) local accName = getAccountName ( getPlayerAccount ( player ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Everyone" ) ) then end end end end end end setTimer(upLevel,9000,0) function setLevelLogin () local account = getPlayerAccount(source) if ( account ) then local Level = (getAccountData(account,"Level") or 0) local minutes = (getAccountData(account,"minutes") or 0) setElementData(source,"Level",Level) setElementData(source,"minutes",minutes) end end addEventHandler("onPlayerLogin",getRootElement(),setLevelLogin) function setLevelJoin () setElementData(source,"Level",0) setElementData(source,"minutes",0) end addEventHandler("onPlayerJoin",getRootElement(),setLevelJoin) function setLevelQuit () local account = getPlayerAccount(source) if ( account ) then local minutes = (getElementData(source,"minutes") or 0) local Level = (getElementData(source,"Level") or 0) setAccountData(account,"minutes",minutes) setAccountData(account,"Level",Level) end end addEventHandler("onPlayerQuit",getRootElement(),setLevelQuit) Agencia interior_S Entrar = createMarker(1481.0498046875,-1772.3115234375,19.595755386353, "arrow", 1.2,16, 111, 231, 90) Sair = createMarker(246.3935546875,107.3017578125,1004.10575, "arrow", 1.2,16, 111, 231, 90) Painel_Open = createMarker(246.69653, 118.40524, 1003.21875 -1, "cylinder", 1.2,16, 111, 231, 90) Blip = createBlipAttachedTo ( Entrar, 61 ) setBlipVisibleDistance(Blip, 150) setElementInterior(Painel_Open, 10) setElementInterior(Sair,10) function entrar (thePlayer) setElementInterior(thePlayer, 10) setElementPosition(thePlayer, 246.583984375,109.3369140625,1003.21875) setElementDimension(thePlayer, 0) end addEventHandler("onMarkerHit", Entrar, entrar) function sair (thePlayer) setElementInterior(thePlayer, 0) setElementPosition(thePlayer, 1481.0185546875,-1768.4638671875,18.795755386353) setElementDimension(thePlayer, 0) end addEventHandler("onMarkerHit", Sair, sair) function OpenguiAG(thePlayer) local account = getPlayerAccount (thePlayer) if isGuestAccount (account) then outputChatBox ( "#106FE7✘ #ffffffAGENCIA #106FE7✘➺ #FFFFFFVocê não pode trabalhar deslogado, Crie uma Conta!", thePlayer, 255,255,255,true) return end if isElementWithinMarker(thePlayer, Painel_Open) then triggerClientEvent(thePlayer,"AG:Abrir",thePlayer) end end addEventHandler( "onMarkerHit", Painel_Open, OpenguiAG ) Save_S.Lua function Loadind_Empregos ( conta ) if not isGuestAccount ( conta ) then if conta then local source = getAccountPlayer ( conta ) local Emprego = getAccountData ( conta, "Emprego" ) or "Desempregado" setElementData ( source, "Emprego", Emprego ) setElementData ( source, "DNL:Categoria(Nenhuma)", true ) end end end function Save_Empregos ( conta ) if conta then local source = getAccountPlayer ( conta ) local Empregos = getElementData ( source, "Emprego" ) or "Desempregado" setAccountData ( conta, "Emprego", Empregos ) end end addEventHandler ( "onPlayerLogin", root, function ( _, acc ) setTimer ( Loadind_Empregos, 60, 1, acc ) end ) function Start_Empregos ( res ) if res == getThisResource ( ) then for i, player in ipairs(getElementsByType("player")) do local acc = getPlayerAccount ( player ) if not isGuestAccount ( acc ) then Loadind_Empregos ( acc ) end end end end addEventHandler ( "onResourceStart", getRootElement ( ), Start_Empregos ) function Stop_Empregos ( res ) if res == getThisResource ( ) then for i, player in ipairs(getElementsByType("player")) do local acc = getPlayerAccount ( player ) if not isGuestAccount ( acc ) then Save_Empregos ( acc ) end end end end addEventHandler ( "onResourceStop", getRootElement(), Stop_Empregos ) function Quit_Server ( quitType ) local acc = getPlayerAccount(source) if not isGuestAccount ( acc ) then if acc then Save_Empregos ( acc ) end end end addEventHandler ( "onPlayerQuit", getRootElement(), Quit_Server ) Danilin_C.Lua local screenW,screenH = guiGetScreenSize() local resW,resH = 1366,768 local x,y = (screenW/resW), (screenH/resH) local Font_1 = dxCreateFont("font/font.ttf", y*11) local Font_2 = dxCreateFont("font/font1.ttf", y*11) local Font_3 = dxCreateFont("font/fontNick.ttf", y*10) local Font_4 = dxCreateFont("font/OpenSans-Bold.ttf", y*11) ------------- ############################################ ------------- ------------- # Edite aqui (Level, Habilitação) # ------------- ------------- ############################################ ------------- Trabalhos = { {"Lixeiro", 0, "Nenhuma"}, -- Emprego, Level, Habilitação {"Carregador", 3, "Nenhuma"}, -- Emprego, Level, Habilitação {"Pescaria", 20, "Nenhuma"}, -- Emprego, Level, Habilitação {"Mineirador", 25, "Nenhuma"}, -- Emprego, Level, Habilitação {"Pizzaboy", 5, "Nenhuma"}, -- Emprego, Level, Habilitação {"Sedex", 10, "Nenhuma"}, -- Emprego, Level, Habilitação {"Caminhoneiro", 15, "Nenhuma"}, -- Emprego, Level, Habilitação } --===================================-- ------------- Abrir/Fechar ------------ --===================================-- function Abrir_agencia () if isEventHandlerAdded("onClientRender", getRootElement(), Dx_Agencia) then return end showCursor(true) ListaTrabalhos:SetVisible(true) addEventHandler("onClientRender", root, Dx_Agencia) end addEvent("AG:Abrir", true) addEventHandler("AG:Abrir", root, Abrir_agencia) function CloseAgencia () if isEventHandlerAdded("onClientRender", getRootElement(), Dx_Agencia) then showCursor(false) ListaTrabalhos:SetVisible(false) removeEventHandler("onClientRender", root, Dx_Agencia) end end --=======================================-- ------------- Interface Painel ------------ --=======================================-- function Dx_Agencia () exports["Blur"]:dxDrawBluredRectangle(x*488, y*138, x*391, y*491, tocolor(255, 255, 255, 255)) dxDrawRectangle(x*488, y*138, x*391, y*491, tocolor(0, 0, 0, 170), false) dxDrawRectangle(x*489, y*138, x*391, y*38, tocolor(0, 0, 0, 212), false) dxDrawLine(x*488, y*176, x*880, y*176, tocolor(16, 111, 231, 255), x*2, false) dxDrawText("Agencia de Empregos", x*621, y*146, x*746, y*161, tocolor(255, 255, 255, 255), 1.00, Font_1, "left", "top", false, false, false, false, false) dxDrawImage(x*500, y*494, x*366, y*37, "Img/botao.png", 0, 0, 0, CorEmprego, false) dxDrawText("Pegar Emprego", x*639, y*502, x*729, y*519, tocolor(0, 0, 0, 255), 1.00, Font_1, "left", "top", false, false, false, false, false) CorEmprego = tocolor(16, 111, 231, 170) if isCursorOnElement(x*500, y*494, x*366, y*37) then CorEmprego = tocolor(16, 111, 231, 200) end dxDrawImage(x*500, y*538, x*366, y*37, "Img/botao.png", 0, 0, 0, CorDemissao, false) dxDrawText("Pedir Demissão", x*640, y*546, x*726, y*563, tocolor(0, 0, 0, 255), 1.00, Font_1, "left", "top", false, false, false, false, false) CorDemissao = tocolor(16, 111, 231, 170) if isCursorOnElement(x*500, y*538, x*366, y*37) then CorDemissao = tocolor(16, 111, 231, 200) end dxDrawImage(x*500, y*582, x*366, y*37, "Img/botao.png", 0, 0, 0, CorSair, false) dxDrawText("Sair Agencia", x*650, y*590, x*719, y*609, tocolor(0, 0, 0, 255), 1.00, Font_1, "left", "top", false, false, false, false, false) CorSair = tocolor(16, 111, 231, 170) if isCursorOnElement(x*500, y*582, x*366, y*37) then CorSair = tocolor(16, 111, 231, 200) end end --================================-- ------------- GridTable ------------ --================================-- addEventHandler("onClientResourceStart", resourceRoot, function () ListaTrabalhos = dxGridW:Create(494, 183, 379, 302) ListaTrabalhos:AddColumn("Emprego", 140) ListaTrabalhos:AddColumn("Level", 105) ListaTrabalhos:AddColumn("Habilitação", 120) ListaTrabalhos:SetVisible(false) for i,v in ipairs (Trabalhos) do ListaTrabalhos:AddItem(1, tostring(v[1])) ListaTrabalhos:AddItem(2, tostring(v[2])) ListaTrabalhos:AddItem(3, tostring(v[3])) end end) --=============================-- ------------- Clicks ------------ --=============================-- function Pegar_Trabalho ( _,state ) if isEventHandlerAdded("onClientRender", getRootElement(), Dx_Agencia) then if state == "down" then if isCursorOnElement(x*500, y*582, x*366, y*37) then -- Fechar Agencia CloseAgencia () end if isCursorOnElement(x*500, y*494, x*366, y*37) then -- Pegar Emprego if ListaTrabalhos:GetSelectedItem() > -1 then local Trab = ListaTrabalhos:GetItemDetails(1, ListaTrabalhos:GetSelectedItem()) local Level = ListaTrabalhos:GetItemDetails(2, ListaTrabalhos:GetSelectedItem()) local Hab = ListaTrabalhos:GetItemDetails(3, ListaTrabalhos:GetSelectedItem()) playSoundFrontEnd(12) triggerServerEvent("DNL:Pegar_Emprego", root, localPlayer, Trab, Level, Hab) else triggerEvent("addNotification", root, "#ffffffINFO: #ffffffSelecione o Emprego que Você Deseja Trabalhar", "info") end elseif isCursorOnElement(x*500, y*538, x*366, y*37) then -- Demissão playSoundFrontEnd(12) triggerServerEvent("DNL:Pedir_Demissao", root, localPlayer) end end end end addEventHandler ( "onClientClick", root, Pegar_Trabalho ) --=============================-- ------------- IGNORA ------------ --=============================-- --==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==- addEventHandler("onClientKey", root, function (button, press) if isEventHandlerAdded("onClientRender", getRootElement(), Dx_Agencia) then if button == "F1" or button == "F2" or button == "F3" or button == "F5" or button == "F6" or button == "F7" or button == "F9" or button == "F10" or button == "F11" or button == "F12" or button == "t" or button == "p" or button == "m" then cancelEvent() end end end ) --==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==- function isEventHandlerAdded( sEventName, pElementAttachedTo, func ) if type( sEventName ) == 'string' and isElement( pElementAttachedTo ) and type( func ) == 'function' then local aAttachedFunctions = getEventHandlers( sEventName, pElementAttachedTo ) if type( aAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then for i, v in ipairs( aAttachedFunctions ) do if v == func then return true end end end end return false end --==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==- local x,y = guiGetScreenSize() function isCursorOnElement(x, y, w, h) if (not isCursorShowing()) then return false end 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. Eu coloquei um time de 5 segundos no meu freeroam so q tipo ao inves dele funcionar Ele tipo bugou o reparar n apareçe a mensagem do reparar nem repara o veiculo quando clica no botao Queria por um mensagem vermelha #FF0000Aguarde 10 segundos pra reparar o veiculo aqui o codigo sem alteraçoes local commands = {} local customSpawnTable = false local allowedStyles = { [4] = true, [5] = true, [6] = true, [7] = true, [15] = true, [16] = true, } local internallyBannedWeapons = { [19] = true, [20] = true, [21] = true, } local server = setmetatable( {}, { __index = function(t, k) t[k] = function(...) triggerServerEvent('onServerCall', resourceRoot, k, ...) end return t[k] end } ) guiSetInputMode("no_binds_when_editing") setCameraClip(true, false) local antiCommandSpam = {} local playerGravity = getGravity() local knifeRestrictionsOn = false local g_settings = {} local _addCommandHandler = addCommandHandler local _setElementPosition = setElementPosition function freeroamSettings(settings) if settings then g_settings = settings for _,gui in ipairs(disableBySetting) do guiSetEnabled(getControl(gui.parent,gui.id),g_settings["gui/"..gui.id]) end for index,player in ipairs(getElementsByType("player")) do updateName(player,getPlayerName(player)) end end end local global_cooldown = 0 function isFunctionOnCD(func, exception) local tick = getTickCount() if g_settings.command_spam_protection and global_cooldown ~= 0 then if tick - global_cooldown <= g_settings.command_spam_ban_duration then local duration = math.ceil((g_settings.command_spam_ban_duration-tick+global_cooldown)/1000) errMsg("You are banned from using commands for " .. duration .." seconds due to continuous spam") return true end end if not g_settings.command_spam_protection then return false end if not antiCommandSpam[func] then antiCommandSpam[func] = {time = tick, tries = 1} return false end local oldTime = antiCommandSpam[func].time if (tick-oldTime) > 2000 then antiCommandSpam[func].time = tick antiCommandSpam[func].tries = 1 return false end antiCommandSpam[func].tries = antiCommandSpam[func].tries + 1 if exception and (antiCommandSpam[func].tries < g_settings.g_settings.tries_required_to_trigger_low_priority) then return false end if (exception == nil) and (antiCommandSpam[func].tries < g_settings.tries_required_to_trigger) then return false end global_cooldown = tick antiCommandSpam[func].tries = 0 errMsg("Failed, do not spam the commands!") return true end local function executeCommand(cmd,...) local func = commands[cmd] cmd = string.lower(cmd) if not commands[cmd] then return end if table.find(g_settings["command_exception_commands"],cmd) then func(cmd,...) return end if isFunctionOnCD(func) then return end func(cmd,...) end local function addCommandHandler(cmd,func) commands[cmd] = func _addCommandHandler(cmd,executeCommand,false) end local function cancelKnifeEvent(target) if knifingDisabled then cancelEvent() errMsg("Knife restrictions are in place") end if g_PlayerData[localPlayer].knifing or g_PlayerData[target].knifing then cancelEvent() end end local function resetKnifing() knifeRestrictionsOn = false end local function setElementPosition(element,x,y,z) if g_settings["weapons/kniferestrictions"] and not knifeRestrictionsOn then knifeRestrictionsOn = true setTimer(resetKnifing,5000,1) end _setElementPosition(element,x,y,z) end function skinInit() setControlNumber(wndSkin, 'skinid', getElementModel(localPlayer)) end function showSkinID(leaf) if leaf.id then setControlNumber(wndSkin, 'skinid', leaf.id) end end function applySkin() local skinID = getControlNumber(wndSkin, 'skinid') if skinID then server.setMySkin(skinID) fadeCamera(true) end end wndSkin = { 'wnd', text = 'Painel de Skin', width = 280, x = -20, y = 0.3, controls = { { 'lst', id='skinlist', width=255, height=290, columns={ {text='Skin', attr='name'} }, rows={xml='xml/skins.xml', attrs={'id', 'name'}}, onitemclick=showSkinID, onitemdoubleclick=applySkin, DoubleClickSpamProtected=true, }, {'txt', id='skinid', text='', width=0}, {'btn', id='set', text='Setar', onclick=applySkin, ClickSpamProtected = true}, {'btn', id='enableModel', text='Ativar', onclick=applySkin, ClickSpamProtected = true}, {'btn', id='disableModel', text='Desativar', onclick=applySkin, ClickSpamProtected = true}, {'btn', id='close', text='Fechar', closeswindow=true} }, oncreate = skinInit } function setSkinCommand(cmd, skin) skin = skin and tonumber(skin) if skin then server.setMySkin(skin) fadeCamera(true) closeWindow(wndSpawnMap) closeWindow(wndSetPos) end end function applyAnimation(leaf) if type(leaf) ~= 'table' then leaf = getSelectedGridListLeaf(wndAnim, 'animlist') if not leaf then return end end server.setPedAnimation(localPlayer, leaf.parent.name, leaf.name, true, true) end function stopAnimation() server.setPedAnimation(localPlayer, false) end wndAnim = { 'wnd', text = 'Painel de Animação', width = 250, x = -20, y = 0.3, controls = { { 'lst', id='animlist', width=230, height=290, columns={ {text='Animation', attr='name'} }, rows={xml='xml/animations.xml', attrs={'name'}}, expandlastlevel=false, onitemdoubleclick=applyAnimation, DoubleClickSpamProtected=true, }, {'btn', id='set', text='Animar', onclick=applyAnimation, ClickSpamProtected=true}, {'btn', id='stop', text='Parar', onclick=stopAnimation}, {'btn', id='close', text='Fechar', closeswindow=true} } } function addWeapon(leaf, amount) if type(leaf) ~= 'table' then leaf = getSelectedGridListLeaf(wndWeapon, 'weaplist') amount = getControlNumber(wndWeapon, 'amount') if not amount or not leaf or not leaf.id then return end end if amount < 1 then errMsg("Invalid amount") return end server.giveMeWeapon(leaf.id, amount) end wndWeapon = { 'wnd', text = 'Painel de Armas', width = 250, controls = { { 'lst', id='weaplist', width=230, height=280, columns={ {text='Weapon', attr='name'} }, rows={xml='xml/weapons.xml', attrs={'id', 'name'}}, onitemdoubleclick=function(leaf) addWeapon(leaf, 500) end, DoubleClickSpamProtected=true }, {'br'}, {'txt', id='amount', text='500', width=60}, {'btn', id='add', text='Adicionar', onclick=addWeapon, ClickSpamProtected=true}, {'btn', id='close', text='Fechar', closeswindow=true} } } function giveWeaponCommand(cmd, weapon, amount) weapon = tonumber(weapon) and math.floor(tonumber(weapon)) or weapon and getWeaponIDFromName(weapon) or 0 amount = amount and math.floor(tonumber(amount)) or 500 if amount < 1 or weapon < 1 or weapon > 46 then return end if internallyBannedWeapons[weapon] then return end server.giveMeWeapon(weapon, amount) end addCommandHandler('setstyle', function(cmd, style) style = style and tonumber(style) or 7 if allowedStyles[style] then server.setPedFightingStyle(localPlayer, style) end end ) function clothesInit() if getElementModel(localPlayer) ~= 0 then errMsg('Só aplica para personagem CJ') closeWindow(wndClothes) return end if not g_Clothes then triggerServerEvent('onClothesInit', resourceRoot) end end addEvent('onClientClothesInit', true) addEventHandler('onClientClothesInit', resourceRoot, function(clothes) g_Clothes = clothes.allClothes for i,typeGroup in ipairs(g_Clothes) do for j,cloth in ipairs(typeGroup.children) do if not cloth.name then cloth.name = cloth.model .. ' - ' .. cloth.texture end cloth.wearing = clothes.playerClothes[typeGroup.type] and clothes.playerClothes[typeGroup.type].texture == cloth.texture and clothes.playerClothes[typeGroup.type].model == cloth.model or false end table.sort(typeGroup.children, function(a, b) return a.name < b.name end) end bindGridListToTable(wndClothes, 'clothes', g_Clothes, false) end ) function clothListClick(cloth) setControlText(wndClothes, 'addremove', cloth.wearing and 'remove' or 'add') end function applyClothes(cloth) if not cloth then cloth = getSelectedGridListLeaf(wndClothes, 'clothes') if not cloth then return end end if cloth.wearing then cloth.wearing = false setControlText(wndClothes, 'addremove', 'add') server.removePedClothes(localPlayer, cloth.parent.type) else local prevClothIndex = table.find(cloth.siblings, 'wearing', true) if prevClothIndex then cloth.siblings[prevClothIndex].wearing = false end cloth.wearing = true setControlText(wndClothes, 'addremove', 'remove') server.addPedClothes(localPlayer, cloth.texture, cloth.model, cloth.parent.type) end end wndClothes = { 'wnd', text = 'Painel de Roupas', x = -20, y = 0.3, width = 350, controls = { { 'lst', id='clothes', width=330, height=390, columns={ {text='Clothes', attr='name', width=0.6}, {text='Wearing', attr='wearing', enablemodify=true, width=0.3} }, rows={ {name='Retrieving clothes list...'} }, onitemclick=clothListClick, onitemdoubleclick=applyClothes, DoubleClickSpamProtected=true, }, {'br'}, {'btn', text='add', text='Adicionar', id='addremove', width=60, onclick=applyClothes, ClickSpamProtected=true}, {'btn', id='close', text='Fechar', closeswindow=true} }, oncreate = clothesInit } function addClothesCommand(cmd, type, model, texture) type = type and tonumber(type) if type and model and texture then server.addPedClothes(localPlayer, texture, model, type) end end function removeClothesCommand(cmd, type) type = type and tonumber(type) if type then server.removePedClothes(localPlayer, type) end end addCommandHandler('removeclothes', removeClothesCommand) addCommandHandler('rc', removeClothesCommand) function playerGravInit() triggerServerEvent('onPlayerGravInit',localPlayer) end addEvent('onClientPlayerGravInit', true) addEventHandler('onClientPlayerGravInit', resourceRoot, function(curgravity) setControlText(wndGravity, 'gravval', string.sub(tostring(curgravity), 1, 6)) end ) function selectPlayerGrav(leaf) setControlNumber(wndGravity, 'gravval', leaf.value) end function applyPlayerGrav() local grav = getControlNumber(wndGravity, 'gravval') if grav then playerGravity = grav server.setPedGravity(localPlayer, grav) end closeWindow(wndGravity) end function setGravityCommand(cmd, grav) local grav = grav and tonumber(grav) if grav then playerGravity = grav server.setPedGravity(localPlayer, tonumber(grav)) end end wndGravity = { 'wnd', text = 'Set gravity', width = 300, controls = { { 'lst', id='gravlist', width=280, height=200, columns={ {text='Gravity', attr='name'} }, rows={ {name='Space', value=0}, {name='Moon', value=0.001}, {name='Normal', value=0.008}, {name='Strong', value=0.015} }, onitemclick=selectPlayerGrav, onitemdoubleclick=applyPlayerGrav, DoubleClickSpamProtected=true, }, {'lbl', text='Exact value: '}, {'txt', id='gravval', text='', width=80}, {'br'}, {'btn', id='ok', onclick=applyPlayerGrav,ClickSpamProtected=true}, {'btn', id='cancel', closeswindow=true} }, oncreate = playerGravInit } local function warpMe(targetPlayer) if not g_settings["warp"] then errMsg("Warping is disallowed!") return end if targetPlayer == localPlayer then errMsg("You can't warp to yourself!") return end if g_PlayerData[targetPlayer].warping then errMsg("This player has disabled warping to them!") return end local vehicle = getPedOccupiedVehicle(targetPlayer) local interior = getElementInterior(targetPlayer) if not vehicle then local vec = targetPlayer.position + targetPlayer.matrix.right*2 local x, y, z = vec.x,vec.y,vec.z if localPlayer.interior ~= interior then fadeCamera(false,1) setTimer(setPlayerInterior,1000,1,x,y,z,interior) else setPlayerPosition(x,y,z) end else server.warpMeIntoVehicle(vehicle) end end function warpInit() setControlText(wndWarp, 'search', '') warpUpdate() end function warpTo(leaf) if not leaf then leaf = getSelectedGridListLeaf(wndWarp, 'playerlist') if not leaf then return end end if isElement(leaf.player) then warpMe(leaf.player) end closeWindow(wndWarp) end function warpUpdate() local function getPlayersByPartName(text) if not text or text == '' then return getElementsByType("player") else local players = {} for _, player in ipairs(getElementsByType("player")) do if string.find(getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):upper(), text:upper(), 1, true) then table.insert(players, player) end end return players end end local text = getControlText(wndWarp, 'search') local players = table.map(getPlayersByPartName(text), function(p) return { player = p, name = getPlayerName(p) } end) table.sort(players, function(a, b) return a.name < b.name end) bindGridListToTable(wndWarp, 'playerlist', players, true) end wndWarp = { 'wnd', text = 'Warp to player', width = 300, controls = { {'txt', id='search', text='', width = 280, onchanged=warpUpdate}, { 'lst', id='playerlist', width=280, height=330, columns={ {text='Player', attr='name'} }, onitemdoubleclick=warpTo, DoubleClickSpamProtected=true, }, {'btn', id='warp', onclick=warpTo, ClickSpamProtected=true}, {'btn', id='cancel', closeswindow=true} }, oncreate = warpInit } function warpToCommand(cmd, player) if player then player = getPlayerFromName(player) if player then warpMe(player) end else createWindow(wndWarp) showCursor(true) end end function initStats() applyToLeaves(getGridListCache(wndStats, 'statslist'), function(leaf) leaf.value = getPedStat(localPlayer, leaf.id) end) end function selectStat(leaf) setControlNumber(wndStats, 'statval', leaf.value) end function maxStat(leaf) setControlNumber(wndStats, 'statval', 1000) applyStat() end function applyStat() local leaf = getSelectedGridListLeaf(wndStats, 'statslist') if not leaf then return end local value = getControlNumber(wndStats, 'statval') if not value then return end leaf.value = value server.setPedStat(localPlayer, leaf.id, value) end wndStats = { 'wnd', text = 'Stats', width = 300, x = -20, y = 0.3, controls = { { 'lst', id='statslist', width=280, columns={ {text='Stat', attr='name', width=0.6}, {text='Value', attr='value', width=0.3, enablemodify=true} }, rows={xml='xml/stats.xml', attrs={'name', 'id'}}, onitemclick=selectStat, onitemdoubleclick=maxStat, DoubleClickSpamProtected=true }, {'txt', id='statval', text='', width=60}, {'btn', id='set', onclick=applyStat, ClickSpamProtected=true}, {'btn', id='close', closeswindow=true} }, oncreate = initStats } local bookmarkList local bookmarks function initBookmarks () bookmarkList = wndBookmarks.controls[1].element if bookmarks then return end loadBookmarks () addEventHandler("onClientGUIDoubleClick",bookmarkList,gotoBookmark) end function loadBookmarks () bookmarks = {} local xml = xmlLoadFile("xml/bookmarks.xml") if not xml then xml = xmlCreateFile("xml/bookmarks.xml","catalog") end guiGridListClear(bookmarkList) for i,child in ipairs (xmlNodeGetChildren(xml) or {}) do local row = guiGridListAddRow(bookmarkList) guiGridListSetItemText(bookmarkList,row,1,tostring(xmlNodeGetAttribute(child,"name")),false,false) guiGridListSetItemText(bookmarkList,row,2,tostring(xmlNodeGetAttribute(child,"zone")),false,false) bookmarks[row+1] = {tonumber(xmlNodeGetAttribute(child,"x")),tonumber(xmlNodeGetAttribute(child,"y")),tonumber(xmlNodeGetAttribute(child,"z"))} end xmlUnloadFile(xml) end function saveBookmarks () if fileExists("xml/bookmarks.xml") then fileDelete("xml/bookmarks.xml") end local xml = xmlCreateFile("xml/bookmarks.xml","catalog") for row=0,(guiGridListGetRowCount(bookmarkList)-1) do local child = xmlCreateChild(xml,"bookmark") xmlNodeSetAttribute(child,"name",guiGridListGetItemText(bookmarkList,row,1)) xmlNodeSetAttribute(child,"zone",guiGridListGetItemText(bookmarkList,row,2)) xmlNodeSetAttribute(child,"x",tostring(bookmarks[row+1][1])) xmlNodeSetAttribute(child,"y",tostring(bookmarks[row+1][2])) xmlNodeSetAttribute(child,"z",tostring(bookmarks[row+1][3])) end xmlSaveFile(xml) xmlUnloadFile(xml) end function saveLocation () local name = getControlText(wndBookmarks,"bookmarkname") if name ~= "" then local x,y,z = getElementPosition(localPlayer) local zone = getZoneName(x,y,z,false) if x and y and z then local row = guiGridListAddRow(bookmarkList) guiGridListSetItemText(bookmarkList,row,1,name,false,false) guiGridListSetItemText(bookmarkList,row,2,zone,false,false) bookmarks[row+1] = {x,y,z} setControlText(wndBookmarks,"bookmarkname","") saveBookmarks() end else errMsg("Please enter a name for the bookmark") end end function deleteLocation () local row,column = guiGridListGetSelectedItem(bookmarkList) if row and row ~= -1 then table.remove(bookmarks,row+1) guiGridListRemoveRow(bookmarkList,row) saveBookmarks() end end function gotoBookmark () local row = guiGridListGetSelectedItem(bookmarkList) if row and row ~= -1 then setPlayerPosition(unpack(bookmarks[row+1])) end end wndBookmarks = { 'wnd', text = 'Bookmarks', width = 400, x = -300, y = 0.2, controls = { { 'lst', id='bookmarklist', width=400, columns={ {text='Name', attr='name', width=0.3}, {text='Zone', attr='zone', width=0.6} } }, {'txt', id='bookmarkname', text='', width=225}, {'btn', id='save current location', onclick=saveLocation, width=150}, {'btn', id='delete selected location', onclick=deleteLocation, width=225}, {'btn', id='close', closeswindow=true, width=150} }, oncreate = initBookmarks } do local screenWidth, screenHeight = guiGetScreenSize() g_MapSide = (screenHeight * 0.85) end function setPosInit() local x, y, z = getElementPosition(localPlayer) setControlNumbers(wndSetPos, { x = x, y = y, z = z }) addEventHandler('onClientRender', root, updatePlayerBlips) end function fillInPosition(relX, relY, btn) if (btn == 'right') then closeWindow (wndSetPos) return end local x = relX*6000 - 3000 local y = 3000 - relY*6000 local hit, hitX, hitY, hitZ hit, hitX, hitY, hitZ = processLineOfSight(x, y, 3000, x, y, -3000) setControlNumbers(wndSetPos, { x = x, y = y, z = hitZ or 0 }) end function setPosClick() if setPlayerPosition(getControlNumbers(wndSetPos, {'x', 'y', 'z'})) ~= false then if getElementInterior(localPlayer) ~= 0 then local vehicle = localPlayer.vehicle if vehicle and vehicle.interior ~= 0 then server.setElementInterior(getPedOccupiedVehicle(localPlayer), 0) local occupants = vehicle.occupants for seat,occupant in pairs(occupants) do if occupant.interior ~= 0 then server.setElementInterior(occupant,0) end end end if localPlayer.interior ~= 0 then server.setElementInterior(localPlayer,0) end end closeWindow(wndSetPos) end end local function forceFade() fadeCamera(false,0) end local function calmVehicle(veh) if not isElement(veh) then return end local z = veh.rotation.z veh.velocity = Vector3(0,0,0) veh.turnVelocity = Vector3(0,0,0) veh.rotation = Vector3(0,0,z) if not (localPlayer.inVehicle and localPlayer.vehicle) then server.warpMeIntoVehicle(veh) end end local function retryTeleport(elem,x,y,z,isVehicle,distanceToGround) local hit, groundX, groundY, groundZ = processLineOfSight(x, y, 3000, x, y, -3000) if hit then local waterZ = getWaterLevel(x, y, 100) z = (waterZ and math.max(groundZ, waterZ) or groundZ) + distanceToGround setElementPosition(elem,x, y, z + distanceToGround) setCameraPlayerMode() setGravity(grav) if isVehicle then server.fadeVehiclePassengersCamera(true) setTimer(calmVehicle,100,1,elem) else fadeCamera(true) end killTimer(g_TeleportTimer) g_TeleportTimer = nil grav = nil end end function setPlayerPosition(x, y, z, skipDeadCheck) local elem = getPedOccupiedVehicle(localPlayer) local isVehicle if elem and getPedOccupiedVehicle(localPlayer) then local controller = getVehicleController(elem) if controller and controller ~= localPlayer then errMsg('Only the driver of the vehicle can set its position.') return false end isVehicle = true else elem = localPlayer isVehicle = false end if isPedDead(localPlayer) and not skipDeadCheck then customSpawnTable = {x,y,z} fadeCamera(false,0) addEventHandler("onClientPreRender",root,forceFade) outputChatBox("You will be respawned to your specified location",0,255,0) return end local distanceToGround = getElementDistanceFromCentreOfMassToBaseOfModel(elem) local hit, hitX, hitY, hitZ = processLineOfSight(x, y, 3000, x, y, -3000) if not hit then if isVehicle then server.fadeVehiclePassengersCamera(false) else fadeCamera(false) end if isTimer(g_TeleportMatrixTimer) then killTimer(g_TeleportMatrixTimer) end g_TeleportMatrixTimer = setTimer(setCameraMatrix, 1000, 1, x, y, z) if not grav then grav = playerGravity setGravity(0.001) end if isTimer(g_TeleportTimer) then killTimer(g_TeleportTimer) end g_TeleportTimer = setTimer(retryTeleport,50,0,elem,x,y,z,isVehicle,distanceToGround) else setElementPosition(elem,x, y, z + distanceToGround) if isVehicle then setTimer(calmVehicle,100,1,elem) end end end local blipPlayers = {} local function destroyBlip() blipPlayers[source] = nil end local function warpToBlip() local wnd = isWindowOpen(wndSpawnMap) and wndSpawnMap or wndSetPos local elem = blipPlayers[source] if isElement(elem) then warpMe(elem) closeWindow(wnd) end end function updatePlayerBlips() if not g_PlayerData then return end local wnd = isWindowOpen(wndSpawnMap) and wndSpawnMap or wndSetPos local mapControl = getControl(wnd, 'map') for elem,player in pairs(g_PlayerData) do if not player.gui.mapBlip then player.gui.mapBlip = guiCreateStaticImage(0, 0, 9, 9, elem == localPlayer and 'localplayerblip.png' or 'playerblip.png', false, mapControl) player.gui.mapLabelShadow = guiCreateLabel(0, 0, 100, 14, player.name, false, mapControl) local labelWidth = guiLabelGetTextExtent(player.gui.mapLabelShadow) guiSetSize(player.gui.mapLabelShadow, labelWidth, 14, false) guiSetFont(player.gui.mapLabelShadow, 'default-bold-small') guiLabelSetColor(player.gui.mapLabelShadow, 255, 255, 255) player.gui.mapLabel = guiCreateLabel(0, 0, labelWidth, 14, player.name, false, mapControl) guiSetFont(player.gui.mapLabel, 'default-bold-small') guiLabelSetColor(player.gui.mapLabel, 0, 0, 0) for i,name in ipairs({'mapBlip', 'mapLabelShadow'}) do blipPlayers[player.gui[name]] = elem addEventHandler('onClientGUIDoubleClick', player.gui[name],warpToBlip,false) addEventHandler("onClientElementDestroy", player.gui[name],destroyBlip) end end local x, y = getElementPosition(elem) local visible = (localPlayer.interior == elem.interior and localPlayer.dimension == elem.dimension) x = math.floor((x + 3000) * g_MapSide / 6000) - 4 y = math.floor((3000 - y) * g_MapSide / 6000) - 4 guiSetPosition(player.gui.mapBlip, x, y, false) guiSetPosition(player.gui.mapLabelShadow, x + 14, y - 4, false) guiSetPosition(player.gui.mapLabel, x + 13, y - 5, false) guiSetVisible(player.gui.mapBlip,visible) guiSetVisible(player.gui.mapLabelShadow,visible) guiSetVisible(player.gui.mapLabel,visible) end end function updateName(oldNick, newNick) if (not g_PlayerData) then return end local source = getElementType(source) == "player" and source or oldNick local player = g_PlayerData[source] player.name = newNick if player.gui.mapLabel then guiSetText(player.gui.mapLabelShadow, newNick) guiSetText(player.gui.mapLabel, newNick) local labelWidth = guiLabelGetTextExtent(player.gui.mapLabelShadow) guiSetSize(player.gui.mapLabelShadow, labelWidth, 14, false) guiSetSize(player.gui.mapLabel, labelWidth, 14, false) end end addEventHandler('onClientPlayerChangeNick', root,updateName) function closePositionWindow() removeEventHandler('onClientRender', root, updatePlayerBlips) end wndSetPos = { 'wnd', text = 'Set position', width = g_MapSide + 20, controls = { {'img', id='map', src='map.png', width=g_MapSide, height=g_MapSide, onclick=fillInPosition, ondoubleclick=setPosClick, DoubleClickSpamProtected=true}, {'txt', id='x', text='', width=60}, {'txt', id='y', text='', width=60}, {'txt', id='z', text='', width=60}, {'btn', id='ok', onclick=setPosClick, ClickSpamProtected=true}, {'btn', id='cancel', closeswindow=true}, {'lbl', text='Right click on map to close'} }, oncreate = setPosInit, onclose = closePositionWindow } function getPosCommand(cmd, playerName) local player, sentenceStart if playerName then player = getPlayerFromName(playerName) if not player then errMsg('There is no player named "' .. playerName .. '".') return end playerName = getPlayerName(player) -- make sure case is correct sentenceStart = playerName .. ' is ' else player = localPlayer sentenceStart = 'You are ' end local px, py, pz = getElementPosition(player) local vehicle = getPedOccupiedVehicle(player) if vehicle then outputChatBox(sentenceStart .. 'in a ' .. getVehicleName(vehicle), 0, 255, 0) else outputChatBox(sentenceStart .. 'on foot', 0, 255, 0) end outputChatBox(sentenceStart .. 'at {' .. string.format("%.5f", px) .. ', ' .. string.format("%.5f", py) .. ', ' .. string.format("%.5f", pz) .. '}', 0, 255, 0) end addCommandHandler('getpos', getPosCommand) addCommandHandler('gp', getPosCommand) function setPosCommand(cmd, x, y, z, r) local x, y, z, r = string.gsub(x or "", ",", " "), string.gsub(y or "", ",", " "), string.gsub(z or "", ",", " "), string.gsub(r or "", ",", " ") if (x and y == "" and not tonumber(x)) then x, y, z, r = unpack(split(x, " ")) end local px, py, pz = getElementPosition(localPlayer) local pr = getPedRotation(localPlayer) local message = "" message = message .. (tonumber(x) and "" or "X ") message = message .. (tonumber(y) and "" or "Y ") message = message .. (tonumber(z) and "" or "Z ") if (message ~= "") then outputChatBox(message.."arguments were not provided. Using your current "..message.."values instead.", 255, 255, 0) end setPlayerPosition(tonumber(x) or px, tonumber(y) or py, tonumber(z) or pz) if (isPedInVehicle(localPlayer)) then local vehicle = getPedOccupiedVehicle(localPlayer) if (vehicle and isElement(vehicle) and getVehicleController(vehicle) == localPlayer) then setElementRotation(vehicle, 0, 0, tonumber(r) or pr) end else setPedRotation(localPlayer, tonumber(r) or pr) end end function warpMapInit() addEventHandler('onClientRender', root, updatePlayerBlips) end function spawnMapDoubleClick(relX, relY) setPlayerPosition(relX*6000 - 3000, 3000 - relY*6000, 0) closeWindow(wndSpawnMap) end function closeSpawnMap() showCursor(false) removeEventHandler('onClientRender', root, updatePlayerBlips) for elem,data in pairs(g_PlayerData) do for i,name in ipairs({'mapBlip', 'mapLabelShadow', 'mapLabel'}) do if data.gui[name] then destroyElement(data.gui[name]) data.gui[name] = nil end end end end wndSpawnMap = { 'wnd', text = 'Select spawn position', width = g_MapSide + 20, controls = { {'img', id='map', src='map.png', width=g_MapSide, height=g_MapSide, ondoubleclick=spawnMapDoubleClick}, {'lbl', text='Welcome to freeroam. Double click a location on the map to spawn.', width=g_MapSide-60, align='center'}, {'btn', id='close', closeswindow=true} }, oncreate = warpMapInit, onclose = closeSpawnMap } local function setPositionAfterInterior(x,y,z) setPlayerPosition(x,y,z) setCameraTarget(localPlayer) fadeCamera(true) end function setPlayerInterior(x,y,z,i) setCameraMatrix(x,y,z) setCameraInterior(i) server.setElementInterior(localPlayer, i) setTimer(setPositionAfterInterior,1000,1,x,y,z) end function setInterior(leaf) local vehicle = getPedOccupiedVehicle(localPlayer) if vehicle and getVehicleController (vehicle) ~= localPlayer then errMsg("* Only the driver may set interior/dimension") return end if vehicle then server.setElementInterior(vehicle, leaf.world) for i=0,getVehicleMaxPassengers(vehicle) do local player = getVehicleOccupant(vehicle, i) if player and player ~= localPlayer then server.setElementInterior(player, leaf.world) server.setCameraInterior(player, leaf.world) end end end fadeCamera(false) setTimer(setPlayerInterior,1000,1,leaf.posX, leaf.posY, leaf.posZ, leaf.world) closeWindow(wndSetInterior) end wndSetInterior = { 'wnd', text = 'Set interior', width = 250, controls = { { 'lst', id='interiors', width=230, height=300, columns={ {text='Interior', attr='name'} }, rows={xml='xml/interiors.xml', attrs={'name', 'posX', 'posY', 'posZ', 'world'}}, onitemdoubleclick=setInterior, DoubleClickSpamProtected=true, }, {'btn', id='close', closeswindow=true} } } function toggleFallOffBike() setPedCanBeKnockedOffBike(localPlayer, guiCheckBoxGetSelected(getControl(wndMain, 'falloff'))) end function createSelectedVehicle(leaf) if not leaf then leaf = getSelectedGridListLeaf(wndCreateVehicle, 'vehicles') if not leaf then return end end server.giveMeVehicles(leaf.id) end wndCreateVehicle = { 'wnd', text = 'Painel de Veículos', width = 300, controls = { { 'lst', id='vehicles', width=280, height=340, columns={ {text='Vehicle', attr='name'} }, rows={xml='xml/vehicles.xml', attrs={'id', 'name'}}, onitemdoubleclick=createSelectedVehicle, DoubleClickSpamProtected=true, }, {'btn', id='create', text='Criar', onclick=createSelectedVehicle, ClickSpamProtected=true}, {'btn', id='enableModel', text='Ativar', onclick=createSelectedVehicle, ClickSpamProtected=true}, {'btn', id='disableModel', text='Desativar', onclick=createSelectedVehicle, ClickSpamProtected=true}, {'btn', id='close', text='Fechar', closeswindow=true} } } function createVehicleCommand(cmd, ...) local args = {...} vehID = getVehicleModelFromName(table.concat(args," ")) or tonumber(args[1]) and math.floor(tonumber(args[1])) or false if vehID and vehID >= 400 and vehID <= 611 then server.giveMeVehicles(vehID) else errMsg("Invalid vehicle model") end end function repairVehicle() local vehicle = getPedOccupiedVehicle(localPlayer) if vehicle then server.fixVehicle(vehicle) end end function flipVehicle() local vehicle = getPedOccupiedVehicle(localPlayer) if vehicle then local rX, rY, rZ = getElementRotation(vehicle) setElementRotation(vehicle, 0, 0, (rX > 90 and rX < 270) and (rZ + 180) or rZ) end end function upgradesInit() local vehicle = getPedOccupiedVehicle(localPlayer) if not vehicle then errMsg('Please enter a vehicle to change the upgrades of.') closeWindow(wndUpgrades) return end local installedUpgrades = getVehicleUpgrades(vehicle) local compatibleUpgrades = {} local slotName, group for i,upgrade in ipairs(getVehicleCompatibleUpgrades(vehicle)) do slotName = getVehicleUpgradeSlotName(upgrade) group = table.find(compatibleUpgrades, 'name', slotName) if not group then group = { 'group', name = slotName, children = {} } table.insert(compatibleUpgrades, group) else group = compatibleUpgrades[group] end table.insert(group.children, { id = upgrade, installed = table.find(installedUpgrades, upgrade) ~= false }) end table.sort(compatibleUpgrades, function(a, b) return a.name < b.name end) bindGridListToTable(wndUpgrades, 'upgradelist', compatibleUpgrades, true) end function selectUpgrade(leaf) setControlText(wndUpgrades, 'addremove', leaf.installed and 'remove' or 'add') end function addRemoveUpgrade(selUpgrade) local vehicle = getPedOccupiedVehicle(localPlayer) if not vehicle then return end if not selUpgrade then selUpgrade = getSelectedGridListLeaf(wndUpgrades, 'upgradelist') if not selUpgrade then return end end if selUpgrade.installed then selUpgrade.installed = false setControlText(wndUpgrades, 'addremove', 'add') server.removeVehicleUpgrade(vehicle, selUpgrade.id) else local prevUpgradeIndex = table.find(selUpgrade.siblings, 'installed', true) if prevUpgradeIndex then selUpgrade.siblings[prevUpgradeIndex].installed = false end selUpgrade.installed = true setControlText(wndUpgrades, 'addremove', 'remove') server.addVehicleUpgrade(vehicle, selUpgrade.id) end end wndUpgrades = { 'wnd', text = 'Vehicle upgrades', width = 300, x = -20, y = 0.3, controls = { { 'lst', id='upgradelist', width=280, height=340, columns={ {text='Upgrade', attr='id', width=0.6}, {text='Installed', attr='installed', width=0.3, enablemodify=true} }, onitemclick=selectUpgrade, onitemdoubleclick=addRemoveUpgrade, DoubleClickSpamProtected=true }, {'btn', id='addremove', text='add', width=60, onclick=addRemoveUpgrade,ClickSpamProtected=true}, {'btn', id='ok', closeswindow=true} }, oncreate = upgradesInit } function addUpgradeCommand(cmd, upgrade) local vehicle = getPedOccupiedVehicle(localPlayer) if vehicle and upgrade then server.addVehicleUpgrade(vehicle, tonumber(upgrade) or 0) end end addCommandHandler('addupgrade', addUpgradeCommand) addCommandHandler('au', addUpgradeCommand) function removeUpgradeCommand(cmd, upgrade) local vehicle = getPedOccupiedVehicle(localPlayer) if vehicle and upgrade then server.removeVehicleUpgrade(vehicle, tonumber(upgrade) or 0) end end function forceLightsOn() local vehicle = getPedOccupiedVehicle(localPlayer) if not vehicle then return end if guiCheckBoxGetSelected(getControl(wndMain, 'lightson')) then server.setVehicleOverrideLights(vehicle, 2) guiCheckBoxSetSelected(getControl(wndMain, 'lightsoff'), false) else server.setVehicleOverrideLights(vehicle, 0) end end function forceLightsOff() local vehicle = getPedOccupiedVehicle(localPlayer) if not vehicle then return end if guiCheckBoxGetSelected(getControl(wndMain, 'lightsoff')) then server.setVehicleOverrideLights(vehicle, 1) guiCheckBoxSetSelected(getControl(wndMain, 'lightson'), false) else server.setVehicleOverrideLights(vehicle, 0) end end function setColorCommand(cmd, ...) local vehicle = getPedOccupiedVehicle(localPlayer) if not vehicle then return end local colors = { getVehicleColor(vehicle) } local args = { ... } for i=1,12 do colors[i] = args[i] and tonumber(args[i]) or colors[i] end server.setVehicleColor(vehicle, unpack(colors)) end function openColorPicker() editingVehicle = getPedOccupiedVehicle(localPlayer) if (editingVehicle) then colorPicker.openSelect(colors) end end function closedColorPicker() local r1, g1, b1, r2, g2, b2, r3, g3, b3, r4, g4, b4 = getVehicleColor(editingVehicle, true) server.setVehicleColor(editingVehicle, r1, g1, b1, r2, g2, b2, r3, g3, b3, r4, g4, b4) local r, g, b = getVehicleHeadLightColor(editingVehicle) server.setVehicleHeadLightColor(editingVehicle, r, g, b) editingVehicle = nil end function updateColor() if (not colorPicker.isSelectOpen) then return end local r, g, b = colorPicker.updateTempColors() if (editingVehicle and isElement(editingVehicle)) then local r1, g1, b1, r2, g2, b2, r3, g3, b3, r4, g4, b4 = getVehicleColor(editingVehicle, true) if (guiCheckBoxGetSelected(checkColor1)) then r1, g1, b1 = r, g, b end if (guiCheckBoxGetSelected(checkColor2)) then r2, g2, b2 = r, g, b end if (guiCheckBoxGetSelected(checkColor3)) then r3, g3, b3 = r, g, b end if (guiCheckBoxGetSelected(checkColor4)) then r4, g4, b4 = r, g, b end if (guiCheckBoxGetSelected(checkColor5)) then setVehicleHeadLightColor(editingVehicle, r, g, b) end setVehicleColor(editingVehicle, r1, g1, b1, r2, g2, b2, r3, g3, b3, r4, g4, b4) end end addEventHandler("onClientRender", root, updateColor) function paintjobInit() local vehicle = getPedOccupiedVehicle(localPlayer) if not vehicle then errMsg('You need to be in a car to change its paintjob.') closeWindow(wndPaintjob) return end local paint = getVehiclePaintjob(vehicle) if paint then guiGridListSetSelectedItem(getControl(wndPaintjob, 'paintjoblist'), paint+1, 1) end end function applyPaintjob(paint) server.setVehiclePaintjob(getPedOccupiedVehicle(localPlayer), paint.id) end wndPaintjob = { 'wnd', text = 'Car paintjob', width = 220, x = -20, y = 0.3, controls = { { 'lst', id='paintjoblist', width=200, height=130, columns={ {text='Paintjob ID', attr='id'} }, rows={ {id=0}, {id=1}, {id=2}, {id=3} }, onitemclick=applyPaintjob, ClickSpamProtected=true, ondoubleclick=function() closeWindow(wndPaintjob) end }, {'btn', id='close', closeswindow=true}, }, oncreate = paintjobInit } function setPaintjobCommand(cmd, paint) local vehicle = getPedOccupiedVehicle(localPlayer) paint = paint and tonumber(paint) if not paint or not vehicle then return end server.setVehiclePaintjob(vehicle, paint) end function timeInit() local hours, minutes = getTime() setControlNumbers(wndTime, { hours = hours, minutes = minutes }) end function selectTime(leaf) setControlNumbers(wndTime, { hours = leaf.h, minutes = leaf.m }) end function applyTime() local hours, minutes = getControlNumbers(wndTime, { 'hours', 'minutes' }) setTime(hours, minutes) closeWindow(wndTime) end wndTime = { 'wnd', text = 'Set time', width = 220, controls = { { 'lst', id='timelist', width=200, height=150, columns={ {text='Time', attr='name'} }, rows={ {name='Midnight', h=0, m=0}, {name='Dawn', h=5, m=0}, {name='Morning', h=9, m=0}, {name='Noon', h=12, m=0}, {name='Afternoon', h=15, m=0}, {name='Evening', h=20, m=0}, {name='Night', h=22, m=0} }, onitemclick=selectTime, ondoubleclick=applyTime }, {'txt', id='hours', text='', width=40}, {'lbl', text=':'}, {'txt', id='minutes', text='', width=40}, {'btn', id='ok', onclick=applyTime}, {'btn', id='cancel', closeswindow=true} }, oncreate = timeInit } function setTimeCommand(cmd, hours, minutes) if not hours then return end local curHours, curMinutes = getTime() hours = tonumber(hours) or curHours minutes = minutes and tonumber(minutes) or curMinutes setTime(hours, minutes) end addCommandHandler('settime', setTimeCommand) addCommandHandler('st', setTimeCommand) function toggleFreezeTime() local state = guiCheckBoxGetSelected(getControl(wndMain, 'freezetime')) guiCheckBoxSetSelected(getControl(wndMain, 'freezetime'), not state) setTimeFrozen(state) end function setTimeFrozen(state, h, m, w) guiCheckBoxSetSelected(getControl(wndMain, 'freezetime'), state) if state then if not g_TimeFreezeTimer then g_TimeFreezeTimer = setTimer(function() setTime(h, m) setWeather(w) end, 5000, 0) setMinuteDuration(9001) end else if g_TimeFreezeTimer then killTimer(g_TimeFreezeTimer) g_TimeFreezeTimer = nil end setMinuteDuration(1000) end end function applyWeather(leaf) if not leaf then leaf = getSelectedGridListLeaf(wndWeather, 'weatherlist') if not leaf then return end end setWeather(leaf.id) closeWindow(wndWeather) end wndWeather = { 'wnd', text = 'Set weather', width = 250, controls = { { 'lst', id='weatherlist', width=230, height=290, columns = { {text='Weather type', attr='name'} }, rows={xml='xml/weather.xml', attrs={'id', 'name'}}, onitemdoubleclick=applyWeather }, {'btn', id='ok', onclick=applyWeather}, {'btn', id='cancel', closeswindow=true} } } function setWeatherCommand(cmd, weather) weather = weather and tonumber(weather) if weather then setWeather(weather) end end function setMyGameSpeed(speed) speed = speed and tonumber(speed) or 1 if g_settings["gamespeed/enabled"] then if speed > g_settings["gamespeed/max"] then errMsg(('Maximum allowed gamespeed is %.5f'):format(g_settings['gamespeed/max'])) elseif speed < g_settings["gamespeed/min"] then errMsg(('Minimum allowed gamespeed is %.5f'):format(g_settings['gamespeed/min'])) else setGameSpeed(speed) end else errMsg("Setting game speed is disallowed!") end end function gameSpeedInit() setControlNumber(wndGameSpeed, 'speed', getGameSpeed()) end function selectGameSpeed(leaf) setControlNumber(wndGameSpeed, 'speed', leaf.id) end function applyGameSpeed() speed = getControlNumber(wndGameSpeed, 'speed') if speed then setMyGameSpeed(speed) end closeWindow(wndGameSpeed) end wndGameSpeed = { 'wnd', text = 'Set game speed', width = 220, controls = { { 'lst', id='speedlist', width=200, height=150, columns={ {text='Speed', attr='name'} }, rows={ {id=3, name='3x'}, {id=2, name='2x'}, {id=1, name='1x'}, {id=0.5, name='0.5x'} }, onitemclick=selectGameSpeed, ondoubleclick=applyGameSpeed }, {'txt', id='speed', text='', width=40}, {'btn', id='ok', onclick=applyGameSpeed}, {'btn', id='cancel', closeswindow=true} }, oncreate = gameSpeedInit } function setGameSpeedCommand(cmd, speed) speed = speed and tonumber(speed) if speed then setMyGameSpeed(speed) end end function updateGUI(updateVehicle) if updateVehicle then local vehicle = getPedOccupiedVehicle(localPlayer) if vehicle and isElement(vehicle) then setControlText(wndMain, 'curvehicle', getVehicleName(vehicle)) else setControlText(wndMain, 'curvehicle', 'De apé') end end end function mainWndShow() if not getPedOccupiedVehicle(localPlayer) then end updateTimer = updateTimer or setTimer(updateGUI, 2000, 0) updateGUI(true) end function mainWndClose() killTimer(updateTimer) updateTimer = nil colorPicker.closeSelect() end function hasDriverGhost(vehicle) if not g_PlayerData then return end if not isElement(vehicle) then return end if getElementType(vehicle) ~= "vehicle" then return end local driver = getVehicleController(vehicle) if g_PlayerData[driver] and g_PlayerData[driver].ghostmode then return true end return false end function onEnterVehicle(vehicle,seat) if source == localPlayer then setControlText(wndMain, 'curvehicle', getVehicleName(vehicle)) guiCheckBoxSetSelected(getControl(wndMain, 'lightson'), getVehicleOverrideLights(vehicle) == 2) guiCheckBoxSetSelected(getControl(wndMain, 'lightsoff'), getVehicleOverrideLights(vehicle) == 1) end if seat == 0 and g_PlayerData[source] then setVehicleGhost(vehicle,hasDriverGhost(vehicle)) end end function onExitVehicle(vehicle,seat) if eventName == "onClientPlayerVehicleExit" and source == localPlayer then setControlText(wndMain, 'curvehicle', 'De apé') closeWindow(wndUpgrades) closeWindow(wndColor) elseif vehicle and seat == 0 then if source and g_PlayerData[source] then setVehicleGhost(vehicle,hasDriverGhost(vehicle)) end end end function killLocalPlayer() if g_settings["kill"] then setElementHealth(localPlayer,0) else errMsg("Killing yourself is disallowed!") end end function alphaCommand(command, alpha) alpha = alpha and tonumber(alpha) or 255 if alpha >= 0 and alpha <= 255 then server.setElementAlpha(localPlayer, alpha) end end addCommandHandler('alpha', alphaCommand) addCommandHandler('ap', alphaCommand) addCommandHandler('kill', killLocalPlayer) wndMain = { 'wnd', text = 'PAINEL DO JOGADOR', x = 10, y = 150, width = 295, controls = { {'img', id='kill', src='imagens/Morrer.png', width=64, height=64, onclick=killLocalPlayer}, {'img', id='skin', src='imagens/Skins.png', width=64, height=64, window=wndSkin}, {'img', id='anim', src='imagens/Animacao.png', width=64, height=64, window=wndAnim}, {'img', id='weapon', src='imagens/Armas.png', width=64, height=64, window=wndWeapon}, {'img', id='clothes', src='imagens/Roupas.png', width=64, height=64, window=wndClothes}, {'img', id='createvehicle', src='imagens/Veiculos.png', width=64, height=64, window=wndCreateVehicle}, {'br'}, {'chk', id='falloff', text='Não Cair da moto', onclick=toggleFallOffBike}, {'lbl', text='Veículo Atual:'}, {'lbl', id='curvehicle'}, {'br'}, {'btn', id='repair', text='Reparar', width=64, onclick=repairVehicle}, {'btn', id='flip', text='Virar', width=64, onclick=flipVehicle}, {'btn', id='upgrades', text='Equipar', width=64, window=wndUpgrades}, {'btn', id='color', text='Cores', width=64, onclick=openColorPicker}, {'btn', id='paintjob', text='Pinturas', width=64, window=wndPaintjob}, {'br'}, {'chk', id='lightson', text='Farol Ligado', onclick=forceLightsOn}, {'chk', id='lightsoff', text='Falol Desligado', onclick=forceLightsOff} }, oncreate = mainWndShow, onclose = mainWndClose } disableBySetting = {} function errMsg(msg) outputChatBox(msg,255,0,0) end addEventHandler('onClientResourceStart', resourceRoot, function() fadeCamera(true) setTimer(getPlayers, 1000, 1) setJetpackMaxHeight ( 9001 ) triggerServerEvent('onLoadedAtClient', resourceRoot) createWindow(wndMain) hideAllWindows() bindKey('f1', 'down', toggleFRWindow) --guiCheckBoxSetSelected(getControl(wndMain, 'falloff'), canPedBeKnockedOffBike(localPlayer)) end ) function showWelcomeMap() createWindow(wndSpawnMap) showCursor(true) end function showMap() createWindow(wndSetPos) showCursor(true) end function toggleFRWindow() if isWindowOpen(wndMain) then showCursor(false) hideAllWindows() colorPicker.closeSelect() playSound("Som/Acma.mp3") else if guiGetInputMode() ~= "no_binds_when_editing" then guiSetInputMode("no_binds_when_editing") end showCursor(true) showAllWindows() playSound("Som/Acma.mp3") end end addCommandHandler('fr', toggleFRWindow) function getPlayers() g_PlayerData = {} table.each(getElementsByType('player'), joinHandler) end function joinHandler(player) if (not g_PlayerData) then return end g_PlayerData[player or source] = { name = getPlayerName(player or source), gui = {} } end function quitHandler() if (not g_PlayerData) then return end local veh = getPedOccupiedVehicle(source) local seat = (veh and getVehicleController(veh) == localPlayer) and 0 or 1 if seat == 0 then onExitVehicle(veh,0) end table.each(g_PlayerData[source].gui, destroyElement) g_PlayerData[source] = nil end function wastedHandler() if source == localPlayer then onExitVehicle() if g_settings["spawnmapondeath"] then setTimer(showMap,2000,1) end else local veh = getPedOccupiedVehicle(source) local seat = (veh and getVehicleController(veh) == localPlayer) and 0 or 1 if seat == 0 then onExitVehicle(veh,0) end end end local function removeForcedFade() removeEventHandler("onClientPreRender",root,forceFade) end local function checkCustomSpawn() if type(customSpawnTable) == "table" then local x,y,z = unpack(customSpawnTable) setPlayerPosition(x,y,z,true) customSpawnTable = false setTimer(removeForcedFade,100,1) end end addEventHandler('onClientPlayerJoin', root, joinHandler) addEventHandler('onClientPlayerQuit', root, quitHandler) addEventHandler('onClientPlayerWasted', root, wastedHandler) addEventHandler('onClientPlayerVehicleEnter', root, onEnterVehicle) addEventHandler('onClientPlayerVehicleExit', root, onExitVehicle) addEventHandler("onClientPlayerSpawn", localPlayer, checkCustomSpawn) function getPlayerName(player) return g_settings["removeHex"] and player.name:gsub("#%x%x%x%x%x%x","") or player.name end addEventHandler('onClientResourceStop', resourceRoot, function() showCursor(false) setPedAnimation(localPlayer, false) end ) function setVehicleGhost(sourceVehicle,value) local vehicles = getElementsByType("vehicle") for _,vehicle in ipairs(vehicles) do local vehicleGhost = hasDriverGhost(vehicle) setElementCollidableWith(sourceVehicle,vehicle,not value) setElementCollidableWith(vehicle,sourceVehicle,not value) if value == false and vehicleGhost == true then setElementCollidableWith(sourceVehicle,vehicle,not vehicleGhost) setElementCollidableWith(vehicle,sourceVehicle,not vehicleGhost) end end end local function onStreamIn() if source.type ~= "vehicle" then return end setVehicleGhost(source,hasDriverGhost(source)) end local function onLocalSettingChange(key,value) g_PlayerData[source][key] = value if key == "ghostmode" then local sourceVehicle = getPedOccupiedVehicle(source) if sourceVehicle then setVehicleGhost(sourceVehicle,hasDriverGhost(sourceVehicle)) end end end local function renderKnifingTag() if not g_PlayerData then return end for _,p in ipairs (getElementsByType ("player", root, true)) do if g_PlayerData[p] and g_PlayerData[p].knifing then local px,py,pz = getElementPosition(p) local x,y,d = getScreenFromWorldPosition (px, py, pz+1.3) if x and y and d < 20 then dxDrawText ("Disabled Knifing", x+1, y+1, x, y, tocolor (0, 0, 0), 0.5, "bankgothic", "center") dxDrawText ("Disabled Knifing", x, y, x, y, tocolor (220, 220, 0), 0.5, "bankgothic", "center") end end end end addEventHandler ("onClientRender", root, renderKnifingTag) addEvent("onClientFreeroamLocalSettingChange",true) addEventHandler("onClientFreeroamLocalSettingChange",root,onLocalSettingChange) addEventHandler("onClientPlayerStealthKill",localPlayer,cancelKnifeEvent) addEventHandler("onClientElementStreamIn",root,onStreamIn)
  8. Opa o painel freeroam que eu estou usando o player pode bugar dentro das bases corps gangues o jogador da spawn em um carro o carro ja vem com jogador dentro do veiculo Tipo assim Quero dar spawn assim Vou dar um spawn em algum veiculo vou apertar f1 em carros seleciono algum carro ao inves do jogador apareçer dentro do carro quero q o jogador de spawn sem estar dentro do carro o carro apareçe ao lado dele codigos fr_client.Lua local Vermelho = 250 local Verde = 250 local Azul = 0 addEventHandler("onClientGUIClick",root, function () if ( source == getControl(wndCreateVehicle,"vehicles") ) then for row=0, guiGridListGetRowCount(getControl(wndCreateVehicle, "vehicles")) do guiGridListSetItemColor(getControl(wndCreateVehicle, "vehicles"),row,1,1,120,253) end end end ) CONTROL_MARGIN_RIGHT = 5 LINE_MARGIN = 5 LINE_HEIGHT = 16 g_Root = getRootElement() g_ResRoot = getResourceRootElement(getThisResource()) g_Me = getLocalPlayer() server = createServerCallInterface() guiSetInputMode("no_binds_when_editing") --------------------------- -- Set skin window --------------------------- function skinInit() setControlNumber(wndSkin, 'skinid', getElementModel(g_Me)) end function showSkinID(leaf) if leaf.id then setControlNumber(wndSkin, 'skinid', leaf.id) end end function applySkin() local skinID = getControlNumber(wndSkin, 'skinid') if skinID then server.setMySkin(skinID) fadeCamera(true) end end wndSkin = { 'wnd', text = 'Personagens', width = 250, x = -20, y = 0.3, controls = { { 'lst', id='skinlist', width=230, height=290, columns={ {text='Skin', attr='name'} }, rows={xml='skins.xml', attrs={'id', 'name'}}, onitemclick=showSkinID, onitemdoubleclick=applySkin }, {'txt', id='skinid', text='', width=0}, {'btn', id='set', onclick=applySkin}, {'btn', id='close', closeswindow=true} }, oncreate = skinInit } function setSkinCommand(cmd, skin) skin = skin and tonumber(skin) if skin then server.setMySkin(skin) fadeCamera(true) closeWindow(wndSpawnMap) closeWindow(wndSetPos) end end --------------------------- --- Set animation window --------------------------- function applyAnimation(leaf) if type(leaf) ~= 'table' then leaf = getSelectedGridListLeaf(wndAnim, 'animlist') if not leaf then return end end server.setPedAnimation(g_Me, leaf.parent.name, leaf.name, true, true) end function stopAnimation() server.setPedAnimation(g_Me, false) end wndAnim = { 'wnd', text = 'Animações', width = 250, x = -20, y = 0.3, controls = { { 'lst', id='animlist', width=230, height=290, columns={ {text='Animações', attr='name'} }, rows={xml='animations.xml', attrs={'name'}}, expandlastlevel=false, onitemdoubleclick=applyAnimation }, {'btn', id='Animar', onclick=applyAnimation}, {'btn', id='Parar', onclick=stopAnimation}, {'btn', id='Fechar', closeswindow=true} } } addCommandHandler('anim', function(command, lib, name) server.setPedAnimation(g_Me, lib, name, true, true) end ) --------------------------- -- Weapon window --------------------------- function addWeapon(leaf, amount) if type(leaf) ~= 'table' then leaf = getSelectedGridListLeaf(wndWeapon, 'weaplist') amount = getControlNumber(wndWeapon, 'amount') if not amount or not leaf then return end end server.giveMeWeapon(leaf.id, amount) end wndWeapon = { 'wnd', text = 'Armamento', width = 250, controls = { { 'lst', id='weaplist', width=230, height=280, columns={ {text='Arma', attr='name'} }, rows={xml='weapons.xml', attrs={'id', 'name'}}, onitemdoubleclick=function(leaf) addWeapon(leaf, 500) end }, {'br'}, {'txt', id='amount', text='500', width=60}, {'btn', id='Pegar', onclick=addWeapon}, {'btn', id='Fechar', closeswindow=true} } } function giveWeaponCommand(cmd, weapon, amount) weapon = tonumber(weapon) or getWeaponIDFromName(weapon) if not weapon then return end amount = amount and tonumber(amount) or 500 server.giveMeWeapon(math.floor(weapon), amount) end --------------------------- -- Fighting style --------------------------- addCommandHandler('luta', function(cmd, style) style = style and tonumber(style) if style then server.setPedFightingStyle(g_Me, style) end end ) --------------------------- -- Clothes window --------------------------- function clothesInit() if getElementModel(g_Me) ~= 0 then errMsg('Você precisa do CJ para trocar de roupas.') closeWindow(wndClothes) return end if not g_Clothes then triggerServerEvent('onClothesInit', g_Me) end end addEvent('onClientClothesInit', true) addEventHandler('onClientClothesInit', g_Root, function(clothes) g_Clothes = clothes.allClothes for i,typeGroup in ipairs(g_Clothes) do for j,cloth in ipairs(typeGroup.children) do if not cloth.name then cloth.name = cloth.model .. ' - ' .. cloth.texture end cloth.wearing = clothes.playerClothes[typeGroup.type] and clothes.playerClothes[typeGroup.type].texture == cloth.texture and clothes.playerClothes[typeGroup.type].model == cloth.model or false end table.sort(typeGroup.children, function(a, b) return a.name < b.name end) end bindGridListToTable(wndClothes, 'clothes', g_Clothes, false) end ) function clothListClick(cloth) setControlText(wndClothes, 'addremove', cloth.wearing and 'Remover' or 'Adicionar') end function applyClothes(cloth) if not cloth then cloth = getSelectedGridListLeaf(wndClothes, 'clothes') if not cloth then return end end if cloth.wearing then cloth.wearing = false setControlText(wndClothes, 'addremove', 'Adicionar') server.removePlayerClothes(g_Me, cloth.parent.type) else local prevClothIndex = table.find(cloth.siblings, 'wearing', true) if prevClothIndex then cloth.siblings[prevClothIndex].wearing = false end cloth.wearing = true setControlText(wndClothes, 'addremove', 'Remover') server.addPedClothes(g_Me, cloth.texture, cloth.model, cloth.parent.type) end end wndClothes = { 'wnd', text = 'Clothes', x = -20, y = 0.3, width = 350, controls = { { 'lst', id='clothes', width=330, height=390, columns={ {text='Roupas', attr='name', width=0.6}, {text='Wearing', attr='wearing', enablemodify=true, width=0.3} }, rows={ {name='Retrieving clothes list...'} }, onitemclick=clothListClick, onitemdoubleclick=applyClothes }, {'br'}, {'btn', text='Adicionar', id='addremove', width=60, onclick=applyClothes}, {'btn', id='Fechar', closeswindow=true} }, oncreate = clothesInit } function addClothesCommand(cmd, type, model, texture) type = type and tonumber(type) if type and model and texture then server.addPedClothes(g_Me, texture, model, type) end end addCommandHandler('addclothes', addClothesCommand) addCommandHandler('ac', addClothesCommand) function removeClothesCommand(cmd, type) type = type and tonumber(type) if type then server.removePlayerClothes(g_Me, type) end end addCommandHandler('removeclothes', removeClothesCommand) addCommandHandler('rc', removeClothesCommand) --------------------------- -- Stats window --------------------------- function initStats() applyToLeaves(getGridListCache(wndStats, 'statslist'), function(leaf) leaf.value = getPedStat(g_Me, leaf.id) end) end function selectStat(leaf) setControlNumber(wndStats, 'statval', leaf.value) end function maxStat(leaf) setControlNumber(wndStats, 'statval', 1000) applyStat() end function applyStat() local leaf = getSelectedGridListLeaf(wndStats, 'statslist') if not leaf then return end local value = getControlNumber(wndStats, 'statval') if not value then return end leaf.value = value server.setPedStat(g_Me, leaf.id, value) end wndStats = { 'wnd', text = 'Habilidade', width = 300, x = -20, y = 0.3, controls = { { 'lst', id='statslist', width=280, columns={ {text='Habilidade', attr='name', width=0.6}, {text='Quantidade', attr='value', width=0.3, enablemodify=true} }, rows={xml='stats.xml', attrs={'name', 'id'}}, onitemclick=selectStat, onitemdoubleclick=maxStat }, {'txt', id='statval', text='', width=60}, {'btn', id='Definir', onclick=applyStat}, {'btn', id='Fechar', closeswindow=true} }, oncreate = initStats } --------------------------- -- Fall off bike toggle --------------------------- function toggleFallOffBike() setPedCanBeKnockedOffBike(g_Me, guiCheckBoxGetSelected(getControl(wndMain, 'falloff'))) end --------------------------- -- Create vehicle window --------------------------- function createSelectedVehicle(leaf) if not leaf then leaf = getSelectedGridListLeaf(wndCreateVehicle, 'vehicles') if not leaf then return end end server.giveMeVehicles(leaf.id) end wndCreateVehicle = { 'wnd', text = 'Veículos', width = 300, controls = { { 'lst', id='vehicles', width=280, height=340, columns={ {text='Veiculos', attr='name'} }, rows={xml='vehicles.xml', attrs={'id', 'name'}}, onitemdoubleclick=createSelectedVehicle }, {'btn', id='Criar', onclick=createSelectedVehicle}, {'btn', id='Fechar', closeswindow=true} } } function createVehicleCommand(cmd, ...) local vehID local vehiclesToCreate = {} local args = { ... } for i,v in ipairs(args) do vehID = tonumber(v) if not vehID then vehID = getVehicleModelFromName(v) end if vehID then table.insert(vehiclesToCreate, math.floor(vehID)) end end server.giveMeVehicles(vehiclesToCreate) end --------------------------- -- Repair vehicle --------------------------- function repairVehicle() local vehicle = getPedOccupiedVehicle(g_Me) if vehicle then if isTimer(timer) then outputChatBox("Aguarde 10 Segundos para reparar o veiculo...") return end server.fixVehicle(vehicle) timer = setTimer(function() if isTimer(timer) then killTimer(timer) end end, 10000, 1) end end --------------------------- -- Flip vehicle --------------------------- function flipVehicle() local vehicle = getPedOccupiedVehicle(g_Me) if vehicle then local rX, rY, rZ = getElementRotation(vehicle) server['set' .. 'VehicleRotation'](vehicle, 0, 0, (rX > 90 and rX < 270) and (rZ + 180) or rZ) end end --------------------------- -- Vehicle upgrades --------------------------- function upgradesInit() local vehicle = getPedOccupiedVehicle(g_Me) if not vehicle then errMsg('Please enter a vehicle to change the upgrades of.') closeWindow(wndUpgrades) return end local installedUpgrades = getVehicleUpgrades(vehicle) local compatibleUpgrades = {} local slotName, group for i,upgrade in ipairs(getVehicleCompatibleUpgrades(vehicle)) do slotName = getVehicleUpgradeSlotName(upgrade) group = table.find(compatibleUpgrades, 'name', slotName) if not group then group = { 'group', name = slotName, children = {} } table.insert(compatibleUpgrades, group) else group = compatibleUpgrades[group] end table.insert(group.children, { id = upgrade, installed = table.find(installedUpgrades, upgrade) ~= false }) end table.sort(compatibleUpgrades, function(a, b) return a.name < b.name end) bindGridListToTable(wndUpgrades, 'upgradelist', compatibleUpgrades, true) end function selectUpgrade(leaf) setControlText(wndUpgrades, 'addremove', leaf.installed and 'remove' or 'add') end function addRemoveUpgrade(selUpgrade) -- Add or remove selected upgrade local vehicle = getPedOccupiedVehicle(g_Me) if not vehicle then return end if not selUpgrade then selUpgrade = getSelectedGridListLeaf(wndUpgrades, 'upgradelist') if not selUpgrade then return end end if selUpgrade.installed then -- remove upgrade selUpgrade.installed = false setControlText(wndUpgrades, 'addremove', 'Adicionar') server.removeVehicleUpgrade(vehicle, selUpgrade.id) else -- add upgrade local prevUpgradeIndex = table.find(selUpgrade.siblings, 'Instalado', true) if prevUpgradeIndex then selUpgrade.siblings[prevUpgradeIndex].installed = false end selUpgrade.installed = true setControlText(wndUpgrades, 'addremove', 'Remover') server.addVehicleUpgrade(vehicle, selUpgrade.id) end end wndUpgrades = { 'wnd', text = 'Atualizações no Veículo', width = 300, x = -20, y = 0.3, controls = { { 'lst', id='upgradelist', width=280, height=340, columns={ {text='Atualizar', attr='id', width=0.6}, {text='Instalado', attr='installed', width=0.3, enablemodify=true} }, onitemclick=selectUpgrade, onitemdoubleclick=addRemoveUpgrade }, {'btn', id='addremove', text='Adicionar', width=60, onclick=addRemoveUpgrade}, {'btn', id='ok', closeswindow=true} }, oncreate = upgradesInit } function addUpgradeCommand(cmd, upgrade) local vehicle = getPedOccupiedVehicle(g_Me) if vehicle and upgrade then server.addVehicleUpgrade(vehicle, tonumber(upgrade) or 0) end end function removeUpgradeCommand(cmd, upgrade) local vehicle = getPedOccupiedVehicle(g_Me) if vehicle and upgrade then server.removeVehicleUpgrade(vehicle, tonumber(upgrade) or 0) end end --------------------------- -- Toggle lights --------------------------- function forceLightsOn() local vehicle = getPedOccupiedVehicle(g_Me) if not vehicle then return end if guiCheckBoxGetSelected(getControl(wndMain, 'luzesligadas')) then server.setVehicleOverrideLights(vehicle, 2) guiCheckBoxSetSelected(getControl(wndMain, 'luzesdesligadas'), false) else server.setVehicleOverrideLights(vehicle, 0) end end function forceLightsOff() local vehicle = getPedOccupiedVehicle(g_Me) if not vehicle then return end if guiCheckBoxGetSelected(getControl(wndMain, 'luzesdesligadas')) then server.setVehicleOverrideLights(vehicle, 1) guiCheckBoxSetSelected(getControl(wndMain, 'luzesligadas'), false) else server.setVehicleOverrideLights(vehicle, 0) end end --------------------------- -- Color --------------------------- function setColorCommand(cmd, ...) local vehicle = getPedOccupiedVehicle(g_Me) if not vehicle then return end local colors = { getVehicleColor(vehicle) } local args = { ... } for i=1,6 do colors[i] = args[i] and tonumber(args[i]) or colors[i] end server.setVehicleColor(vehicle, unpack(colors)) end function openColorPicker() editingVehicle = getPedOccupiedVehicle(localPlayer) if (editingVehicle) then colorPicker.openSelect(colors) end end function closedColorPicker() local r1, g1, b1, r2, g2, b2 = getVehicleColor(editingVehicle, true) server.setVehicleColor(editingVehicle, r1, g1, b1, r2, g2, b2) local r, g, b = getVehicleHeadLightColor(editingVehicle) server.setVehicleHeadLightColor(editingVehicle, r, g, b) editingVehicle = nil end function updateColor() if (not colorPicker.isSelectOpen) then return end local r, g, b = colorPicker.updateTempColors() if (editingVehicle and isElement(editingVehicle)) then local r1, g1, b1, r2, g2, b2 = getVehicleColor(editingVehicle, true) if (guiCheckBoxGetSelected(checkColor1)) then r1, g1, b1 = r, g, b end if (guiCheckBoxGetSelected(checkColor2)) then r2, g2, b2 = r, g, b end if (guiCheckBoxGetSelected(checkColor3)) then setVehicleHeadLightColor(editingVehicle, r, g, b) end setVehicleColor(editingVehicle, r1, g1, b1, r2, g2, b2) end end addEventHandler("onClientRender", root, updateColor) --------------------------- -- Paintjob --------------------------- function paintjobInit() local vehicle = getPedOccupiedVehicle(g_Me) if not vehicle then errMsg('Você precisa de um carro que permite edições de pintura personalizada') closeWindow(wndPaintjob) return end local paint = getVehiclePaintjob(vehicle) if paint then guiGridListSetSelectedItem(getControl(wndPaintjob, 'paintjoblist'), paint+1) end end function applyPaintjob(paint) server.setVehiclePaintjob(getPedOccupiedVehicle(g_Me), paint.id) end wndPaintjob = { 'wnd', text = 'Pintura Personalizada', width = 220, x = -20, y = 0.3, controls = { { 'lst', id='paintjoblist', width=200, height=130, columns={ {text='Paintjob ID', attr='id'} }, rows={ {id=0}, {id=1}, {id=2}, {id=3} }, onitemclick=applyPaintjob, ondoubleclick=function() closeWindow(wndPaintjob) end }, {'btn', id='close', closeswindow=true}, }, oncreate = paintjobInit } function setPaintjobCommand(cmd, paint) local vehicle = getPedOccupiedVehicle(g_Me) paint = paint and tonumber(paint) if not paint or not vehicle then return end server.setVehiclePaintjob(vehicle, paint) end --------------------------- -- Main window --------------------------- function updateGUI(updateVehicle) -- update position local x, y, z = getElementPosition(g_Me) setControlNumbers(wndMain, {xpos=math.ceil(x), ypos=math.ceil(y), zpos=math.ceil(z)}) -- update jetpack toggle guiCheckBoxSetSelected( getControl(wndMain, 'jetpack'), doesPedHaveJetPack(g_Me) ) if updateVehicle then -- update current vehicle local vehicle = getPedOccupiedVehicle(g_Me) if vehicle and isElement(vehicle) then setControlText(wndMain, 'va', getVehicleName(vehicle)) else setControlText(wndMain, 'va', 'à pe.') end end end function mainWndShow() if not getPedOccupiedVehicle(g_Me) then hideControls(wndMain, 'Reparar', 'Virar', 'Tunar', 'Pintura', ' Pintura Personalizada ', 'luzesligadas', 'luzesdesligadas') end updateTimer = updateTimer or setTimer(updateGUI, 2000, 0) updateGUI(true) end function mainWndClose() killTimer(updateTimer) updateTimer = nil colorPicker.closeSelect() end function onEnterVehicle(vehicle) setControlText(wndMain, 'va', getVehicleName(vehicle)) showControls(wndMain, 'Reparar', 'Virar', 'Tunar', 'Pintura', ' Pintura Personalizada ', 'luzesligadas', 'luzesdesligadas') guiCheckBoxSetSelected(getControl(wndMain, 'luzesligadas'), getVehicleOverrideLights(vehicle) == 2) guiCheckBoxSetSelected(getControl(wndMain, 'luzesdesligadas'), getVehicleOverrideLights(vehicle) == 1) end function onExitVehicle(vehicle) setControlText(wndMain, 'va', 'à pe.') hideControls(wndMain, 'Reparar', 'Virar', 'Tunar', 'Pintura', ' Pintura Personalizada ', 'luzesligadas', 'luzesdesligadas') closeWindow(wndUpgrades) closeWindow(wndColor) end function killLocalPlayer() server.killPed(g_Me) end function alphaCommand(command, alpha) alpha = alpha and tonumber(alpha) if alpha then server.setElementAlpha(g_Me, alpha) end end addCommandHandler('xoraprint', alphaCommand) addCommandHandler('kill', killLocalPlayer) wndMain = { 'wnd', text = 'Painel do Jogador', x = 10, y = 150, width = 280, controls = { {'btn', id=' Morrer ', onclick=killLocalPlayer}, {'btn', id=' Personagens ', window=wndSkin}, {'btn', id=' Animações ', window=wndAnim}, {'btn', id=' Armamento ', window=wndWeapon}, {'btn', id=' Roupas ', window=wndClothes}, {'btn', id=' Habilidades ', window=wndStats}, {'chk', id='falloff', text='Cair ou não da Bike/Moto', onclick=toggleFallOffBike}, {'br'}, {'lbl', text='Pos:'}, {'lbl', id='xpos', text='x', width=45}, {'lbl', id='ypos', text='y', width=45}, {'lbl', id='zpos', text='z', width=45}, {'br'}, {'lbl', text='Veículos'}, {'btn', id='Criar Veículo', window=wndCreateVehicle, text=' Criar Veículo '}, {'br'}, {'btn', id='Reparar', onclick=repairVehicle}, {'btn', id='Virar', onclick=flipVehicle}, {'btn', id='Tunar', window=wndUpgrades}, {'btn', id='Pintura', onclick=openColorPicker}, {'btn', id=' Pintura Personalizada ', window=wndPaintjob}, {'chk', id='luzesligadas', text='Farol Ligado', onclick=forceLightsOn}, {'chk', id='luzesdesligadas', text='Farol Desligado', onclick=forceLightsOff}, }, oncreate = mainWndShow, onclose = mainWndClose } function errMsg(msg) outputChatBox(msg, 255, 0, 0) end addEventHandler('onClientResourceStart', g_ResRoot, function() fadeCamera(true) setTimer(getPlayers, 1000, 1) bindKey('f1', 'down', toggleFRWindow) createWindow(wndMain) hideAllWindows() guiCheckBoxSetSelected(getControl(wndMain, 'jetpack'), doesPedHaveJetPack(g_Me)) guiCheckBoxSetSelected(getControl(wndMain, 'falloff'), canPedBeKnockedOffBike(g_Me)) setJetpackMaxHeight ( 9001 ) triggerServerEvent('onLoadedAtClient', g_ResRoot, g_Me) end ) function toggleFRWindow() if isWindowOpen(wndMain) then showCursor(false) hideAllWindows() colorPicker.closeSelect() else showCursor(true) showAllWindows() end end addCommandHandler('fr', toggleFRWindow) function getPlayers() g_PlayerData = {} table.each(getElementsByType('player'), joinHandler) end function joinHandler(player) if (not g_PlayerData) then return end g_PlayerData[player or source] = { name = getPlayerName(player or source), gui = {} } end addEventHandler('onClientPlayerJoin', g_Root, joinHandler) addEventHandler('onClientPlayerQuit', g_Root, function() if (not g_PlayerData) then return end table.each(g_PlayerData[source].gui, destroyElement) g_PlayerData[source] = nil end ) addEventHandler('onClientPlayerWasted', g_Me, function() onExitVehicle(g_Me) end ) addEventHandler('onClientPlayerVehicleEnter', g_Me, onEnterVehicle) addEventHandler('onClientPlayerVehicleExit', g_Me, onExitVehicle) addEventHandler('onClientResourceStop', g_ResRoot, function() showCursor(false) setPedAnimation(g_Me, false) end ) fr_server.Lua g_Root = getRootElement() g_ResRoot = getResourceRootElement(getThisResource()) g_PlayerData = {} g_VehicleData = {} local chatTime = {} local lastChatMessage = {} g_ArmedVehicles = { [425] = true, [447] = true, [520] = true, [430] = true, [464] = true, [432] = true } g_Trailers = { [606] = true, [607] = true, [610] = true, [590] = true, [569] = true, [611] = true, [584] = true, [608] = true, [435] = true, [450] = true, [591] = true } g_RPCFunctions = { addPedClothes = { option = 'clothes', descr = 'Modifying clothes' }, addVehicleUpgrade = { option = 'upgrades', descr = 'Adding/removing upgrades' }, fadeVehiclePassengersCamera = true, fixVehicle = { option = 'repair', descr = 'Repairing vehicles' }, giveMeVehicles = { option = 'createvehicle', descr = 'Creating vehicles' }, giveMeWeapon = { option = 'weapons.enabled', descr = 'Getting weapons' }, givePedJetPack = { option = 'jetpack', descr = 'Getting a jetpack' }, killPed = { option = 'kill', descr = 'Killing yourself' }, removePedClothes = { option = 'clothes', descr = 'Modifying clothes' }, removePedFromVehicle = true, removePedJetPack = { option = 'jetpack', descr = 'Removing a jetpack' }, removeVehicleUpgrade = { option = 'upgrades', descr = 'Adding/removing upgrades' }, setElementAlpha = { option = 'alpha', descr = 'Changing your alpha' }, setElementPosition = true, setElementInterior = true, setMyGameSpeed = { option = 'gamespeed.enabled', descr = 'Setting game speed' }, setMySkin = { option = 'setskin', descr = 'Setting skin' }, setPedAnimation = { option = 'anim', descr = 'Setting an animation' }, setPedFightingStyle = { option = 'setstyle', descr = 'Setting fighting style' }, setPedGravity = { option = 'gravity.enabled', descr = 'Setting gravity' }, setPedStat = { option = 'stats', descr = 'Changing stats' }, setTime = { option = 'time.set', descr = 'Changing time' }, setTimeFrozen = { option = 'time.freeze', descr = 'Freezing time' }, setVehicleColor = true, setVehicleHeadLightColor = true, setVehicleOverrideLights = { option = 'lights', descr = 'Forcing lights' }, setVehiclePaintjob = { option = 'paintjob', descr = 'Applying paintjobs' }, setVehicleRotation = true, setWeather = { option = 'weather', descr = 'Setting weather' }, spawnMe = true, warpMe = { option = 'warp', descr = 'Warping' } } g_OptionDefaults = { alpha = true, anim = true, clothes = true, createvehicle = true, gamespeed = { enabled = true, min = 0.0, max = 3 }, gravity = { enabled = true, min = 0, max = 0.1 }, jetpack = true, kill = true, lights = true, paintjob = true, repair = true, setskin = true, setstyle = true, spawnmaponstart = true, spawnmapondeath = true, stats = true, time = { set = true, freeze = true }, upgrades = true, warp = true, weapons = { enabled = true, vehiclesenabled = true, disallowed = {} }, weather = true, welcometextonstart = true, vehicles = { maxidletime = 300000, idleexplode = true, maxperplayer = 2, disallowed = {} } } function getOption(optionName) local option = get(optionName:gsub('%.', '/')) if option then if option == 'true' then option = true elseif option == 'false' then option = false end return option end option = g_OptionDefaults for i,part in ipairs(optionName:split('.')) do option = option[part] end return option end addEventHandler('onResourceStart', g_ResRoot, function() table.each(getElementsByType('player'), joinHandler) end ) function joinHandler(player) if not player then player = source end local r, g, b = math.random(50, 255), math.random(50, 255), math.random(50, 255) setPlayerNametagColor(player, r, g, b) g_PlayerData[player] = { vehicles = {} } g_PlayerData[player].blip = createBlipAttachedTo(player, 0, 2, r, g, b) if g_FrozenTime then clientCall(player, 'setTimeFrozen', true, g_FrozenTime[1], g_FrozenTime[2], g_FrozenWeather) end if getOption('welcometextonstart') then outputChatBox('Seja Bem Vindo!', player, 0, 255, 0) outputChatBox('Pressione [F1] para abrir o seu Painel do Jogador!', player, 0, 255, 0) end end addEventHandler('onPlayerJoin', g_Root, joinHandler) addEvent('onLoadedAtClient', true) addEventHandler('onLoadedAtClient', g_ResRoot, function(player) if getOption('spawnmaponstart') and isPedDead(player) then clientCall(player, 'showWelcomeMap') end end, false ) addEvent('onClothesInit', true) addEventHandler('onClothesInit', g_Root, function() local result = {} local texture, model -- get all clothes result.allClothes = {} local typeGroup, index for type=0,17 do typeGroup = {'group', type = type, name = getClothesTypeName(type), children = {}} table.insert(result.allClothes, typeGroup) index = 0 texture, model = getClothesByTypeIndex(type, index) while texture do table.insert(typeGroup.children, {id = index, texture = texture, model = model}) index = index + 1 texture, model = getClothesByTypeIndex(type, index) end end -- get current player clothes { type = {texture=texture, model=model} } result.playerClothes = {} for type=0,17 do texture, model = getPedClothes(source, type) if texture then result.playerClothes[type] = {texture = texture, model = model} end end triggerClientEvent(source, 'onClientClothesInit', source, result) end ) addEvent('onPlayerGravInit', true) addEventHandler('onPlayerGravInit', g_Root, function() triggerClientEvent('onClientPlayerGravInit', source, getPedGravity(source)) end ) function setMySkin(skinid) if isPedDead(source) then local x, y, z = getElementPosition(source) if isPedTerminated(source) then x = 0 y = 0 z = 3 end local r = getPedRotation(source) local interior = getElementInterior(source) spawnPlayer(source, x, y, z, r, skinid) setElementInterior(source, interior) setCameraInterior(source, interior) else setElementModel(source, skinid) setElementHealth(source, 100) end setCameraTarget(source, source) setCameraInterior(source, getElementInterior(source)) end function giveMeWeapon(weapon, amount) if weapon and weapon > 50 then return end if table.find(getOption('weapons.disallowed'), weapon) then errMsg((getWeaponNameFromID(weapon) or tostring(weapon)) .. 's are not allowed', source) else giveWeapon(source, weapon, amount, true) end end function giveMeVehicles(vehicles) if type(vehicles) == 'number' then vehicles = { vehicles } end local px, py, pz, prot local radius = 0 local playerVehicle = getPedOccupiedVehicle(source) if playerVehicle and isElement(playerVehicle) then px, py, pz = getElementPosition(playerVehicle) prot, prot, prot = getVehicleRotation(playerVehicle) else px, py, pz = getElementPosition(source) prot = getPedRotation(source) end local offsetRot = math.rad(prot) local vx = px + radius * math.cos(offsetRot) local vy = py + radius * math.sin(offsetRot) local vz = pz + 2 local vrot = prot local vehicleList = g_PlayerData[source].vehicles local vehicle if ( not vehicles ) then return end for i,vehID in ipairs(vehicles) do if vehID < 400 or vehID > 611 then errMsg(vehID ..' is incorrect vehicle model', source) elseif not table.find(getOption('vehicles.disallowed'), vehID) then if #vehicleList >= getOption('vehicles.maxperplayer') then unloadVehicle(vehicleList[1]) end vehicle = createVehicle(vehID, vx, vy, vz, 0, 0, vrot) warpPedIntoVehicle(source, vehicle) if (not isElement(vehicle)) then return end setElementInterior(vehicle, getElementInterior(source)) setElementDimension(vehicle, getElementDimension(source)) table.insert(vehicleList, vehicle) g_VehicleData[vehicle] = { creator = source, timers = {} } if vehID == 464 then warpPedIntoVehicle(source, vehicle) elseif not g_Trailers[vehID] then if getOption('vehicles.idleexplode') then g_VehicleData[vehicle].timers.fire = setTimer(commitArsonOnVehicle, getOption('vehicles.maxidletime'), 1, vehicle) end end vx = vx + 4 vz = vz + 4 else errMsg(getVehicleNameFromModel(vehID):gsub('y$', 'ie') .. 's are not allowed', source) end end end _setPlayerGravity = setPedGravity function setPedGravity(player, grav) if grav < getOption('gravity.min') then errMsg(('Minimum allowed gravity is %.5f'):format(getOption('gravity.min')), player) elseif grav > getOption('gravity.max') then errMsg(('Maximum allowed gravity is %.5f'):format(getOption('gravity.max')), player) else _setPlayerGravity(player, grav) end end function setMyGameSpeed(speed) if speed < getOption('gamespeed.min') then errMsg(('Minimum allowed gamespeed is %.5f'):format(getOption('gamespeed.min')), source) elseif speed > getOption('gamespeed.max') then errMsg(('Maximum allowed gamespeed is %.5f'):format(getOption('gamespeed.max')), source) else clientCall(source, 'setGameSpeed', speed) end end function setTimeFrozen(state) if state then g_FrozenTime = { getTime() } g_FrozenWeather = getWeather() clientCall(g_Root, 'setTimeFrozen', state, g_FrozenTime[1], g_FrozenTime[2], g_FrozenWeather) else if g_FrozenTime then setTime(unpack(g_FrozenTime)) g_FrozenTime = nil setWeather(g_FrozenWeather) g_FrozenWeather = nil end clientCall(g_Root, 'setTimeFrozen', state) end end function fadeVehiclePassengersCamera(toggle) local vehicle = getPedOccupiedVehicle(source) if not vehicle then return end local player for i=0,getVehicleMaxPassengers(vehicle) do player = getVehicleOccupant(vehicle, i) if player then fadeCamera(player, toggle) end end end addEventHandler('onPlayerChat', g_Root, function(msg, type) if type == 0 then cancelEvent() if chatTime[source] and chatTime[source] + tonumber(get("*chat/mainChatDelay")) > getTickCount() then outputChatBox("Stop spamming main chat!", source, 255, 0, 0) return else chatTime[source] = getTickCount() end if get("*chat/blockRepeatMessages") == "true" and lastChatMessage[source] and lastChatMessage[source] == msg then outputChatBox("Stop repeating yourself!", source, 255, 0, 0) return else lastChatMessage[source] = msg end local r, g, b = getPlayerNametagColor(source) end end ) addEventHandler('onVehicleEnter', g_Root, function(player, seat) if not g_VehicleData[source] then return end if g_VehicleData[source].timers.fire then killTimer(g_VehicleData[source].timers.fire) g_VehicleData[source].timers.fire = nil end if g_VehicleData[source].timers.destroy then killTimer(g_VehicleData[source].timers.destroy) g_VehicleData[source].timers.destroy = nil end if not getOption('weapons.vehiclesenabled') and g_ArmedVehicles[getElementModel(source)] then toggleControl(player, 'vehicle_fire', false) toggleControl(player, 'vehicle_secondary_fire', false) end end ) addEventHandler('onVehicleExit', g_Root, function(player, seat) if not g_VehicleData[source] then return end if not g_VehicleData[source].timers.fire then for i=0,getVehicleMaxPassengers(source) or 1 do if getVehicleOccupant(source, i) then return end end if getOption('vehicles.idleexplode') then g_VehicleData[source].timers.fire = setTimer(commitArsonOnVehicle, getOption('vehicles.maxidletime'), 1, source) end g_VehicleData[source].timers.destroy = setTimer(unloadVehicle, getOption('vehicles.maxidletime') + (getOption('vehicles.idleexplode') and 10000 or 0), 1, source) end if g_ArmedVehicles[getElementModel(source)] then toggleControl(player, 'vehicle_fire', true) toggleControl(player, 'vehicle_secondary_fire', true) end end ) function commitArsonOnVehicle(vehicle) g_VehicleData[vehicle].timers.fire = nil setElementHealth(vehicle, 0) end addEventHandler('onVehicleExplode', g_Root, function() if not g_VehicleData[source] then return end if g_VehicleData[source].timers.fire then killTimer(g_VehicleData[source].timers.fire) g_VehicleData[source].timers.fire = nil end if not g_VehicleData[source].timers.destroy then g_VehicleData[source].timers.destroy = setTimer(unloadVehicle, 5000, 1, source) end end ) function unloadVehicle(vehicle) if not g_VehicleData[vehicle] then return end for name,timer in pairs(g_VehicleData[vehicle].timers) do if isTimer(timer) then killTimer(timer) end g_VehicleData[vehicle].timers[name] = nil end local creator = g_VehicleData[vehicle].creator if g_PlayerData[creator] then table.removevalue(g_PlayerData[creator].vehicles, vehicle) end g_VehicleData[vehicle] = nil if isElement(vehicle) then destroyElement(vehicle) end end function quitHandler(player) if type(player) ~= 'userdata' then player = source end if g_PlayerData[player].blip and isElement(g_PlayerData[player].blip) then destroyElement(g_PlayerData[player].blip) end table.each(g_PlayerData[player].vehicles, unloadVehicle) g_PlayerData[player] = nil chatTime[player] = nil lastChatMessage[player] = nil end addEventHandler('onPlayerQuit', g_Root, quitHandler) addEventHandler('onResourceStop', g_ResRoot, function() for player,data in pairs(g_PlayerData) do quitHandler(player) end end ) addEvent('onServerCall', true) addEventHandler('onServerCall', g_Root, function(fnName, ...) local fnInfo = g_RPCFunctions[fnName] if fnInfo and ((type(fnInfo) == 'boolean' and fnInfo) or (type(fnInfo) == 'table' and getOption(fnInfo.option))) then local fn = _G for i,pathpart in ipairs(fnName:split('.')) do fn = fn[pathpart] end fn(...) elseif type(fnInfo) == 'table' then errMsg(fnInfo.descr .. ' is not allowed', source) end end ) function clientCall(player, fnName, ...) triggerClientEvent(player, 'onClientCall', g_ResRoot, fnName, ...) end
  9. Eu quero colocar um time de 5 segundos pra pessoa poder reparar o veiculo dela novamente no freeroam com a mensagem Aguarde 5 segundos para reparar o seu veiculo... local Vermelho = 250 local Verde = 250 local Azul = 0 addEventHandler("onClientGUIClick",root, function () if ( source == getControl(wndCreateVehicle,"vehicles") ) then for row=0, guiGridListGetRowCount(getControl(wndCreateVehicle, "vehicles")) do guiGridListSetItemColor(getControl(wndCreateVehicle, "vehicles"),row,1,1,120,253) end end end ) CONTROL_MARGIN_RIGHT = 5 LINE_MARGIN = 5 LINE_HEIGHT = 16 g_Root = getRootElement() g_ResRoot = getResourceRootElement(getThisResource()) g_Me = getLocalPlayer() server = createServerCallInterface() guiSetInputMode("no_binds_when_editing") --------------------------- -- Set skin window --------------------------- function skinInit() setControlNumber(wndSkin, 'skinid', getElementModel(g_Me)) end function showSkinID(leaf) if leaf.id then setControlNumber(wndSkin, 'skinid', leaf.id) end end function applySkin() local skinID = getControlNumber(wndSkin, 'skinid') if skinID then server.setMySkin(skinID) fadeCamera(true) end end wndSkin = { 'wnd', text = 'Personagens', width = 250, x = -20, y = 0.3, controls = { { 'lst', id='skinlist', width=230, height=290, columns={ {text='Skin', attr='name'} }, rows={xml='skins.xml', attrs={'id', 'name'}}, onitemclick=showSkinID, onitemdoubleclick=applySkin }, {'txt', id='skinid', text='', width=0}, {'btn', id='set', onclick=applySkin}, {'btn', id='close', closeswindow=true} }, oncreate = skinInit } function setSkinCommand(cmd, skin) skin = skin and tonumber(skin) if skin then server.setMySkin(skin) fadeCamera(true) closeWindow(wndSpawnMap) closeWindow(wndSetPos) end end --------------------------- --- Set animation window --------------------------- function applyAnimation(leaf) if type(leaf) ~= 'table' then leaf = getSelectedGridListLeaf(wndAnim, 'animlist') if not leaf then return end end server.setPedAnimation(g_Me, leaf.parent.name, leaf.name, true, true) end function stopAnimation() server.setPedAnimation(g_Me, false) end wndAnim = { 'wnd', text = 'Animações', width = 250, x = -20, y = 0.3, controls = { { 'lst', id='animlist', width=230, height=290, columns={ {text='Animações', attr='name'} }, rows={xml='animations.xml', attrs={'name'}}, expandlastlevel=false, onitemdoubleclick=applyAnimation }, {'btn', id='Animar', onclick=applyAnimation}, {'btn', id='Parar', onclick=stopAnimation}, {'btn', id='Fechar', closeswindow=true} } } addCommandHandler('anim', function(command, lib, name) server.setPedAnimation(g_Me, lib, name, true, true) end ) --------------------------- -- Weapon window --------------------------- function addWeapon(leaf, amount) if type(leaf) ~= 'table' then leaf = getSelectedGridListLeaf(wndWeapon, 'weaplist') amount = getControlNumber(wndWeapon, 'amount') if not amount or not leaf then return end end server.giveMeWeapon(leaf.id, amount) end wndWeapon = { 'wnd', text = 'Armamento', width = 250, controls = { { 'lst', id='weaplist', width=230, height=280, columns={ {text='Arma', attr='name'} }, rows={xml='weapons.xml', attrs={'id', 'name'}}, onitemdoubleclick=function(leaf) addWeapon(leaf, 500) end }, {'br'}, {'txt', id='amount', text='500', width=60}, {'btn', id='Pegar', onclick=addWeapon}, {'btn', id='Fechar', closeswindow=true} } } function giveWeaponCommand(cmd, weapon, amount) weapon = tonumber(weapon) or getWeaponIDFromName(weapon) if not weapon then return end amount = amount and tonumber(amount) or 500 server.giveMeWeapon(math.floor(weapon), amount) end --------------------------- -- Fighting style --------------------------- addCommandHandler('luta', function(cmd, style) style = style and tonumber(style) if style then server.setPedFightingStyle(g_Me, style) end end ) --------------------------- -- Clothes window --------------------------- function clothesInit() if getElementModel(g_Me) ~= 0 then errMsg('Você precisa do CJ para trocar de roupas.') closeWindow(wndClothes) return end if not g_Clothes then triggerServerEvent('onClothesInit', g_Me) end end addEvent('onClientClothesInit', true) addEventHandler('onClientClothesInit', g_Root, function(clothes) g_Clothes = clothes.allClothes for i,typeGroup in ipairs(g_Clothes) do for j,cloth in ipairs(typeGroup.children) do if not cloth.name then cloth.name = cloth.model .. ' - ' .. cloth.texture end cloth.wearing = clothes.playerClothes[typeGroup.type] and clothes.playerClothes[typeGroup.type].texture == cloth.texture and clothes.playerClothes[typeGroup.type].model == cloth.model or false end table.sort(typeGroup.children, function(a, b) return a.name < b.name end) end bindGridListToTable(wndClothes, 'clothes', g_Clothes, false) end ) function clothListClick(cloth) setControlText(wndClothes, 'addremove', cloth.wearing and 'Remover' or 'Adicionar') end function applyClothes(cloth) if not cloth then cloth = getSelectedGridListLeaf(wndClothes, 'clothes') if not cloth then return end end if cloth.wearing then cloth.wearing = false setControlText(wndClothes, 'addremove', 'Adicionar') server.removePlayerClothes(g_Me, cloth.parent.type) else local prevClothIndex = table.find(cloth.siblings, 'wearing', true) if prevClothIndex then cloth.siblings[prevClothIndex].wearing = false end cloth.wearing = true setControlText(wndClothes, 'addremove', 'Remover') server.addPedClothes(g_Me, cloth.texture, cloth.model, cloth.parent.type) end end wndClothes = { 'wnd', text = 'Clothes', x = -20, y = 0.3, width = 350, controls = { { 'lst', id='clothes', width=330, height=390, columns={ {text='Roupas', attr='name', width=0.6}, {text='Wearing', attr='wearing', enablemodify=true, width=0.3} }, rows={ {name='Retrieving clothes list...'} }, onitemclick=clothListClick, onitemdoubleclick=applyClothes }, {'br'}, {'btn', text='Adicionar', id='addremove', width=60, onclick=applyClothes}, {'btn', id='Fechar', closeswindow=true} }, oncreate = clothesInit } function addClothesCommand(cmd, type, model, texture) type = type and tonumber(type) if type and model and texture then server.addPedClothes(g_Me, texture, model, type) end end addCommandHandler('addclothes', addClothesCommand) addCommandHandler('ac', addClothesCommand) function removeClothesCommand(cmd, type) type = type and tonumber(type) if type then server.removePlayerClothes(g_Me, type) end end addCommandHandler('removeclothes', removeClothesCommand) addCommandHandler('rc', removeClothesCommand) --------------------------- -- Stats window --------------------------- function initStats() applyToLeaves(getGridListCache(wndStats, 'statslist'), function(leaf) leaf.value = getPedStat(g_Me, leaf.id) end) end function selectStat(leaf) setControlNumber(wndStats, 'statval', leaf.value) end function maxStat(leaf) setControlNumber(wndStats, 'statval', 1000) applyStat() end function applyStat() local leaf = getSelectedGridListLeaf(wndStats, 'statslist') if not leaf then return end local value = getControlNumber(wndStats, 'statval') if not value then return end leaf.value = value server.setPedStat(g_Me, leaf.id, value) end wndStats = { 'wnd', text = 'Habilidade', width = 300, x = -20, y = 0.3, controls = { { 'lst', id='statslist', width=280, columns={ {text='Habilidade', attr='name', width=0.6}, {text='Quantidade', attr='value', width=0.3, enablemodify=true} }, rows={xml='stats.xml', attrs={'name', 'id'}}, onitemclick=selectStat, onitemdoubleclick=maxStat }, {'txt', id='statval', text='', width=60}, {'btn', id='Definir', onclick=applyStat}, {'btn', id='Fechar', closeswindow=true} }, oncreate = initStats } --------------------------- -- Fall off bike toggle --------------------------- function toggleFallOffBike() setPedCanBeKnockedOffBike(g_Me, guiCheckBoxGetSelected(getControl(wndMain, 'falloff'))) end --------------------------- -- Create vehicle window --------------------------- function createSelectedVehicle(leaf) if not leaf then leaf = getSelectedGridListLeaf(wndCreateVehicle, 'vehicles') if not leaf then return end end server.giveMeVehicles(leaf.id) end wndCreateVehicle = { 'wnd', text = 'Veículos', width = 300, controls = { { 'lst', id='vehicles', width=280, height=340, columns={ {text='Veiculos', attr='name'} }, rows={xml='vehicles.xml', attrs={'id', 'name'}}, onitemdoubleclick=createSelectedVehicle }, {'btn', id='Criar', onclick=createSelectedVehicle}, {'btn', id='Fechar', closeswindow=true} } } function createVehicleCommand(cmd, ...) local vehID local vehiclesToCreate = {} local args = { ... } for i,v in ipairs(args) do vehID = tonumber(v) if not vehID then vehID = getVehicleModelFromName(v) end if vehID then table.insert(vehiclesToCreate, math.floor(vehID)) end end server.giveMeVehicles(vehiclesToCreate) end --------------------------- -- Repair vehicle --------------------------- function repairVehicle() local vehicle = getPedOccupiedVehicle(g_Me) if vehicle then server.fixVehicle(vehicle) end end --------------------------- -- Flip vehicle --------------------------- function flipVehicle() local vehicle = getPedOccupiedVehicle(g_Me) if vehicle then local rX, rY, rZ = getElementRotation(vehicle) server['set' .. 'VehicleRotation'](vehicle, 0, 0, (rX > 90 and rX < 270) and (rZ + 180) or rZ) end end --------------------------- -- Vehicle upgrades --------------------------- function upgradesInit() local vehicle = getPedOccupiedVehicle(g_Me) if not vehicle then errMsg('Please enter a vehicle to change the upgrades of.') closeWindow(wndUpgrades) return end local installedUpgrades = getVehicleUpgrades(vehicle) local compatibleUpgrades = {} local slotName, group for i,upgrade in ipairs(getVehicleCompatibleUpgrades(vehicle)) do slotName = getVehicleUpgradeSlotName(upgrade) group = table.find(compatibleUpgrades, 'name', slotName) if not group then group = { 'group', name = slotName, children = {} } table.insert(compatibleUpgrades, group) else group = compatibleUpgrades[group] end table.insert(group.children, { id = upgrade, installed = table.find(installedUpgrades, upgrade) ~= false }) end table.sort(compatibleUpgrades, function(a, b) return a.name < b.name end) bindGridListToTable(wndUpgrades, 'upgradelist', compatibleUpgrades, true) end function selectUpgrade(leaf) setControlText(wndUpgrades, 'addremove', leaf.installed and 'remove' or 'add') end function addRemoveUpgrade(selUpgrade) -- Add or remove selected upgrade local vehicle = getPedOccupiedVehicle(g_Me) if not vehicle then return end if not selUpgrade then selUpgrade = getSelectedGridListLeaf(wndUpgrades, 'upgradelist') if not selUpgrade then return end end if selUpgrade.installed then -- remove upgrade selUpgrade.installed = false setControlText(wndUpgrades, 'addremove', 'Adicionar') server.removeVehicleUpgrade(vehicle, selUpgrade.id) else -- add upgrade local prevUpgradeIndex = table.find(selUpgrade.siblings, 'Instalado', true) if prevUpgradeIndex then selUpgrade.siblings[prevUpgradeIndex].installed = false end selUpgrade.installed = true setControlText(wndUpgrades, 'addremove', 'Remover') server.addVehicleUpgrade(vehicle, selUpgrade.id) end end wndUpgrades = { 'wnd', text = 'Atualizações no Veículo', width = 300, x = -20, y = 0.3, controls = { { 'lst', id='upgradelist', width=280, height=340, columns={ {text='Atualizar', attr='id', width=0.6}, {text='Instalado', attr='installed', width=0.3, enablemodify=true} }, onitemclick=selectUpgrade, onitemdoubleclick=addRemoveUpgrade }, {'btn', id='addremove', text='Adicionar', width=60, onclick=addRemoveUpgrade}, {'btn', id='ok', closeswindow=true} }, oncreate = upgradesInit } function addUpgradeCommand(cmd, upgrade) local vehicle = getPedOccupiedVehicle(g_Me) if vehicle and upgrade then server.addVehicleUpgrade(vehicle, tonumber(upgrade) or 0) end end function removeUpgradeCommand(cmd, upgrade) local vehicle = getPedOccupiedVehicle(g_Me) if vehicle and upgrade then server.removeVehicleUpgrade(vehicle, tonumber(upgrade) or 0) end end --------------------------- -- Toggle lights --------------------------- function forceLightsOn() local vehicle = getPedOccupiedVehicle(g_Me) if not vehicle then return end if guiCheckBoxGetSelected(getControl(wndMain, 'luzesligadas')) then server.setVehicleOverrideLights(vehicle, 2) guiCheckBoxSetSelected(getControl(wndMain, 'luzesdesligadas'), false) else server.setVehicleOverrideLights(vehicle, 0) end end function forceLightsOff() local vehicle = getPedOccupiedVehicle(g_Me) if not vehicle then return end if guiCheckBoxGetSelected(getControl(wndMain, 'luzesdesligadas')) then server.setVehicleOverrideLights(vehicle, 1) guiCheckBoxSetSelected(getControl(wndMain, 'luzesligadas'), false) else server.setVehicleOverrideLights(vehicle, 0) end end --------------------------- -- Color --------------------------- function setColorCommand(cmd, ...) local vehicle = getPedOccupiedVehicle(g_Me) if not vehicle then return end local colors = { getVehicleColor(vehicle) } local args = { ... } for i=1,6 do colors[i] = args[i] and tonumber(args[i]) or colors[i] end server.setVehicleColor(vehicle, unpack(colors)) end function openColorPicker() editingVehicle = getPedOccupiedVehicle(localPlayer) if (editingVehicle) then colorPicker.openSelect(colors) end end function closedColorPicker() local r1, g1, b1, r2, g2, b2 = getVehicleColor(editingVehicle, true) server.setVehicleColor(editingVehicle, r1, g1, b1, r2, g2, b2) local r, g, b = getVehicleHeadLightColor(editingVehicle) server.setVehicleHeadLightColor(editingVehicle, r, g, b) editingVehicle = nil end function updateColor() if (not colorPicker.isSelectOpen) then return end local r, g, b = colorPicker.updateTempColors() if (editingVehicle and isElement(editingVehicle)) then local r1, g1, b1, r2, g2, b2 = getVehicleColor(editingVehicle, true) if (guiCheckBoxGetSelected(checkColor1)) then r1, g1, b1 = r, g, b end if (guiCheckBoxGetSelected(checkColor2)) then r2, g2, b2 = r, g, b end if (guiCheckBoxGetSelected(checkColor3)) then setVehicleHeadLightColor(editingVehicle, r, g, b) end setVehicleColor(editingVehicle, r1, g1, b1, r2, g2, b2) end end addEventHandler("onClientRender", root, updateColor) --------------------------- -- Paintjob --------------------------- function paintjobInit() local vehicle = getPedOccupiedVehicle(g_Me) if not vehicle then errMsg('Você precisa de um carro que permite edições de pintura personalizada') closeWindow(wndPaintjob) return end local paint = getVehiclePaintjob(vehicle) if paint then guiGridListSetSelectedItem(getControl(wndPaintjob, 'paintjoblist'), paint+1) end end function applyPaintjob(paint) server.setVehiclePaintjob(getPedOccupiedVehicle(g_Me), paint.id) end wndPaintjob = { 'wnd', text = 'Pintura Personalizada', width = 220, x = -20, y = 0.3, controls = { { 'lst', id='paintjoblist', width=200, height=130, columns={ {text='Paintjob ID', attr='id'} }, rows={ {id=0}, {id=1}, {id=2}, {id=3} }, onitemclick=applyPaintjob, ondoubleclick=function() closeWindow(wndPaintjob) end }, {'btn', id='close', closeswindow=true}, }, oncreate = paintjobInit } function setPaintjobCommand(cmd, paint) local vehicle = getPedOccupiedVehicle(g_Me) paint = paint and tonumber(paint) if not paint or not vehicle then return end server.setVehiclePaintjob(vehicle, paint) end --------------------------- -- Main window --------------------------- function updateGUI(updateVehicle) -- update position local x, y, z = getElementPosition(g_Me) setControlNumbers(wndMain, {xpos=math.ceil(x), ypos=math.ceil(y), zpos=math.ceil(z)}) -- update jetpack toggle guiCheckBoxSetSelected( getControl(wndMain, 'jetpack'), doesPedHaveJetPack(g_Me) ) if updateVehicle then -- update current vehicle local vehicle = getPedOccupiedVehicle(g_Me) if vehicle and isElement(vehicle) then setControlText(wndMain, 'va', getVehicleName(vehicle)) else setControlText(wndMain, 'va', 'à pe.') end end end function mainWndShow() if not getPedOccupiedVehicle(g_Me) then hideControls(wndMain, 'Reparar', 'Virar', 'Tunar', 'Pintura', ' Pintura Personalizada ', 'luzesligadas', 'luzesdesligadas') end updateTimer = updateTimer or setTimer(updateGUI, 2000, 0) updateGUI(true) end function mainWndClose() killTimer(updateTimer) updateTimer = nil colorPicker.closeSelect() end function onEnterVehicle(vehicle) setControlText(wndMain, 'va', getVehicleName(vehicle)) showControls(wndMain, 'Reparar', 'Virar', 'Tunar', 'Pintura', ' Pintura Personalizada ', 'luzesligadas', 'luzesdesligadas') guiCheckBoxSetSelected(getControl(wndMain, 'luzesligadas'), getVehicleOverrideLights(vehicle) == 2) guiCheckBoxSetSelected(getControl(wndMain, 'luzesdesligadas'), getVehicleOverrideLights(vehicle) == 1) end function onExitVehicle(vehicle) setControlText(wndMain, 'va', 'à pe.') hideControls(wndMain, 'Reparar', 'Virar', 'Tunar', 'Pintura', ' Pintura Personalizada ', 'luzesligadas', 'luzesdesligadas') closeWindow(wndUpgrades) closeWindow(wndColor) end function killLocalPlayer() server.killPed(g_Me) end function alphaCommand(command, alpha) alpha = alpha and tonumber(alpha) if alpha then server.setElementAlpha(g_Me, alpha) end end addCommandHandler('xoraprint', alphaCommand) addCommandHandler('kill', killLocalPlayer) wndMain = { 'wnd', text = 'Painel do Jogador', x = 10, y = 150, width = 280, controls = { {'btn', id=' Morrer ', onclick=killLocalPlayer}, {'btn', id=' Personagens ', window=wndSkin}, {'btn', id=' Animações ', window=wndAnim}, {'btn', id=' Armamento ', window=wndWeapon}, {'btn', id=' Roupas ', window=wndClothes}, {'btn', id=' Habilidades ', window=wndStats}, {'chk', id='falloff', text='Cair ou não da Bike/Moto', onclick=toggleFallOffBike}, {'br'}, {'lbl', text='Pos:'}, {'lbl', id='xpos', text='x', width=45}, {'lbl', id='ypos', text='y', width=45}, {'lbl', id='zpos', text='z', width=45}, {'br'}, {'lbl', text='Veículos'}, {'btn', id='Criar Veículo', window=wndCreateVehicle, text=' Criar Veículo '}, {'br'}, {'btn', id='Reparar', onclick=repairVehicle}, {'btn', id='Virar', onclick=flipVehicle}, {'btn', id='Tunar', window=wndUpgrades}, {'btn', id='Pintura', onclick=openColorPicker}, {'btn', id=' Pintura Personalizada ', window=wndPaintjob}, {'chk', id='luzesligadas', text='Farol Ligado', onclick=forceLightsOn}, {'chk', id='luzesdesligadas', text='Farol Desligado', onclick=forceLightsOff}, }, oncreate = mainWndShow, onclose = mainWndClose } function errMsg(msg) outputChatBox(msg, 255, 0, 0) end addEventHandler('onClientResourceStart', g_ResRoot, function() fadeCamera(true) setTimer(getPlayers, 1000, 1) bindKey('f1', 'down', toggleFRWindow) createWindow(wndMain) hideAllWindows() guiCheckBoxSetSelected(getControl(wndMain, 'jetpack'), doesPedHaveJetPack(g_Me)) guiCheckBoxSetSelected(getControl(wndMain, 'falloff'), canPedBeKnockedOffBike(g_Me)) setJetpackMaxHeight ( 9001 ) triggerServerEvent('onLoadedAtClient', g_ResRoot, g_Me) end ) function toggleFRWindow() if isWindowOpen(wndMain) then showCursor(false) hideAllWindows() colorPicker.closeSelect() else showCursor(true) showAllWindows() end end addCommandHandler('fr', toggleFRWindow) function getPlayers() g_PlayerData = {} table.each(getElementsByType('player'), joinHandler) end function joinHandler(player) if (not g_PlayerData) then return end g_PlayerData[player or source] = { name = getPlayerName(player or source), gui = {} } end addEventHandler('onClientPlayerJoin', g_Root, joinHandler) addEventHandler('onClientPlayerQuit', g_Root, function() if (not g_PlayerData) then return end table.each(g_PlayerData[source].gui, destroyElement) g_PlayerData[source] = nil end ) addEventHandler('onClientPlayerWasted', g_Me, function() onExitVehicle(g_Me) end ) addEventHandler('onClientPlayerVehicleEnter', g_Me, onEnterVehicle) addEventHandler('onClientPlayerVehicleExit', g_Me, onExitVehicle) addEventHandler('onClientResourceStop', g_ResRoot, function() showCursor(false) setPedAnimation(g_Me, false) end ) Se alguem poder ajudar
  10. O voice do meu servidor esta bugando sera que tem alguma coisa coisa a + que eu tenho que ativar pra isso parar tipo varias pessoas conseguem falar outras não as vezes eu consigo dps não e como se ter alguma coisa faltando isso começou a acontecer dps de eu ter deletado algum mod que eu acho que pode ter afetado
  11. Bom existe algum resource pra tirar os carros q explodem e ficam pelo mapa Tipo resto de carros explodidos se alguem souber um resource q tira eles quando explodem e ficam no mapa
  12. Pra resetar o dinheiro so de uma pessoa sem ser de todos?
  13. Ta tudo ok kk so o player q n consegue pular dps q e solto nem bater e atirar so se matando mais mesmo se suicidando o shift de pular n vai so tem como andar atirar e dar socos menos pular
  14. Caralho eu admito como eu sou burro so hj notei q tu alterou a function cuff kkkkkkkkkkkk