-
Posts
38 -
Joined
-
Last visited
Everything posted by DouglaS666
-
Agora o erro está no server.lua. Não entendo nada de script! Agradecendo toda compreensão desde Já. PingFps\server.lua:3: Bad argument @ 'call' [Expected resource-data at argument 1, got boolean] addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), function() call(getResourceFromName(""),"addScoreboardColumn","FPS") end )
-
local ping = getPlayerPing(getLocalPlayer()) local x, y = guiGetScreenSize ( ) r,g,b=0,0,0 alpha=150 local root = getRootElement() local player = getLocalPlayer() local counter = 0 local starttick local currenttick addEventHandler("onClientRender",root, function() if not starttick then starttick = getTickCount() end counter = counter + 1 currenttick = getTickCount() if currenttick - starttick >= 1000 then setElementData(player,"FPS",counter) counter = 0 starttick = false end end ) function drawStates () addEventHandler ( "onClientRender", root, pingState ) addEventHandler ( "onClientRender", root, fpsState ) end addEventHandler ( "onClientResourceStart", resourceRoot, drawStates ) function pingState() posx= x-30 posy= 20 dxDrawRectangle ( posx, posy, 4, 4, tocolor ( r, g, b, alpha ) ) dxDrawRectangle ( posx+5, posy-4, 4,8, tocolor ( r, g, b, alpha ) ) dxDrawRectangle ( posx+10, posy-8, 4,12, tocolor ( r, g, b, alpha ) ) dxDrawRectangle ( posx+15, posy-12, 4,16, tocolor ( r, g, b, alpha ) ) dxDrawRectangle ( posx+20, posy-16, 4,20, tocolor ( r, g, b, alpha ) ) r2,g2,b2=255,255,255 alpha2=255 if ping <= 180 then dxDrawRectangle ( posx, posy, 4, 4, tocolor ( r2, g2, b2, alpha2 ) ) dxDrawRectangle ( posx+5, posy-4, 4,8, tocolor ( r2, g2, b2, alpha2 ) ) dxDrawRectangle ( posx+10, posy-8, 4,12, tocolor ( r2, g2, b2, alpha2 ) ) dxDrawRectangle ( posx+15, posy-12, 4,16, tocolor ( r2, g2, b2, alpha2 ) ) dxDrawRectangle ( posx+20, posy-16, 4,20, tocolor ( r2, g2, b2, alpha2 ) ) elseif ping >=101 and ping <= 200 then dxDrawRectangle ( posx, posy, 4, 4, tocolor ( r2, g2, b2, alpha2 ) ) dxDrawRectangle ( posx+5, posy-4, 4,8, tocolor ( r2, g2, b2, alpha2 ) ) dxDrawRectangle ( posx+10, posy-8, 4,12, tocolor ( r2, g2, b2, alpha2 ) ) dxDrawRectangle ( posx+15, posy-12, 4,16, tocolor ( r2, g2, b2, alpha2 ) ) elseif ping >=201 and ping <= 300 then dxDrawRectangle ( posx, posy, 4, 4, tocolor ( r2, g2, b2, alpha2 ) ) dxDrawRectangle ( posx+5, posy-4, 4,8, tocolor ( r2, g2, b2, alpha2 ) ) dxDrawRectangle ( posx+10, posy-8, 4,12, tocolor ( r2, g2, b2, alpha2 ) ) elseif ping >=301 and ping <= 400 then dxDrawRectangle ( posx, posy, 4, 4, tocolor ( r2, g2, b2, alpha2 ) ) dxDrawRectangle ( posx+5, posy-4, 4,8, tocolor ( r2, g2, b2, alpha2 ) ) elseif ping >=401 and ping <= 500 then dxDrawRectangle ( posx, posy, 4, 4, tocolor ( r2, g2, b2, alpha2 ) ) end end function fpsState() posx2= x-55 posy2= 13 dxDrawText ( getElementData(getLocalPlayer(),"FPS"), posx2-12, posy2-6, x, y, tocolor ( 255, 255, 255, 255 ), 1.4, "default-bold" ) dxDrawText ( "FPS", posx2-13, posy2+10, x, y, tocolor ( 255, 255, 255, 255 ), 1.0, "default-bold" ) dxDrawText ( "PING", posx2+23, posy2+10, x, y, tocolor ( 255, 255, 255, 255 ), 1.0, "default-bold" ) end
-
AreaVerde\greenzone.lua:5: Bad argument @ 'addEventHandler' ['onClientPlayerDamage' whith this function is alrealdy handled] [DUP x72] addEventHandler ("onResourceStart", getRootElement(), function() setTimer (moneyZoneTimerFunction, 2500, 0) local allGreenzones = getElementsByType ("radararea") for i,v in ipairs (allGreenzones) do local r,g,b,a = getRadarAreaColor (v) if (r == 0) and (g == 255) and (b == 0) and (a == 127) then setRadarAreaFlashing ( v, true ) local x,y = getElementPosition (v) local sx,sy = getRadarAreaSize (v) local col = createColCuboid (x,y, -50, sx,sy, 7500) setElementID (col, "greenzoneColshape") end end end) addEventHandler ("onColShapeHit", getRootElement(), function(hitElement, matchingDimension) if (getElementType (hitElement) == "player") and (getElementID (source) == "greenzoneColshape") then outputChatBox ("", hitElement, 255, 0, 0, true) toggleControl (hitElement, "fire", false) toggleControl (hitElement, "next_weapon", false) toggleControl (hitElement, "previous_weapon", false) toggleControl (hitElement, "sprint", true) toggleControl (hitElement, "aim_weapon", false) toggleControl (hitElement, "vehicle_fire", false) showPlayerHudComponent (hitElement, "ammo", false) showPlayerHudComponent (hitElement, "weapon", false) triggerClientEvent (hitElement, "enableGodMode", hitElement) end if (source == moneyZoneCol) and (getElementType (hitElement) == "vehicle") then setElementVelocity (hitElement, 0, 0, 0) setElementPosition (hitElement, 2018.33, 1534.77, 12.37) setVehicleRotation (hitElement, 0,0,270) if (getVehicleOccupant (hitElement, 0)) then outputChatBox ("", getVehicleOccupant (hitElement, 0), 255, 0, 0, false) end end end) addEventHandler ("onColShapeLeave", getRootElement(), function(leaveElement, matchingDimension) if (getElementType (leaveElement) == "player") and (getElementID (source) == "greenzoneColshape") then outputChatBox ("", leaveElement, 255, 0, 0, false) toggleControl (leaveElement, "fire", true) toggleControl (leaveElement, "next_weapon", true) toggleControl (leaveElement, "previous_weapon", true) toggleControl (leaveElement, "sprint", true) toggleControl (leaveElement, "aim_weapon", true) toggleControl (leaveElement, "vehicle_fire", true) showPlayerHudComponent (leaveElement, "ammo", false) showPlayerHudComponent (leaveElement, "weapon", false) triggerClientEvent (leaveElement, "disableGodMode", leaveElement) end end) --money zone col moneyZoneCol = createColCuboid (1993.12, 1519.14, -100, 17.43, 54.24, 117) --stop moneyzone col function moneyZoneTimerFunction () local allPlayersInCol = getElementsWithinColShape (moneyZoneCol, "player") for i,v in ipairs (allPlayersInCol) do givePlayerMoney (v, 5) end end -- marker bij hospital
-
Como coloco pack de som de armas em servidor de MTA?
DouglaS666 posted a topic in Programação em Lua
Coloco pelo Gameplay mas fica o som do mod baixo e o som do GTA original. -
O Mod buga ao ter várias pessoas perto um do outro e assim as arma ficam no chão. O script não mostra nenhum erro no Console. Print: https://prnt.sc/jqgwy4 --[[ BackWeapons script By Gothem Feel free to use and change it as you want, obviously keeping the credit to the creator.--]] local jugadores = {} local lplayer = getLocalPlayer() local info = {} local validWeapons = { [25] = true, [34] = true, [30] = true, [24] = true } local sx,sy = guiGetScreenSize() function crearArma(jug,arma) local model = obtenerObjeto(arma) local slot = getSlotFromWeapon(arma) jugadores[jug][slot] = createObject(model,0,0,0) setElementCollisionsEnabled(jugadores[jug][slot],false) end function destruirArma(jug,slot) destroyElement(jugadores[jug][slot]) jugadores[jug][slot] = nil end addEventHandler("onClientResourceStart",getResourceRootElement(),function() for k,v in ipairs(getElementsByType("player",root,true)) do jugadores[v] = {} info[v] = {true,isPedInVehicle(v)} end end,false) addEventHandler("onClientPlayerQuit",root,function() if jugadores[source] and source ~= lplayer then for k,v in pairs(jugadores[source]) do destroyElement(v) end jugadores[source] = nil info[source] = nil end end) addEventHandler("onClientElementStreamIn",root,function() if getElementType(source) == "player" and source ~= lplayer then jugadores[source] = {} info[source] = {true,isPedInVehicle(source)} end end) addEventHandler("onClientElementStreamOut",root,function() if jugadores[source] and source ~= lplayer then for k,v in pairs(jugadores[source]) do destroyElement(v) end jugadores[source] = nil info[source] = nil end end) addEventHandler("onClientPlayerSpawn",root,function() if jugadores[source] then info[source][1] = true end end) addEventHandler("onClientPlayerWasted",root,function() if jugadores[source] then for k,v in pairs(jugadores[source]) do destruirArma(source,k) end info[source][1] = false end end) addEventHandler("onClientPlayerVehicleEnter",root,function() if jugadores[source] then for k,v in pairs(jugadores[source]) do destruirArma(source,k) end info[source][2] = true end end) addEventHandler("onClientPlayerVehicleExit",root,function() if jugadores[source] then info[source][2] = false end end) addEventHandler("onClientPreRender",root,function() for k,v in pairs(jugadores) do local x,y,z = getPedBonePosition(k,3) local rot = math.rad(90-getPedRotation(k)) local i = 15 local wep = getPedWeaponSlot(k) local ox,oy = math.cos(rot)*0.22,-math.sin(rot)*0.22 local alpha = getElementAlpha(k) for q,w in pairs(v) do if q == wep then destruirArma(k,q) else setElementRotation(w,0,70,getPedRotation(k)+90) setElementAlpha(w,alpha) if q==2 then local px,py,pz = getPedBonePosition(k,51) local qx,qy = math.sin(rot)*0.11,math.cos(rot)*0.11 setElementPosition(w,px+qx,py+qy,pz) elseif q==4 then local px,py,pz = getPedBonePosition(k,41) local qx,qy = math.sin(rot)*0.06,math.cos(rot)*0.06 setElementPosition(w,px-qx,py-qy,pz) else setElementPosition(w,x+ox,y+oy,z-0.2) setElementRotation(w,-17,-(50+i),getPedRotation(k)) i=i+15 end end end if info[k][1] and not info[k][2] then for i=1,7 do local arma = getPedWeapon(k,i) if validWeapons[arma] then if arma~=wep and arma>0 and not jugadores[k][i] then crearArma(k,arma) end end end end end end) function obtenerObjeto(arma) local m if arma > 1 and arma < 9 then m = 331 + arma elseif arma == 9 then m = 341 elseif arma == 15 then m = 326 elseif (arma > 21 and arma < 30) or (arma > 32 and arma < 39) or (arma > 40 and arma < 44) then m = 324 + arma elseif arma > 29 and arma < 32 then m = 325 + arma elseif arma == 32 then m = 372 end return m end
-
Agora aparece só o cursor do mouse e o painel não. copei algo errado? ----------------------------------------------- ---------------Script made By;[SioN]----------- ----Don't Try To remove or edit the script----- --------------Script version: 1v--------------- ----------------------------------------------- GUIEditor = { button = {}, label = {} } painel = false function painel() wnd = guiCreateWindow(497, 145, 301, 423, "Mudança de clima e tempo", false) guiWindowSetSizable(wnd, false) guiSetAlpha(wnd, 0.97) guiSetProperty(wnd, "CaptionColour", "FF0988F3") showCursor(true) close = guiCreateButton(9, 22, 24, 23, "X", false, wnd) guiSetAlpha(close, 0.80) guiSetFont(close, "default-bold-small") guiSetProperty(close, "NormalTextColour", "FFFB0000") cloud = guiCreateButton(10, 86, 130, 36, "Muito sem brilho, nebuloso", false, wnd) guiSetAlpha(cloud, 0.80) guiSetFont(cloud, "default-bold-small") guiSetProperty(cloud, "NormalTextColour", "FF243DDA") rain = guiCreateButton(9, 132, 130, 36, "Chuvoso", false, wnd) guiSetAlpha(rain, 0.80) guiSetFont(rain, "default-bold-small") guiSetProperty(rain, "NormalTextColour", "FFEC116E") sun = guiCreateButton(9, 178, 130, 37, "Quente ensolarado", false, wnd) guiSetAlpha(sun, 0.80) guiSetFont(sun, "default-bold-small") guiSetProperty(sun, "NormalTextColour", "FFF4FD00") GUIEditor.label[1] = guiCreateLabel(34, 24, 152, 21, " Fechar Janela ", false, wnd) guiSetFont(GUIEditor.label[1], "default-bold-small") guiLabelSetColor(GUIEditor.label[1], 43, 109, 207) bluesky = guiCreateButton(9, 225, 132, 36, "Céu azul claro", false, wnd) guiSetFont(bluesky, "default-bold-small") guiSetProperty(bluesky, "NormalTextColour", "FF09C0F5") sand = guiCreateButton(9, 271, 130, 37, "Tempestade de areia", false, wnd) guiSetFont(sand, "default-bold-small") guiSetProperty(sand, "NormalTextColour", "FFBD8A40") Dull = guiCreateButton(9, 318, 130, 37, "Tempo 0 céu azul", false, wnd) guiSetFont(Dull, "default-bold-small") guiSetProperty(Dull, "NormalTextColour", "FF43D12B") hot = guiCreateButton(9, 365, 130, 37, "Ensolarado, quente escaldante", false, wnd) guiSetFont(hot, "default-bold-small") guiSetProperty(hot, "NormalTextColour", "FFF35B08") morning = guiCreateButton(160, 86, 130, 36, "09:00", false, wnd) guiSetAlpha(morning, 0.80) guiSetFont(morning, "default-bold-small") guiSetProperty(morning, "NormalTextColour", "FF17DBF3") GUIEditor.label[2] = guiCreateLabel(11, 60, 129, 16, "Climas:", false, wnd) guiSetFont(GUIEditor.label[2], "default-bold-small") guiLabelSetColor(GUIEditor.label[2], 189, 176, 247) GUIEditor.label[3] = guiCreateLabel(160, 60, 122, 17, "Tempo:", false, wnd) guiSetFont(GUIEditor.label[3], "default-bold-small") guiLabelSetColor(GUIEditor.label[3], 189, 176, 247) afternoon = guiCreateButton(160, 132, 130, 36, "12:00", false, wnd) guiSetAlpha(afternoon, 0.80) guiSetFont(afternoon, "default-bold-small") guiSetProperty(afternoon, "NormalTextColour", "FF17DBF3") day = guiCreateButton(160, 179, 130, 36, "15:00", false, wnd) guiSetAlpha(day, 0.80) guiSetFont(day, "default-bold-small") guiSetProperty(day, "NormalTextColour", "FF17DBF3") beforenight = guiCreateButton(160, 225, 130, 36, "18:00", false, wnd) guiSetAlpha(beforenight, 0.80) guiSetFont(beforenight, "default-bold-small") guiSetProperty(beforenight, "NormalTextColour", "FF17DBF3") night = guiCreateButton(160, 272, 130, 36, "22:00", false, wnd) guiSetAlpha(night, 0.80) guiSetFont(night, "default-bold-small") guiSetProperty(night, "NormalTextColour", "FF17DBF3") innight = guiCreateButton(160, 365, 130, 36, "02:00", false, wnd) guiSetAlpha(innight, 0.80) guiSetFont(innight, "default-bold-small") guiSetProperty(innight, "NormalTextColour", "FF17DBF3") minuit = guiCreateButton(160, 319, 130, 36, "00:00", false, wnd) guiSetAlpha(minuit, 0.80) guiSetFont(minuit, "default-bold-small") guiSetProperty(minuit, "NormalTextColour", "FF17DBF3") GUIEditor.label[4] = guiCreateLabel(9, 403, 130, 15, "Script(v1)made by:{Sion}", false, wnd) guiSetAlpha(GUIEditor.label[4], 0.45) guiSetFont(GUIEditor.label[4], "default-small") guiLabelSetColor(GUIEditor.label[4], 154, 146, 146) end --------------------------------------------------------------- ----------------------[Closing The window]--------------------- addEventHandler("onClientGUIClick", root, -- Event function() -- Function if ( source == close ) then -- Chick guiSetVisible ( wnd , false)-- Show Window ( false = Visible! ) showCursor(false) end -- Close( if ) end -- Close Function ) -- Close Event ------------------------------------------------------------ -----------------------[Weathers]--------------------------- function onGuiClick (button, state, absoluteX, absoluteY) if (source == rain) then setWeather ( 16 ) elseif (source == sun) then setWeather ( 11 ) elseif (source == cloud) then setWeather ( 15 ) elseif (source == bluesky) then setWeather (10) elseif (source == sand) then setWeather (19) elseif (source == hot) then setWeather (18) elseif (source == Dull) then setWeather (0) end end addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) -------------------------------------------------------------------- ----------------------------[Time]---------------------------------- function onGuiClick (button, state, absoluteX, absoluteY) if (source == morning) then setTime( 09, 0 ) elseif (source == afternoon) then setTime( 12, 0 ) elseif (source == day) then setTime( 15, 0 ) elseif (source == beforenight) then setTime (18, 0) elseif (source == night) then setTime (22, 0) elseif (source == innight) then setTime (02, 0) elseif (source == minuit) then setTime (00,0) end end addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) -------------------------------------------------------------------- ----------------------[open the window]----------------------------- Fiz as modificações aqui. bindKey("f7","down", function() if painel == false then addEventHandler("onClientRender",root,painel); showCursor(true); painel = true; else showCursor(false); removeEventHandler("onClientRender",root,painel); painel = false; end end)
-
----------------------------------------------- ---------------Script made By;[SioN]----------- ----Don't Try To remove or edit the script----- --------------Script version: 1v--------------- ----------------------------------------------- GUIEditor = { button = {}, label = {} } addEventHandler("onClientResourceStart", resourceRoot, function() wnd = guiCreateWindow(497, 145, 301, 423, "Mudança de clima e tempo", false) guiWindowSetSizable(wnd, false) guiSetAlpha(wnd, 0.97) guiSetProperty(wnd, "CaptionColour", "FF0988F3") showCursor(true) close = guiCreateButton(9, 22, 24, 23, "X", false, wnd) guiSetAlpha(close, 0.80) guiSetFont(close, "default-bold-small") guiSetProperty(close, "NormalTextColour", "FFFB0000") cloud = guiCreateButton(10, 86, 130, 36, "Muito sem brilho, nebuloso", false, wnd) guiSetAlpha(cloud, 0.80) guiSetFont(cloud, "default-bold-small") guiSetProperty(cloud, "NormalTextColour", "FF243DDA") rain = guiCreateButton(9, 132, 130, 36, "Chuvoso", false, wnd) guiSetAlpha(rain, 0.80) guiSetFont(rain, "default-bold-small") guiSetProperty(rain, "NormalTextColour", "FFEC116E") sun = guiCreateButton(9, 178, 130, 37, "Quente ensolarado", false, wnd) guiSetAlpha(sun, 0.80) guiSetFont(sun, "default-bold-small") guiSetProperty(sun, "NormalTextColour", "FFF4FD00") GUIEditor.label[1] = guiCreateLabel(34, 24, 152, 21, " Fechar Janela ", false, wnd) guiSetFont(GUIEditor.label[1], "default-bold-small") guiLabelSetColor(GUIEditor.label[1], 43, 109, 207) bluesky = guiCreateButton(9, 225, 132, 36, "Céu azul claro", false, wnd) guiSetFont(bluesky, "default-bold-small") guiSetProperty(bluesky, "NormalTextColour", "FF09C0F5") sand = guiCreateButton(9, 271, 130, 37, "Tempestade de areia", false, wnd) guiSetFont(sand, "default-bold-small") guiSetProperty(sand, "NormalTextColour", "FFBD8A40") Dull = guiCreateButton(9, 318, 130, 37, "Tempo 0 céu azul", false, wnd) guiSetFont(Dull, "default-bold-small") guiSetProperty(Dull, "NormalTextColour", "FF43D12B") hot = guiCreateButton(9, 365, 130, 37, "Ensolarado, quente escaldante", false, wnd) guiSetFont(hot, "default-bold-small") guiSetProperty(hot, "NormalTextColour", "FFF35B08") morning = guiCreateButton(160, 86, 130, 36, "09:00", false, wnd) guiSetAlpha(morning, 0.80) guiSetFont(morning, "default-bold-small") guiSetProperty(morning, "NormalTextColour", "FF17DBF3") GUIEditor.label[2] = guiCreateLabel(11, 60, 129, 16, "Climas:", false, wnd) guiSetFont(GUIEditor.label[2], "default-bold-small") guiLabelSetColor(GUIEditor.label[2], 189, 176, 247) GUIEditor.label[3] = guiCreateLabel(160, 60, 122, 17, "Tempo:", false, wnd) guiSetFont(GUIEditor.label[3], "default-bold-small") guiLabelSetColor(GUIEditor.label[3], 189, 176, 247) afternoon = guiCreateButton(160, 132, 130, 36, "12:00", false, wnd) guiSetAlpha(afternoon, 0.80) guiSetFont(afternoon, "default-bold-small") guiSetProperty(afternoon, "NormalTextColour", "FF17DBF3") day = guiCreateButton(160, 179, 130, 36, "15:00", false, wnd) guiSetAlpha(day, 0.80) guiSetFont(day, "default-bold-small") guiSetProperty(day, "NormalTextColour", "FF17DBF3") beforenight = guiCreateButton(160, 225, 130, 36, "18:00", false, wnd) guiSetAlpha(beforenight, 0.80) guiSetFont(beforenight, "default-bold-small") guiSetProperty(beforenight, "NormalTextColour", "FF17DBF3") night = guiCreateButton(160, 272, 130, 36, "22:00", false, wnd) guiSetAlpha(night, 0.80) guiSetFont(night, "default-bold-small") guiSetProperty(night, "NormalTextColour", "FF17DBF3") innight = guiCreateButton(160, 365, 130, 36, "02:00", false, wnd) guiSetAlpha(innight, 0.80) guiSetFont(innight, "default-bold-small") guiSetProperty(innight, "NormalTextColour", "FF17DBF3") minuit = guiCreateButton(160, 319, 130, 36, "00:00", false, wnd) guiSetAlpha(minuit, 0.80) guiSetFont(minuit, "default-bold-small") guiSetProperty(minuit, "NormalTextColour", "FF17DBF3") GUIEditor.label[4] = guiCreateLabel(9, 403, 130, 15, "Script(v1)made by:{Sion}", false, wnd) guiSetAlpha(GUIEditor.label[4], 0.45) guiSetFont(GUIEditor.label[4], "default-small") guiLabelSetColor(GUIEditor.label[4], 154, 146, 146) end ) --------------------------------------------------------------- ----------------------[Closing The window]--------------------- addEventHandler("onClientGUIClick", root, -- Event function() -- Function if ( source == close ) then -- Chick guiSetVisible ( wnd , false)-- Show Window ( false = Visible! ) showCursor(false) end -- Close( if ) end -- Close Function ) -- Close Event ------------------------------------------------------------ -----------------------[Weathers]--------------------------- function onGuiClick (button, state, absoluteX, absoluteY) if (source == rain) then setWeather ( 16 ) elseif (source == sun) then setWeather ( 11 ) elseif (source == cloud) then setWeather ( 15 ) elseif (source == bluesky) then setWeather (10) elseif (source == sand) then setWeather (19) elseif (source == hot) then setWeather (18) elseif (source == Dull) then setWeather (0) end end addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) -------------------------------------------------------------------- ----------------------------[Time]---------------------------------- function onGuiClick (button, state, absoluteX, absoluteY) if (source == morning) then setTime( 09, 0 ) elseif (source == afternoon) then setTime( 12, 0 ) elseif (source == day) then setTime( 15, 0 ) elseif (source == beforenight) then setTime (18, 0) elseif (source == night) then setTime (22, 0) elseif (source == innight) then setTime (02, 0) elseif (source == minuit) then setTime (00,0) end end addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) -------------------------------------------------------------------- ----------------------[open the window]----------------------------- function open() guiSetVisible(wnd,not guiGetVisible(wnd)) showCursor(guiGetVisible(wnd)) end bindKey("f7","down",open) -------------------------------------------------------------------
-
g_VehicleList = {} local radioStreams = 0 local defaultRadio = "http://listen.shoutcast.com:80/RadioHunter-TheHitzChannel" addEventHandler("onResourceStart", resourceRoot, function() for i,veh in ipairs(getElementsByType("vehicle")) do g_VehicleList[veh] = { } g_VehicleList[veh].radio = false g_VehicleList[veh].radioStation = defaultRadio g_VehicleList[veh].volume = 1.0 end end ) addEventHandler("onPlayerJoin", root, function() for i,veh in ipairs(getElementsByType("vehicle")) do if g_VehicleList[veh] ~= nil then if g_VehicleList[veh].radio == true then triggerClientEvent(source, "onServerToggleRadio", root, true, g_VehicleList[veh].radioStation, veh, g_VehicleList[veh].volume) end end end end ) addEventHandler("onVehicleExplode", root, function() if g_VehicleList[source] ~= nil then if g_VehicleList[source].radio == true then triggerClientEvent("onServerToggleRadio", root, false, nil, source) g_VehicleList[source].radio = false killTimer(g_VehicleList[source].idleTimer) if radioStreams ~= 0 then radioStreams = radioStreams + 1 end end end end ) addEventHandler("onElementDestroy", root, function() if g_VehicleList[source] ~= nil then if g_VehicleList[source].radio == true then triggerClientEvent("onServerToggleRadio", root, false, nil, source) g_VehicleList[source].radio = false killTimer(g_VehicleList[source].idleTimer) if radioStreams ~= 0 then radioStreams = radioStreams + 1 end end end end ) addEvent("onPlayerToggleRadio", true) addEventHandler("onPlayerToggleRadio", root, function() if source and getElementType(source) == "player" then toggleRadio(source) end end ) function toggleRadio(player) local veh = getPedOccupiedVehicle(player) if veh then local occupants = getVehicleOccupants(veh) local seats = getVehicleMaxPassengers(veh) local playerSeat = getPedOccupiedVehicleSeat(player) if playerSeat ~= 0 and playerSeat ~= 1 then return end if g_VehicleList[veh] == nil then g_VehicleList[veh] = { } g_VehicleList[veh].radio = false g_VehicleList[veh].radioStation = defaultRadio g_VehicleList[veh].volume = 1 end if g_VehicleList[veh].radio == false then if not get("toggleAntifloodTick") or not get("streamLimit") or not get("radioEnabledIdleTime") then return end local settingToggleAntifloodTick = get("toggleAntifloodTick") local settingStreamLimit = get("streamLimit") local idleTime = get("radioEnabledIdleTime") if g_VehicleList[veh].lastTick and (getTickCount() - g_VehicleList[veh].lastTick) <= settingToggleAntifloodTick then return end if radioStreams >= settingStreamLimit then outputChatBox("*[Rádio] O limite de correntes atingiu (" .. settingStreamLimit .. ")", player, 255, 255, 255) return end local x, y, z = getElementPosition(veh) g_VehicleList[veh].radio = true g_VehicleList[veh].lastTick = getTickCount() g_VehicleList[veh].turnedOnBy = getPlayerName(player) radioStreams = radioStreams + 1 for seat = 0, seats do local occupant = occupants[seat] if occupant and getElementType(occupant) == "player" then triggerClientEvent("onServerToggleRadio", root, true, g_VehicleList[veh].radioStation, veh, g_VehicleList[veh].volume) local r, g, b = getPlayerNametagColor(player) colorHex = string.format("%02X%02X%02X", r, g, b) outputChatBox("#" .. colorHex .. "" .. getPlayerName(player) .. " #696969Rádio: [#00ff00Ligada#696969]", occupant, 0, 0, 0, true) end end else g_VehicleList[veh].radio = false radioStreams = radioStreams + 1 for seat = 0, seats do local occupant = occupants[seat] if occupant and getElementType(occupant) == "player" then triggerClientEvent("onServerToggleRadio", root, false, nil, veh, g_VehicleList[veh].volume) local r, g, b = getPlayerNametagColor(player) colorHex = string.format("%02X%02X%02X", r, g, b) outputChatBox("#" .. colorHex .. "" .. getPlayerName(player) .. " #696969Rádio: [#ff0000Desligada#696969]", occupant, 0, 0, 0, true) end end end end end addEvent("onPlayerRadioVolumeChange", true) addEventHandler("onPlayerRadioVolumeChange", root, function(currentVol, volumeUp) local veh = getPedOccupiedVehicle(source) if veh then local playerSeat = getPedOccupiedVehicleSeat(source) if playerSeat == 0 or playerSeat == 1 then if volumeUp == true then g_VehicleList[veh].volume = currentVol + 0.05 if g_VehicleList[veh].volume >= 1.00 then g_VehicleList[veh].volume = 1.00 end else g_VehicleList[veh].volume = currentVol - 0.05 if g_VehicleList[veh].volume <= 0.00 then g_VehicleList[veh].volume = 0.00 end end triggerClientEvent("onServerVolumeChangeAccept", root, veh, g_VehicleList[veh].volume) end end end ) function cmdChangeRadioURL(source, commandName, url) if not url then outputChatBox("*[Rádio] Use: setradio url", source, 255, 255, 255) return end local veh = getPedOccupiedVehicle(source) if veh then local occupants = getVehicleOccupants(veh) local seats = getVehicleMaxPassengers(veh) if g_VehicleList[veh] == nil then local x, y, z = getElementPosition(veh) g_VehicleList[veh] = { } g_VehicleList[veh].radio = true g_VehicleList[veh].lastTick = getTickCount() g_VehicleList[veh].radioStation = defaultRadio g_VehicleList[veh].volume = 1 end local playerSeat = getPedOccupiedVehicleSeat(source) if playerSeat ~= 0 and playerSeat ~= 1 then outputChatBox("*[Rádio] Você não pode mudar a rádio porquê você é passageiro!", source, 255, 255, 255) return end for seat = 0, seats do local occupant = occupants[seat] if occupant and getElementType(occupant) == "player" then g_VehicleList[veh].radioStation = url g_VehicleList[veh].changedBy = getPlayerName(source) if g_VehicleList[veh].radio == true then triggerClientEvent("onServerRadioURLChange", root, g_VehicleList[veh].radioStation, veh, g_VehicleList[veh].volume) end local r, g, b = getPlayerNametagColor(source) colorHex = string.format("%02X%02X%02X", r, g, b) outputChatBox("#" .. colorHex .. "" .. getPlayerName(source) .. " #FFFFFFMudou a Rádio!", occupant, 255, 255, 255, true) end end end end addCommandHandler("setradio", cmdChangeRadioURL)
-
function MakePlayerHeadshot( attacker, weapon, bodypart, loss ) if getElementType ( attacker ) == "ped" then if bodypart == 9 then triggerEvent( "onPlayerHeadshot", source, attacker, weapon, loss ) setPedHeadless ( source, true ) killPed( source, attacker, weapon, bodypart ) setTimer( BackUp, 900, 1, source ) end end end function MakeHeadshot( source, attacker, weapon, loss ) triggerEvent( "onPlayerHeadshot", source, attacker, weapon, loss ) killPed( source, attacker, weapon, 9 ) setPedHeadless ( source, true ) setTimer( BackUp, 900, 1, source ) end function BackUp( source ) if getElementType ( source ) == "player" then setPedHeadless ( source, false ) end end function outputHeadshotIcon (killer, weapon, bodypart) if bodypart == 9 then cancelEvent() exports.killmessages:outputMessage ( {getPlayerName(killer),{"padding",width=3},{"icon",id=weapon},{"padding",width=3},{"icon",id=256},{"padding",width=3},{"color",r=r1,g=g1,b=b1},getPlayerName(source) }, getRootElement(),r2,g2,b2) end end addEvent ( "onServerHeadshot", true ) addEventHandler( "onPlayerDamage", getRootElement(), MakePlayerHeadshot ) addEventHandler( "onPlayerKillMessage", getRootElement(), outputHeadshotIcon ) addEventHandler( "onServerHeadshot", getRootElement(), MakeHeadshot )
-
function MakePlayerHeadshot( attacker, weapon, bodypart, loss ) if getElementType ( attacker ) == "ped" then if bodypart == 9 then triggerEvent( "onPlayerHeadshot", source, attacker, weapon, loss ) setPedHeadless ( source, true ) killPed( source, attacker, weapon, bodypart ) setTimer( BackUp, 900, 1, source ) end end end function MakeHeadshot( source, attacker, weapon, loss ) triggerEvent( "onPlayerHeadshot", source, attacker, weapon, loss ) killPed( source, attacker, weapon, 9 ) setPedHeadless ( source, true ) setTimer( BackUp, 900, 1, source ) end function BackUp( source ) if getElementType ( source ) == "player" then setPedHeadless ( source, false ) end end function outputHeadshotIcon (killer, weapon, bodypart) if bodypart == 9 then cancelEvent() exports.killmessages:outputMessage ( {getPlayerName(killer),{"padding",width=3},{"icon",id=weapon},{"padding",width=3},{"icon",id=256},{"padding",width=3},{"color",r=r1,g=g1,b=b1},getPlayerName(source) }, getRootElement(),r2,g2,b2) end end addEvent ( "onServerHeadshot", true ) addEventHandler( "onPlayerDamage", getRootElement(), MakePlayerHeadshot ) addEventHandler( "onPlayerKillMessage", getRootElement(), outputHeadshotIcon ) addEventHandler( "onServerHeadshot", getRootElement(), MakeHeadshot )
