Jump to content

TwiX!

Members
  • Posts

    905
  • Joined

  • Last visited

Everything posted by TwiX!

  1. @Tapl, but admin panel can use only admins or mods
  2. local rObjects = { [3458] = true,[8558] = true }; -- Radar objects function getObjectsInMyDistance() rObjectsTabele = {}; local pX,pY,pZ = getElementPosition(localPlayer); if not pX or not pY or not pZ then return end for _,object in ipairs(getElementsByType("object")) do local id = getElementModel(object); if rObjects[id] then local eX,eY,eZ = getElementPosition(object); if not eX or not eY or not eZ then return end local distance = getDistanceBetweenPoints2D(pX,pY,eX,eY); if distance < 180 then table.insert(rObjectsTabele,object); end end end return rObjectsTabele; end addEventHandler("onClientRender",getRootElement(), function() local pX,pY,pZ = getElementPosition(localPlayer); local cX,cY,_,tX,tY = getCameraMatrix(); local n = findRotation(cX,cY,tX,tY); for _,object in ipairs(getObjectsInMyDistance()) do local oX,oY,oZ = getElementRotation(object); local id = getElementModel(object); local eX,eY,eZ = getElementPosition(object); if id == 3458 then img = "yourImage.png"; --Here you can set rotation for object elseif id == 8558 then img = "YouImageForThisID.png"; --Here you can set rotation for object end dxDrawImage(yourX,yourY,yourWidth,yourHeight,img,n-oZ,0,0,tocolor(255,255,255,255)); --Or dxDrawLine end end ); function findRotation(x1,y1,x2,y2) local t = -math.deg(math.atan2(x2-x1,y2-y1)); if t < 0 then t = t + 360; end return t end something like this don't forget to change "yourX","yourY","yourWidth","yourHeight"
  3. this map looks pretty nice can i have this map? pm me
  4. check this: https://wiki.multitheftauto.com/wiki/RemoveWorldModel
  5. https://community.multitheftauto.com/index.php?p= ... ls&id=5789 Troll resource https://community.multitheftauto.com/index.php?p= ... ls&id=5800 Veh mod https://community.multitheftauto.com/index.php?p= ... ls&id=5799 veh mod https://community.multitheftauto.com/index.php?p= ... ls&id=5798 veh mod https://community.multitheftauto.com/index.php?p= ... ls&id=5797 veh mod https://community.multitheftauto.com/index.php?p= ... ls&id=5783 no desc DONE
  6. try server --[[ Para se drogar, diriga-se a respetiva loja, marcada no mapa, compre a quantidade que quiser por um determinado dinheiro, ira ter varios efeitos visuais, esp. que goste! ]]-- function restoreWeather() local ww,bb = getWeather(); triggerClientEvent("setWeatherForAll",source,ww); end addEvent("restoreWeather",true) addEventHandler("restoreWeather",getRootElement(),restoreWeather) function takeHisMoney(thePlayer,money) if not thePlayer or not money then return end takePlayerMoney(thePlayer,tonumber(money)); end addEvent("doTakeMoney",true) addEventHandler("doTakeMoney",getRootElement(),takeHisMoney) Client local dButtons = {}; local missionSelectWindow = {}; local dUtils = {}; dUtils.roll = 0; dUtils.rollGrow = false; --[[function startDrug2() startDrug(4) end function stopDrug2() stopDrug() end addCommandHandler("sd", startDrug2) addCommandHandler("sds", stopDrug2)--]] -- this fires when player hits the marker function missionSelect(hitPlayer,matchingDimension) if (hitPlayer == localPlayer) and (isPedOnGround (localPlayer) and not isPedInVehicle(hitPlayer)) then if isDrugActive then outputChatBox("Tu ja estas drogado. Queres morrer?",255,0,0); else guiSetVisible(missionSelectWindow[1],true); guiBringToFront(missionSelectWindow[1]); showCursor(true); end end end addEventHandler ("onClientResourceStart", getResourceRootElement(getThisResource()), function() local missionElements = getElementsByType ("drugstore",getResourceRootElement(getThisResource())); num = 0; drugMarker = {}; drugSphere = {}; drugBlip = {}; for key,val in ipairs(missionElements) do num = num+1; local tmpX = getElementData(val,"posX"); local tmpY = getElementData(val,"posY"); local tmpZ = getElementData(val,"posZ"); drugMarker[num] = createMarker(tmpX,tmpY,tmpZ,"cylinder",2,255,34,23); drugSphere[num] = createColSphere(tmpX,tmpY,tmpZ,2); drugBlip[num] = createBlip(tmpX,tmpY,tmpZ,22,2,0,0,0,255,100,360); addEventHandler("onClientColShapeHit",drugSphere[num],missionSelect); end missionSelectWindow[1] = guiCreateWindow(0.35,0.15,0.3162,0.5717,"Loja de Drogas",true); guiWindowSetSizable(missionSelectWindow[1],false); dButtons[1] = guiCreateButton(0.08,0.20,0.84,0.1,"Droga Leve [1 min-$1000]",true,missionSelectWindow[1]); dButtons[2] = guiCreateButton(0.08,0.35,0.84,0.1,"Droga Media [3 mins-$3000]",true,missionSelectWindow[1]); dButtons[3] = guiCreateButton(0.08,0.50,0.84,0.1,"Droga Pesada [6 mins-$5000]",true,missionSelectWindow[1]); dButtons[4] = guiCreateButton(0.08,0.65,0.84,0.1,"Droga Excessiva [10mins-$8000]",true,missionSelectWindow[1]); dButtons[5] = guiCreateButton(0.08,0.90,0.84,0.1,"Sair",true,missionSelectWindow[1]); missionSelect_Label1 = guiCreateLabel(0.08,0.1,0.84,0.1,"Selecionar Droga",true,missionSelectWindow[1]); guiLabelSetVerticalAlign(missionSelect_Label1,"top"); guiLabelSetHorizontalAlign(missionSelect_Label1,"center",false); guiSetVisible (missionSelectWindow[1], false); addEventHandler ("onClientGUIClick",getResourceRootElement(getThisResource()),onGUIClick); end ) function onGUIClick(button,state) local money = getPlayerMoney(); if source == dButtons[1] then if (money >= 1000) then startDrug(1*60*1000); triggerServerEvent("doTakeMoney",localPlayer,localPlayer,5000); else outputChatBox("Nao tens dinheiro suficiente!",255,0,0); end elseif source == dButtons[2] then if (money >= 3000) then startDrug(3*60*1000); triggerServerEvent("doTakeMoney",localPlayer,localPlayer,10000); else outputChatBox("Nao tens dinheiro suficiente!",255,0,0); end elseif source == dButtons[3] then if (money >= 5000) then startDrug(6*60*1000); triggerServerEvent("doTakeMoney",localPlayer,localPlayer,15000); else outputChatBox("Nao tens dinheiro suficiente!",255,0,0); end elseif source == dButtons[4] then if (money >= 8000) then startDrug(10*60*1000); triggerServerEvent("doTakeMoney",localPlayer,localPlayer,20000); else outputChatBox("Nao tens dinheiro suficiente!",255,0,0); end elseif source == dButtons[5] then guiSetVisible(missionSelectWindow[1],false); showCursor(false); end guiSetVisible(missionSelectWindow[1],false); showCursor(false); end function startDrug(time) fadeCamera(false,0.0) setTimer( function(time) if (time == nil) then time = 10*1000 else if (tonumber(time) < 5000) then tiaaame = 10*1000 end end timerWeather = setTimer(function() timeCheck() end, 1000); timerFades = setTimer(function() fades() end, 4000); isDrugActive = true; setTimer(function() fall() end, 1000, 1); addEventHandler("onClientRender",getRootElement(),drugSteer); addEventHandler("onClientPreRender",getRootElement(),drugCam); setTimer(function() stopDrug() end,time,1); end, 1500, 1 ); end function timeCheck() local hh,mm = getTime(); if (hh <7 ) then local ww,bb = getWeather(); if (ww ~= -52123) then setWeather(-52123); -- WHAT THE HELL? end else local ww,bb = getWeather(); if (ww ~= 190) then setWeather(190); end end end function fades() local rnd = math.random(2,4); fadeCamera(false,rnd,math.random(1,255),math.random(1,255),math.random(1,255)); local xx,yy,zz = getElementPosition(localPlayer); setTimer(function() fadeCamera(true,1) end, rnd*1000/2, 1); end function fall() if (isDrugActive) then setPedAnimation(localPlayer,"ped","getup_front",1000,false,false); setTimer(function() fall() end, math.random(10000,30000),1); setTimer(function() setControlState('jump',true) end,1500,1); setTimer(function() setControlState('jump',false) end,2000,1); end end function drugSteer() left = false; right = false; up = false; down = false; local keys = getBoundKeys ('vehicle_left'); if keys then tmpLeft = false; for keyName, state in pairs(keys) do if (getKeyState(keyName)) then tmpLeft = true; end end if tmpLeft then left = true; right = false; end end local keys = getBoundKeys ('vehicle_right'); if keys then tmpRight = false; for keyName, state in pairs(keys) do if (getKeyState(keyName)) then tmpRight = true; end end if tmpRight then left = false; right = true; end end if (left) then setControlState('vehicle_left',false); setControlState('vehicle_right',true); elseif (right) then setControlState('vehicle_right',false); setControlState('vehicle_left',true); else setControlState('vehicle_right',false); setControlState('vehicle_left',false); end local keys = getBoundKeys ('accelerate'); if keys then tmpUp = false for keyName, state in pairs(keys) do if (getKeyState(keyName)) then tmpUp = true; end end if tmpUp then down = false; up = true; end end local keys = getBoundKeys ('brake_reverse'); if keys then tmpDown = false for keyName, state in pairs(keys) do if (getKeyState(keyName)) then tmpDown = true; end end if tmpDown then down = true; up = false; end end if (up) then setControlState('accelerate',false); setControlState('brake_reverse',true); elseif (down) then setControlState('brake_reverse',false); setControlState('accelerate',true); else setControlState('brake_reverse',false); setControlState('accelerate',false); end end function drugCam() if (dUtils.rollGrow) then if (dUtils.roll > 15) then dUtils.rollGrow = false; end dUtils.roll = dUtils.roll + 1; else if (dUtils.roll < -15) then dUtils.rollGrow = true; end dUtils.roll = dUtils.roll -1; end local xx,yy,zz = getElementPosition(localPlayer); local rot = getPedRotation(localPlayer); local lx = xx + math.sin (math.rad(-rot)) * -10; local ly = yy + math.cos (math.rad(-rot)) * -10; setCameraMatrix(lx,ly,zz + 4,xx,yy,zz,dUtils.roll); fxAddBlood(xx,yy,zz,0,0,0,6); end function stopDrug() if isTimer(timerFades) then killTimer(timerFades); end if isTimer(timerWeather) then killTimer(timerWeather); end isDrugActive = false;
  7. function createMarkers() GUIMarker = createMarker(-2032.349609375,-101.84552764893,34.110488891602,"cylinder",1,247,7,7,255); end addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),createGUIandMarkers) function markerEnter(element) if element == localPlayer then if not isPedInVehicle(localPlayer) then if source == GUIMarker then guiSetVisible(yourWindow,true); showCursor(true); end end end end addEventHandler("onClientMarkerHit",getRootElement(),markerEnter) Don't forget change "yourWindow" and X,Y,Z of marker
  8. TwiX!

    Problem

    you're welcome
  9. TwiX!

    Problem

    my script not will have errors
  10. https://wiki.multitheftauto.com/wiki/XmlFindChild
  11. TwiX!

    Problem

    function kill(attacker,fist,bodypart,loss) local weapon = getPedWeapon(attacker); if weapon == 0 then if bodypart then local result = triggerEvent("onPlayerFistshot",source,attacker,fist,loss); if result == true then killPed(source,attacker,0,3); end end end end addEvent("onPlayerFistshot",true) addEventHandler("onPlayerDamage",root,kill)
  12. Client --Some vars --Author TwiX [[Don't Remove This Line]] local sW,sH = guiGetScreenSize(); local gUtils = {}; gUtils.guiW,gUtils.guiH = 398,341; gUtils.posX,gUtils.posY = sW/2-gUtils.guiW/2,sH/2-gUtils.guiH/2; --Center of screen for all resolutions local gLabels = {}; function onresourceStart() gWindow = guiCreateWindow(gUtils.posX,gUtils.posY,gUtils.guiW,gUtils.guiH,"Map Shop",false); gLabels[1] = guiCreateLabel(206,30,161,19,"Money:",false,gWindow); gLabels[2] = guiCreateLabel(206,49,100,16,"A Map Costs 5000$",false,gWindow); gLabels[3] = guiCreateLabel(206,66,82,15,"Selected Map:",false,gWindow); gLabels[4] = guiCreateLabel(206,106,188,22,"Buy Maps Shop by TwiX",false,gWindow); gUtils[1] = guiCreateLabel(206,86,188,22,"Please select any map",false,gWindow); guiLabelSetColor(gUtils[1],171,205,239) for _,label in ipairs (gLabels) do guiSetFont(label,"default-bold-small"); if label == gLabels[3] then guiLabelSetColor(gLabels[3],0,255,0); end end gButton = guiCreateButton(207,291,182,35,"Buy as next map",false,gWindow); gGridList = guiCreateGridList(11,32,191,395,false,gWindow); guiGridListSetSelectionMode(gGridList,2); gColumn = guiGridListAddColumn(gGridList,"Name:",0.85); guiSetVisible (gWindow,false); addEventHandler ("onClientGUIClick",getResourceRootElement(getThisResource()),somethingFromClick); bindKey ("F1","down",showPanel); end addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),onresourceStart) function showPanel() if guiGetVisible(gWindow) then guiSetVisible(gWindow,false); showCursor(false); else triggerServerEvent ("doRefreshMapList",localPlayer,localPlayer); guiSetVisible (gWindow,true); showCursor(true); local playerMoney = getPlayerMoney(); guiSetText(gLabels[1],"Money: [ "..playerMoney.." ]"); end end function somethingFromClick(button,state) if source == gButton then local row = guiGridListGetSelectedItem(gGridList); local mapName = guiGridListGetItemText(gGridList,row,gColumn); triggerServerEvent("doBuyMap",localPlayer,localPlayer,mapName); elseif source == gGridList then local selectedMap = guiGridListGetSelectedItem(gGridList); local row = guiGridListGetSelectedItem(gGridList); local mapName = guiGridListGetItemText(gGridList,row,gColumn); if selectedMap == -1 then guiSetText(gUtils[1],"Error! Please Select any map"); return end guiSetText(gUtils[1],mapName); end end function setMapNameInGrid(gamemodeMapTable,gamemode,map,s) guiGridListClear(gGridList); if gamemodeMapTable then aGamemodeMapTable = gamemodeMapTable; for id,gamemode in pairs (gamemodeMapTable) do if (gamemode.name == "Race") then for id,map in ipairs (gamemode.maps) do if s then if string.find(string.lower(map.name),string.lower(s)) then local row = guiGridListAddRow (gGridList); guiGridListSetItemText(gGridList,row,gColumn,map.name,false,false); guiGridListSetItemData (gGridList,row,gColumn,map.resname); end else local row = guiGridListAddRow (gGridList); guiGridListSetItemText (gGridList,row,gColumn,map.name,false,false); guiGridListSetItemData (gGridList,row,gColumn,map.resname); end end end end end end addEvent("refreshCompleted",true) addEventHandler( "refreshCompleted",getRootElement(),setMapNameInGrid) --fileDelete ('YOUR SCRIPT NAME HERE.lua') Server --Vars local price = 5000; function rStart() pHasBought = false; end addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),rStart) function buyNextMap(player,mapName) if not player or not mapName then return end if (isGuestAccount(getPlayerAccount(player)) == false) then if pHasBought == false then local money = tonumber(getPlayerMoney(player)); if money >= price then executeCommandHandler("bm",player,mapName); --This function need admin rights pHasBought = true else outputChatBox("* You #abcdefdon't #ffffffhave enough #abcdefmoney #ffffffto buy the map!",player,255,255,255,true); end else outputChatBox("* A #abcdefmap #ffffffis already bought at the moment! Please #abcdeftry #ffffffagain later",player,255,255,255,true); end else outputChatBox("* You should be #abcdeflogged in to buy the map!",player,255,255,255,true); end end addEvent("doBuyMap",true) addEventHandler("doBuyMap",getRootElement(),buyNextMap) addEvent("onMapStarting") addEventHandler("onMapStarting",getRootElement(), function(mapInfo,mapOptions,gameOptions) pHasBought = false end ) --Functions by Admin Panel (lil_Toady) function getAllMaps(loadList,s) local tableOut if loadList then tableOut = {}; local gamemodes = {}; gamemodes = call(getResourceFromName("mapmanager"),"getGamemodes"); for id,gamemode in ipairs (gamemodes) do tableOut[id] = {}; tableOut[id].name = getResourceInfo(gamemode,"name") or getResourceName(gamemode); tableOut[id].resname = getResourceName(gamemode); tableOut[id].maps = {}; local maps = call(getResourceFromName("mapmanager"),"getMapsCompatibleWithGamemode",gamemode); for _,map in ipairs (maps) do table.insert(tableOut[id]["maps"],{name = getResourceInfo(map,"name") or getResourceName(map),resname = getResourceName(map)}); end table.sort(tableOut[id]["maps"],sortCompareFunction); end table.sort((tableOut),sortCompareFunction); table.insert(tableOut,{name = "no gamemode",resname = "no gamemode",maps = {}}); local countGmodes = #tableOut; local maps = call(getResourceFromName("mapmanager"),"getMapsCompatibleWithGamemode"); for id,map in ipairs (maps) do table.insert(tableOut[countGmodes]["maps"],{name = getResourceInfo(map, "name") or getResourceName(map),resname = getResourceName(map)}); end table.sort(tableOut[countGmodes]["maps"],sortCompareFunction); end local map = call(getResourceFromName("mapmanager"),"getRunningGamemodeMap"); local gamemode = call(getResourceFromName("mapmanager"),"getRunningGamemode"); gamemode = gamemode and getResourceName(gamemode) or "N/A"; map = map and getResourceName(map) or "N/A"; triggerClientEvent("refreshCompleted",loadList,tableOut,gamemode,map,s); end addEvent("doRefreshMapList",true) addEventHandler( "doRefreshMapList",getRootElement(),getAllMaps) function sortCompareFunction(s1, s2) if type(s1) == "table" and type(s2) == "table" then s1,s2 = s1.name,s2.name; end s1,s2 = s1:lower(),s2:lower(); if s1 == s2 then return false end local byte1,byte2 = string.byte(s1:sub(1,1)),string.byte(s2:sub(1,1)); if not byte1 then return true elseif not byte2 then return false elseif byte1 < byte2 then return true elseif byte1 == byte2 then return sortCompareFunction(s1:sub(2),s2:sub(2)); else return false end end Add in racevoting_server.lua code: addCommandHandler('bm', function(player,command,...) local query = #{...} > 0 and table.concat({...},' ') or nil if not query then if g_ForcedNextMap then outputDebugString('Next map is '..getMapName(g_ForcedNextMap )); else outputDebugString('Next map is not set'); end return end local map,errormsg = findMap(query); if not map then outputRace( errormsg,player); return end if (isGuestAccount(getPlayerAccount(player)) == false) then g_ForcedNextMap = map; outputChatBox('* '..getPlayerName(player)..' #ffffffhas bought as next map - #ABCDEF'..getMapName(g_ForcedNextMap),g_Root,0,240,0,true); takePlayerMoney(player,5000); else outputChatBox("* Please #abcdefLogin #ffffffor #abcdefRegister!",player,255,255,255,true); end end ) You can find it there: /resources/[gamemodes]/[race]/race Don't forget add admin rights for this resource or https://community.multitheftauto.com/ind ... ls&id=5801
  13. if exports.vip_system:isPlayerVIP(player) then Rofl! function isPlayerVIP(player) return getElementData(player,"VIP"); end if isPlayerVIP(player) then --etc end or it's hard for u? need make over 999999999999 arguments lol and export CURRENT Resource i mean your code
  14. Server local markers = { ["showGui1"] = createMarker (295.239,-37.58,1000.515,"cylinder",1.5,0,0,225,100), ["showGui2"] = createMarker (295.48,-80.38,1000.51,"cylinder",1.5,0,0,225,100), ["showGui3"] = createMarker (290.28,-109.35,1000.51,"cylinder",1.5,0,0,225,100); }; setElementInterior (markers["showGui1"],1); setElementInterior (markers["showGui2"],4); setElementInterior (markers["showGui3"],6); function onMarketHit(jugador) if (source == markers["showGui1"]) then triggerClientEvent ("showGUI",jugador); elseif (source == markers["showGui2"]) then triggerClientEvent ("showGUI",jugador); elseif (source == markers["showGui3"]) then triggerClientEvent ("showGUI",jugador); if source == marker then triggerClientEvent ("showGUI",jugador); end end end addEventHandler ("onMarkerHit",getRootElement(),onMarketHit) Client: function showGUIbyClient() guiSetVisible (GUIEditor_Window[1],true); showCursor(true); end addEvent ("showGUI",true) addEventHandler ("showGUI",getRootElement(),showGUIbyClient)
  15. function showGUI_Client() guiSetVisible (GUIEditor_Window[1],true) showCursor (true) end addEvent ("showGUI",true) addEventHandler ("showGUI",getRootElement(),showGUI_Client)
  16. you can get X,Y,Z from object, and draw line
  17. getElementsByType Type object Then you can replace and draw image (this object) dxDrawImage or dxDrawLine
  18. сколько вы готовы заплатить?
  19. https://wiki.multitheftauto.com/wiki/SetElementDimension use [lua] [ /lua] tags
×
×
  • Create New...