Jump to content

Castillo

Retired Staff
  • Posts

    21,935
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Castillo

  1. function fixRespawnMaps( ) local count = 0 for _, v in pairs( exports.mapmanager:getMapsCompatibleWithGamemode( exports.mapmanager:getRunningGamemode( ) ) ) do local main = xmlLoadFile( ":"..getResourceName( v ).."/meta.xml" ) if main then settings = xmlFindChild( main,"settings",0 ) local node = xmlFindChild( settings, "setting", 0 ) local i = 1 while node do if (xmlNodeGetAttribute( node, "value" ) ~= "none") then xmlNodeSetAttribute( node,"value","none" ) xmlSaveFile(main) end node = xmlFindChild( v, "setting", i ) i = i + 1 end count = count + 1 xmlUnloadFile(main) end end return count end addCommandHandler( "fixAllMaps", function( player ) if hasObjectPermissionTo( player,"function.setServerPassword",true ) then outputChatBox( "(MAPFIX) You have fixed #FFFFFF"..tostring( fixRespawnMaps( ) ).."#FF6464 maps!",player,255,100,100,true ) else outputChatBox( "(MAPFIX) You don't have the required rights to perform this action!",player,255,100,100 ) end end ) I've tested it with one map and it worked, it set the setting value from X to "none".
  2. -- script: addEventHandler("onClientResourceStart", resourceRoot, function () sound = playSound3D("music.mp3", -1687.69092, 978.33698, 17.58594, true) -- Te olvidaste de las comas separando las coordenadas. end ) -- meta.xml: "ElMota" version="1.2" type="script" name="musiqa" description="nada" showInResourceBrowser="true" />
  3. Castillo

    limit

    @Kenix: Yes, but guiGetText isn't enough, you forgot to tell him about onClientGUIChanged event. @Eshtiz: Copy the script again, I used the wrong edit box.
  4. Ayudaria que postearas el script.
  5. Castillo

    limit

    -- RANKS/WAGES lRanks = { } tRanks = { } tRankWages = { } wRanks = nil bRanksSave, bRanksClose = nil function btEditRanks(button, state) if (source==gButtonEditRanks) and (button=="left") and (state=="up") then local factionType = tonumber(getElementData(theTeam, "type")) lRanks = { } tRanks = { } tRankWages = { } guiSetInputEnabled(true) if (factionType==2) or (factionType==3) or (factionType==4) or (factionType==5) or (factionType==6) then -- factions w/ wages local width, height = 400, 620 local scrWidth, scrHeight = guiGetScreenSize() local x = scrWidth/2 - (width/2) local y = scrHeight/2 - (height/2) wRanks = guiCreateWindow(x, y, width, height, "Ranks & Wages", false) local y = 0.0525 for i=1, 16 do lRanks[i] = guiCreateLabel(0.05, y+0.0025, 0.4, 0.1, "Rank #" .. i .. " Title & Wage: ", true, wRanks) guiSetFont(lRanks[i], "default-bold-small") tRanks[i] = guiCreateEdit(0.4, y, 0.3, 0.04, arrFactionRanks[i], true, wRanks) tRankWages[i] = guiCreateEdit(0.775, y, 0.2, 0.04, tostring(arrFactionWages[i]), true, wRanks) addEventHandler("onClientGUIChanged", tRankWages[i], function(element) local number = tonumber(guiGetText(element)) if (number and number > 1500) then -- If the number in the EDIT is higher to 1500 .. guiSetText(element, 1500) -- We set it to 1500, so this way it'll never go higher. end end ,false) y = y + 0.05 end else local width, height = 400, 620 local scrWidth, scrHeight = guiGetScreenSize() local x = scrWidth/2 - (width/2) local y = scrHeight/2 - (height/2) wRanks = guiCreateWindow(x, y, width, height, "Ranks", false) local y = 0.0525 for i=1, 16 do lRanks[i] = guiCreateLabel(0.05, y+0.0025, 0.4, 0.1, "Rank #" .. i .. " Title: ", true, wRanks) guiSetFont(lRanks[i], "default-bold-small") tRanks[i] = guiCreateEdit(0.3, y, 0.6, 0.04, arrFactionRanks[i], true, wRanks) y = y + 0.05 end end bRanksSave = guiCreateButton(0.05, 0.850, 0.9, 0.075, "Save!", true, wRanks) bRanksClose = guiCreateButton(0.05, 0.940, 0.9, 0.075, "Close", true, wRanks) addEventHandler("onClientGUIClick", bRanksSave, saveRanks, false) addEventHandler("onClientGUIClick", bRanksClose, closeRanks, false) end end function saveRanks(button, state) if (source==bRanksSave) and (button=="left") and (state=="up") then local found = false local isNumber = true for key, value in ipairs(tRanks) do if (string.find(guiGetText(tRanks[key]), ";")) or (string.find(guiGetText(tRanks[key]), "'")) then found = true end end local factionType = tonumber(getElementData(theTeam, "type")) if (factionType==2) or (factionType==3) or (factionType==4) or (factionType==5) or (factionType==6) then for key, value in ipairs(tRankWages) do if not (tostring(type(tonumber(guiGetText(tRankWages[key])))) == "number") then isNumber = false end end end if (found) then outputChatBox("Your ranks contain invalid characters, please ensure it does not contain characters such as '@.;", 255, 0, 0) elseif not (isNumber) then outputChatBox("Your wages are not numbers, please ensure you entered a number and no currency symbol.", 255, 0, 0) else local sendRanks = { } local sendWages = { } for key, value in ipairs(tRanks) do sendRanks[key] = guiGetText(tRanks[key]) end if (factionType==2) or (factionType==3) or (factionType==4) or (factionType==5) or (factionType==6) then for key, value in ipairs(tRankWages) do sendWages[key] = guiGetText(tRankWages[key]) end end hideFactionMenu() if (factionType==2) or (factionType==3) or (factionType==4) or (factionType==5) or (factionType==6) then triggerServerEvent("cguiUpdateRanks", getLocalPlayer(), sendRanks, sendWages) else triggerServerEvent("cguiUpdateRanks", getLocalPlayer(), sendRanks) end end end end function closeRanks(button, state) if (source==bRanksClose) and (button=="left") and (state=="up") then if (wRanks) then destroyElement(wRanks) lRanks, tRanks, tRankWages, wRanks, bRanksSave, bRanksClose = nil, nil, nil, nil, nil, nil guiSetInputEnabled(false) end end end @Kenix: The Length is no the problem as far as I know, because he could just put $2000 if you restrict the Length to 4 digits.
  6. What are you talking about Kenix? I haven't edited your post, check the Moderator log.
  7. I would suggest you to either use (My)SQL or XML to store turfs, then load them when resource starts.
  8. Why close the topic? someone else may have a similar problem.
  9. Castillo

    limit

    I don't understand what do you mean exactly, where do you want the check?
  10. As far as I know, there's no such resource released to public, you could either learn how to script it on your own, or pay someone to do it for you. https://wiki.multitheftauto.com/wiki/Scr ... troduction https://wiki.multitheftauto.com/wiki/Int ... ng_the_GUI
  11. You can only use the SA-MP scripts using the "AMX" Emulator, also, it doesn't support 0.3 scripts.
  12. He's asking for Roleplay scripts, not for RPG server names.
  13. function IDm() IDs() if not IDT then IDT = setTimer(IDs, 86400000, 0) end end addEventHandler("onClientResourceStart", resourceRoot, IDm) function IDs() repeat ID = math.random(400, 611) until getVehicleType(ID) == "Automobile" end Shop = createMarker( -1658, 1211, 6.4, "cylinder", 1, 0, 255, 0) function ShopF(theElement) if isPedOnGround(theElement) then if not isPedInVehicle(theElement) then if (theElement ~= localPlayer) then return end -- If the player who hit the colshape isn't the client, cancel the function. CarOfTheDay = createVehicle( 411, -1655, 1209, 21 ) setElementModel(CarOfTheDay, ID or 411) if ( getVehicleType" class="kw2">getVehicleType( CarOfTheDay ) == "Automobile" ) then showCursor(true) setCameraMatrix( -1664, 1210, 22, 6000, 0, 0, 0, 0) setVehicleColor( CarOfTheDay, math.random(0,255), math.random(0,255), math.random(0,255) ) setElementFrozen( CarOfTheDay, true ) showPlayerHudComponent("all", false) LeftB = guiCreateButton(342,684,176,57,"< Left",false) guiSetFont(LeftB,"default-bold-small") RightB = guiCreateButton(737,684,176,57,"Right >",false) guiSetFont(RightB,"default-bold-small") ExitB = guiCreateButton(539,714,174,26,"Exit",false) guiSetFont(ExitB,"default-bold-small") BuyB = guiCreateButton(539,689,174,26,"Buy",false) guiSetFont(BuyB,"default-bold-small") VehicleL = guiCreateLabel(539,724,174,26,"Vehicle: " .. getVehicleNameFromModel(getElementModel(CarOfTheDay)) .. "",false) guiSetFont(VehicleL,"default-bold-small") guiLabelSetColor ( VehicleL, 0, 0, 255 ) addEventHandler( "onClientGUIClick",LeftB,LeftFEnter,false ) addEventHandler( "onClientGUIClick",RightB,RightFEnter,false ) addEventHandler( "onClientGUIClick",BuyB,BuyF,false ) addEventHandler( "onClientGUIClick",ExitB,ExitF,false ) local screenW,screenH=guiGetScreenSize() local windowW,windowH=guiGetSize(LeftB,false) local x,y = (screenW-windowW)/3.14,(screenH-windowH)/1.01 guiSetPosition(LeftB,x,y,false) local screenW,screenH=guiGetScreenSize() local windowW,windowH=guiGetSize(RightB,false) local x,y = (screenW-windowW)/1.58,(screenH-windowH)/1.01 guiSetPosition(RightB,x,y,false) local screenW,screenH=guiGetScreenSize() local windowW,windowH=guiGetSize(ExitB,false) local x,y = (screenW-windowW)/2.1,(screenH-windowH)/1.011 guiSetPosition(ExitB,x,y,false) local screenW,screenH=guiGetScreenSize() local windowW,windowH=guiGetSize(BuyB,false) local x,y = (screenW-windowW)/2.1,(screenH-windowH)/1.047 guiSetPosition(BuyB,x,y,false) local screenW,screenH=guiGetScreenSize() local windowW,windowH=guiGetSize(VehicleL,false) local x,y = (screenW-windowW)/1.95,(screenH-windowH)/1.07 guiSetPosition(VehicleL,x,y,false) else outputChatBox( "No car found, please re-enter the marker", 255, 0, 0 ) destroyElement(CarOfTheDay) return end end end end addEventHandler("onClientMarkerHit",Shop,ShopF) function LeftFEnter() if isElement( CarOfTheDay ) then local RX, RY, RZ = getElementRotation( CarOfTheDay ) setElementRotation(CarOfTheDay, RX, RY, RZ + 10) end end function RightFEnter() if isElement( CarOfTheDay ) then local RX, RY, RZ = getElementRotation( CarOfTheDay ) setElementRotation(CarOfTheDay, RX, RY, RZ - 10) end end function BuyF() CW = guiCreateWindow(470,244,543,180,"Confirmation",false) CL = guiCreateLabel(2,47,545,20,"Are you sure you want to buy this car for $3.000?",false,CW) guiLabelSetColor(CL,0,255,0) guiLabelSetHorizontalAlign(CL,"center",false) guiSetFont(CL,"default-bold-small") YesB = guiCreateButton(59,115,159,39,"Yes",false,CW) NoB = guiCreateButton(322,115,159,39,"No",false,CW) addEventHandler("onClientGUIClick",NoB,NoF,false) addEventHandler("onClientGUIClick",YesB,YesF,false) local screenW,screenH=guiGetScreenSize() local windowW,windowH=guiGetSize(CW,false) local x,y = (screenW-windowW)/2,(screenH-windowH)/2 guiSetPosition(CW,x,y,false) end function NoF() destroyElement(CW) end function YesF() destroyElement(CW) destroyElement(LeftB) destroyElement(RightB) destroyElement(ExitB) destroyElement(BuyB) destroyElement(VehicleL) showPlayerHudComponent("all", true) setCameraTarget(localPlayer) showCursor(false) colr1, colg1, colb1, colr2, colg2, colb2, colr3, colg3, colb3, colr4, colg4, colb4 = getVehicleColor(CarOfTheDay, true) Model = getElementModel(CarOfTheDay) destroyElement(CarOfTheDay) triggerServerEvent("spawnCar",getRootElement(),localPlayer, Model, colr1, colg1, colb1, colr2, colg2, colb2, colr3, colg3, colb3, colr4, colg4, colb4) showCursor(false) end function onStop() setCameraTarget(localPlayer) end addEventHandler("onClientResourceStop",resourceRoot,onStop) function ExitF() if not CW then destroyElement(LeftB) destroyElement(RightB) destroyElement(ExitB) destroyElement(BuyB) destroyElement(VehicleL) destroyElement(CarOfTheDay) showPlayerHudComponent("all", true) setCameraTarget(localPlayer) showCursor(false) elseif CW then destroyElement(LeftB) destroyElement(RightB) destroyElement(ExitB) destroyElement(BuyB) destroyElement(VehicleL) destroyElement(CarOfTheDay) destroyElement(CW) showPlayerHudComponent("all", true) setCameraTarget(localPlayer) showCursor(false) end end
  14. local screenWidth, screenHeight = guiGetScreenSize() local timer, state function repairVehicle() local theVehicle = getPedOccupiedVehicle( localPlayer ) if theVehicle then dxDrawText("Pojazd zostal naprawiony! (Koszt: $2500)", screenWidth*0.5, screenHeight*0.1, screenWidth*0.5, screenHeight*0.5, tocolor(255,0,0,210), 1.0, "bankgothic", "center", "center", false, false, false) else dxDrawText("Musisz znajdowac sie w pojezdzie!", screenWidth*0.5, screenHeight*0.1, screenWidth*0.5, screenHeight*0.5, tocolor(255,0,0,210), 1.0, "bankgothic", "center", "center", false, false, false) end end function drawNoMoneyText() dxDrawText("Nie posiadasz $2500 na naprawe!", screenWidth*0.5, screenHeight*0.1, screenWidth*0.5, screenHeight*0.5, tocolor(255,0,0,210), 1.0, "bankgothic", "center", "center", false, false, false) end function drawAnotherText() dxDrawText("Odczekaj 5 sekund!", screenWidth*0.5, screenHeight*0.1, screenWidth*0.5, screenHeight*0.5, tocolor(255,0,0,210), 1.0, "bankgothic", "center", "center", false, false, false) end bindKey( '2','down', function() if (not state) then if (getPlayerMoney() >= 2500) then takePlayerMoney(2500) else addEventHandler("onClientRender",root,drawNoMoneyText) end if isTimer(timer) then return end local theVehicle = getPedOccupiedVehicle( localPlayer ) if theVehicle then fixVehicle( theVehicle ) end addEventHandler( 'onClientRender',root,repairVehicle ) state = true timer = setTimer( function() addEventHandler("onClientRender",root,drawAnotherText) removeEventHandler( 'onClientRender',root,repairVehicle ) state = false end, 5000,1 ) end end )
  15. Vuelvan al tema o tendre que cerrarlo.
  16. El archivo "race-[dm]Adrenalina-Emotiva.map" existe?
  17. El script que te cree tiene para 2 puertas, vos podes agregar mas de la misma manera que yo.
  18. Claro que es posible. Puerta = createObject ( 2669, 2492.69921875, -1671.19921875, 13.699999809265, 0, 0, 0) PuertaBar = createObject ( 3036, 2584.3994140625, -1414.599609375, 25, 0, 353.99597167969, 90) Puerta2 = createObject ( 2933, 1588.4000244141, -1638, 14, 0, 0, 0) Elevador = createObject ( 2669, 1560.7674560547, -1324.4055175781, 17, 0, 0, 0) Base = createObject ( 980, 3060, -705, 13.199999809265, 0, 0, 90) Base2 = createObject ( 980, 3060, -716.59997558594, 13.199999809265, 0, 0, 90) Basef = createObject ( 3115, -1770.3000488281, 982.09997558594, 31, 90, 0, 270) BaseR = createObject ( 8673, 997.20001220703, 2133.3999023438, 11.5, 0, 0, 90) BaseM = createObject ( 8673, -2438.1999511719, 1542, 16.200000762939, 90, 0, 90) function abrirBaseM(player) local accName = getAccountName ( getPlayerAccount ( player ) ) -- get his account name if isObjectInACLGroup ("user.".. accName, aclGetGroup ( "Everyone" ) ) then -- Aca pusiste "Everyone". moveObject(BaseM,5000 , -2438.1999511719, 1560, 16.200000762939) end end addCommandHandler("abrirmt", abrirBaseM) function cerrarBaseM(player) local accName = getAccountName ( getPlayerAccount ( player ) ) -- get his account name if isObjectInACLGroup ("user.".. accName, aclGetGroup ( "Everyone" ) ) then -- Aca pusiste "Everyone". moveObject(BaseM,5000 , -2438.1999511719, 1542, 16.200000762939) end end addCommandHandler("cerrarmt", cerrarBaseM) function abrirBaseR(player) local accName = getAccountName ( getPlayerAccount ( player ) ) -- get his account name if isObjectInACLGroup ("user.".. accName, aclGetGroup ( "Everyone" ) ) then -- Aca pusiste "Everyone". moveObject(BaseR,5000 , 997.20001220703, 2113.3, 11.300000190735) end end addCommandHandler("abrirr", abrirBaseR) function cerrarBaseR(player) local accName = getAccountName ( getPlayerAccount ( player ) ) -- get his account name if isObjectInACLGroup ("user.".. accName, aclGetGroup ( "Everyone" ) ) then -- Aca pusiste "Everyone". moveObject(BaseR,5000 , 997.20001220703, 2133.3999023438, 11.300000190735) end end addCommandHandler("cerrarr", cerrarBaseR) function abrirBasef(player) local accName = getAccountName ( getPlayerAccount ( player ) ) -- get his account name if isObjectInACLGroup ("user.".. accName, aclGetGroup ( "Everyone" ) ) then -- Aca pusiste "Everyone". moveObject(Basef,5000 , -1770.3000488281, 982.09997558594, 13) end end addCommandHandler("abrirf", abrirBasef) function cerrarBasef(player) local accName = getAccountName ( getPlayerAccount ( player ) ) -- get his account name if isObjectInACLGroup ("user.".. accName, aclGetGroup ( "Admin" ) ) then -- Aca pusiste "Everyone". moveObject(Basef,5000 , -1770.3000488281, 982.09997558594, 31) end end addCommandHandler("cerrarf", cerrarBasef) function abrirBase(player) local accName = getAccountName ( getPlayerAccount ( player ) ) -- get his account name if isObjectInACLGroup ("user.".. accName, aclGetGroup ( "Admin" ) ) then -- Aca pusiste "Everyone". moveObject(Base,5000 , 3060, -705, 18) moveObject(Base2,5000 , 3060, -716.59997558594, 18) end end addCommandHandler("abrirbasels", abrirBase) function cerrarBase(player) local accName = getAccountName ( getPlayerAccount ( player ) ) -- get his account name if isObjectInACLGroup ("user.".. accName, aclGetGroup ( "Admin" ) ) then -- Aca pusiste "Everyone". moveObject(Base,5000 , 3060, -705, 13.199999809265) moveObject(Base2,5000 , 3060, -716.59997558594, 13.199999809265) end end addCommandHandler("cerrarbasels", cerrarBase) function abrirPuertaBar(player) local accName = getAccountName ( getPlayerAccount ( player ) ) -- get his account name if isObjectInACLGroup ("user.".. accName, aclGetGroup ( "Everyone" ) ) then -- Aca pusiste "Everyone". moveObject(PuertaBar,5000 , 2584.3994140625, -1414.599609375, 20) end end addCommandHandler("abrirbar", abrirPuertaBar) function cerrarPuertaBar(player) local accName = getAccountName ( getPlayerAccount ( player ) ) -- get his account name if isObjectInACLGroup ("user.".. accName, aclGetGroup ( "Everyone" ) ) then -- Aca pusiste "Everyone". moveObject(PuertaBar,5000 , 2584.3994140625, -1414.599609375, 25) end end addCommandHandler("cerrarbar", cerrarPuertaBar) function subirElevador(player) local accName = getAccountName ( getPlayerAccount ( player ) ) -- get his account name if isObjectInACLGroup ("user.".. accName, aclGetGroup ( "Everyone" ) ) then -- Aca pusiste "Everyone". moveObject(Elevador,5000 , 1560.7674560547, -1324.4055175781, 330.39999389648) end end addCommandHandler("subirT", subirElevador) function bajarElevador(player) local accName = getAccountName ( getPlayerAccount ( player ) ) -- get his account name if isObjectInACLGroup ("user.".. accName, aclGetGroup ( "Everyone" ) ) then -- Aca pusiste "Everyone". moveObject(Elevador,5000 , 1560.7674560547, -1324.4055175781, 0) end end addCommandHandler("bajarT", bajarElevador) function abrirPuerta(player, cmd, ID) local ID = tonumber(ID) local accName = getAccountName ( getPlayerAccount ( player ) ) -- get his account name if (ID and type(ID) == "number" and isObjectInACLGroup ("user.".. accName, aclGetGroup ( "Everyone" ) )) then if (ID == 1) then moveObject(Puerta,5000 , 2492.69921875, -1671.19921875, 40) elseif (ID == 2) then moveObject(Puerta2,5000 , 1588.4000244141, -1638, 20) end end end addCommandHandler("abrir",abrirPuerta) function cerrarPuerta(player, cmd, ID) local ID = tonumber(ID) local accName = getAccountName ( getPlayerAccount ( player ) ) -- get his account name if (ID and type(ID) == "number" and isObjectInACLGroup ("user.".. accName, aclGetGroup ( "Everyone" ) )) then if (ID == 1) then moveObject(Puerta,5000 , 2492.69921875, -1671.19921875, 13.699999809265) elseif (ID == 2) then moveObject(Puerta2,5000 , 1588.4000244141, -1638, 14) end end end addCommandHandler("cerrar",cerrarPuerta) Comandos: /abrir /cerrar
  19. You're welcome . Good luck with your server .
  20. No, yo digo como una ID. Si la ID introducida es 1, abrir la puerta 1.
  21. Decis como: /abrir 1: /cerrar 2?
×
×
  • Create New...