Jump to content

DNL291

Retired Staff
  • Posts

    3,875
  • Joined

  • Days Won

    67

Everything posted by DNL291

  1. Store the dxImage position in a variable and just use that variable to get the value.
  2. Try this: Client: local spawnMarker = createMarker(1541, -1627.4000244141, 12.60000038147, "cylinder", 2, 225, 163, 25, 225) function carGui () mainWindow = guiCreateWindow(266, 103, 277, 374, "Spawn Window for u", false) guiSetVisible(mainWindow, false) carsG = guiCreateGridList(9, 28, 258, 284, false, mainWindow) guiGridListAddColumn(carsG, "cars", 0.9) for i = 1, 2 do guiGridListAddRow(carsG) end guiGridListSetItemText(carsG, 0, 1, "sabre", false, false) guiGridListSetItemText(carsG, 1, 1, "Nrg-500", false, false) spawnButton = guiCreateButton(9, 320, 128, 44, "spawn", false, mainWindow) guiSetFont(spawnButton, "sa-header") cancelButton = guiCreateButton(144, 322, 123, 42, "cancel", false, mainWindow) guiSetFont(cancelButton, "sa-header") end addEventHandler("onClientResourceStart", resourceRoot, carGui) addEventHandler("onClientGUIClick", root, function () if (source == spawnButton) then local row,col = guiGridListGetSelectedItem(carsG) if (row and col and row ~= -1 and col ~= -1) then local vehicleName = guiGridListGetItemText(carsG, row, 1) if vehicleName == "sabre" then triggerServerEvent("onSpawnVehicle", localPlayer, 475) showWindow(false) elseif vehicleName == "Nrg-500" then triggerServerEvent("onSpawnVehicle", localPlayer, 522) showWindow(false) end else outputChatBox("Select a vehicle from the list.") end elseif (source == cancelButton) then showWindow(false) end end) addEventHandler("onClientMarkerHit", spawnMarker, function (hitPlayer) if (hitPlayer == localPlayer) then showWindow(true) end end) function showWindow(bool) guiSetVisible(mainWindow, bool) showCursor(bool) end Server: local vehicles = { } addEvent("onSpawnVehicle", true) addEventHandler("onSpawnVehicle", root, function (vehID) if ( isElement(vehicles[source]) ) then destroyElement(vehicles[source]) end vehicles[source] = createVehicle(vehID, getElementPosition(source)) warpPedIntoVehicle(source, vehicles[source]) end) I haven't tested it.
  3. Leia este tópico, por favor: viewtopic.php?f=104&t=31668 Se o problema persistir, peça ajuda na seção de suporte em inglês.
  4. function onStealthKill(targetPlayer) if (not wasEventCancelled()) then triggerServerEvent("onPedGetsKilledStealthKill", source, targetPlayer) end end addEventHandler("onClientPlayerStealthKill", getLocalPlayer(), onStealthKill)
  5. Try this and make sure you defined guiCheckBox/guiEdit: addEventHandler("onClientResourceStart",resourceRoot, function ( ) local username = loadLoginUsernameFromXML() guiSetText(guiEdit, username) end ) addEventHandler("onClientGUIClick",save, function ( ) local XMLFile = xmlLoadFile ( "Save.xml" ) or xmlCreateFile ( "Save.xml", "XML") if ( XMLFile ) then local Child = xmlFindChild ( XMLFile, "UserName", 0 ) or xmlCreateChild(XMLFile, "UserName") local Name = tostring(guiGetText(user)) if (Name == "") then return end if guiCheckBoxGetSelected(guiCheckBox) then if (xmlNodeGetValue(Child) ~= Name) then xmlNodeSetValue(Child, Name) end end xmlSaveFile ( XMLFile ) xmlUnloadFile ( XMLFile ) outputChatBox("Saved", 0, 255, 0) end end,false ) function loadLoginUsernameFromXML() local xmlFile = xmlLoadFile ("Save.xml") if not xmlFile then return false end local usernameNode = xmlFindChild (xmlFile, "UserName", 0) if usernameNode then return xmlNodeGetValue(usernameNode) else return "" end xmlUnloadFile(xmlFile) end
  6. Try this: addEventHandler("onClientResourceStart",resourceRoot, function ( ) local XMLFile = xmlCreateFile ( "Save.xml", "XML" ) local CreateChild = xmlCreateChild(XMLFile, "UserName") xmlSaveFile ( XMLFile ) outputChatBox("File created !", 0, 255, 0) end ) addEventHandler("onClientGUIClick",save, function ( ) local XMLFile = xmlLoadFile ( "Save.xml" ) if ( XMLFile ) then local Child = xmlFindChild ( XMLFile, "UserName", 0 ) local Name = tostring(guiGetText(user)) if guiCheckBoxGetSelected(guiCheckBox) then if (xmlNodeGetValue(Child) ~= Name) then xmlNodeSetValue(Child, Name) end end xmlSaveFile ( XMLFile ) xmlUnloadFile ( XMLFile ) outputChatBox("Saved", 0, 255, 0) end end,false ) P.S.: 'guiCheckBox' must be defined.
  7. function ls(thePlayer) if (getPlayerMoney(thePlayer) >= 1000) then takePlayerMoney ( thePlayer, 1000 ) setElementPosition ( thePlayer, 1481.0520019531,-1765.6591796875,18.795755386353 ) outputChatBox ('#FFFFFF[ #0DDFFFSpawn de LS#FFFFFF ]: #00FFFF' .. getPlayerName(thePlayer) .. ' #828282Foi para Los Santos por #FF0000$ -1000 #FFFFFF(#00FF00 /ls #FFFFFF)', root, 255, 255, 255, true) else outputChatBox ("Dinheiro insuficiente para usar este comando", thePlayer, 255, 255, 255, true) end end addCommandHandler( "ls", ls )
  8. http://lua-users.org/wiki/ForTutorial http://lua-users.org/wiki/ControlStructureTutorial
  9. Try this: addEventHandler("onClientResourceStart", resourceRoot, function() --WINDOW policeWindow = guiCreateWindow (375, 125, 500, 500, "Police Panel", false) guiWindowSetSizable (policeWindow, false) guiWindowSetMovable (policeWindow, false) guiSetVisible (policeWindow, false) -- GRIDLIST policeGridList = guiCreateGridList (16, 35, 240, 444, false, policeWindow) policeNameList = guiGridListAddColumn (policeGridList, "Name", 0.4) local row = guiGridListAddRow(policeGridList) for _, player in ipairs ( getElementsByType ( "player" ) ) do guiGridListSetItemText ( policeGridList, row, policeNameList, (string.gsub ( getPlayerName ( player ), '#%x%x%x%x%x%x', '' ) or getPlayerName(player)), false, false) guiGridListSetItemData ( policeGridList, row, policeNameList, getPlayerName(player)) end policeWantedLevelList = guiGridListAddColumn (policeGridList, "Wanted", 0.4) for _, player in ipairs ( getElementsByType ( "player" ) ) do guiGridListSetItemText ( policeGridList, row, policeWantedLevelList, (string.gsub ( getPlayerWantedLevel ( player ), '#%x%x%x%x%x%x', '' ) or getPlayerWantedLevel(player)), false, false) guiGridListSetItemData ( policeGridList, row, policeWantedLevelList, getPlayerWantedLevel(player)) end --BUTTONS -- Close Button policeCloseButton = guiCreateButton (272, 430, 218, 39, "Close", false, policeWindow) -- Track Player policeTrackPlayerButton = guiCreateButton (272, 378, 218, 39, "Track Player", false, policeWindow) addEventHandler("onClientGUIClick", policeTrackPlayerButton, function () local playerName = guiGridListGetItemText ( policeGridList, guiGridListGetSelectedItem ( policeGridList ), 1 ) createBlip (playerName, 58) end ) -- Bind Key F2 bindKey("F2", "down", showPolicePanel) addEventHandler("onClientGUIClick", policeCloseButton, hidePolicePanel) end ) function showPolicePanel () local playerTeam = getPlayerTeam ( localPlayer ) if (playerTeam) and (playerTeam == getTeamFromName("Police")) then guiSetVisible (policeWindow, true) showCursor (true) end end function hidePolicePanel () guiSetVisible (policeWindow, false) showCursor (false) end
  10. Tente isto: --[[ 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
  11. Seria melhor você mostrar o código aqui e então ajudamos com o que precisa.
  12. toggleControl is client & server-side.
  13. You can also use setElementData instead of triggerServerEvent, and then use onElementDataChange at the serverside.
  14. DNL291

    Help

    Try this: local marker = createMarker(2087.9260253906, 1448.8768310547, 10.8203125,"cylinder",2,0,0,255,255) createBlip ( 2087.9260253906, 1448.8768310547, 10.8203125, 31 ) function Prop (player) if(isElementWithinMarker(player,marker)) then outputChatBox ( "#00FFFF [PROP] To buy the prop write /prop1 (Cost:10.000$)", player, 0, 0, 0, true) else return end local money = getPlayerMoney(player) if (money >= 10000) then takePlayerMoney(player, 10000) outputChatBox ( "#00FFFF [PROP] You buyed the PROP !", player, 0, 0, 0, true) end end addCommandHandler("prop1",Prop)
  15. Replace addEvent("create") With: addEvent("create", true)
  16. Pode ser também o seu antivírus ou qualquer outro software que esteja impedindo o MTA rodar. Tente desativando-o. Se o problema persistir peça ajuda por meio do link fornecido pelo Stanley.
  17. Pode ser um problema com o seu GTA. Faça um backup de arquivos do jogo (caso precise) e reinstale o jogo.
  18. DNL291

    DxDraw

    Try using tostring to convert the LV variable to a string. setElementData ( source, "Rankicons", ":Class\\Rank\\rank_"..tostring(LV)..".png")
  19. DNL291

    BaseArea51

    radararea2 = createRadarArea( 110.91990, 1800.89435, 200, 145, 255, 255, 255, 225 ) createBlip(279.40317, 1831.25439, 7.72656,61) marker2 = createMarker(298.98865, 1815.90613, 3.71094,"cylinder",2,0,0,255,255) addCommandHandler("buyarea51", function (source) local gangName = exports.gang_system:getPlayerGang(source) if (isElementWithinMarker(source, marker2)) and gangName and (getPlayerMoney(source) >= 1000000) then takePlayerMoney (source, 1000000) local color = exports.gang_system:getGangColor(gangName) setRadarAreaColor(radararea, color[1], color[2], color[3], 255) outputChatBox("#FFF000[bASE] #00FFFFYour gang buyed a base #00FF00 Area 51 !", source, 0, 0, 0, true) else outputChatBox("#FFF000[bASE] You arent on the checkpoint !", source, 0, 0, 0, true) end end )
  20. Quando você encerra o GTA pressionando o botão Sim, e abre novamente o MTA, o erro persiste? Já tive o mesmo problema, mas eu pressiono Sim, abro o MTA novamente e não recebo o erro, por isso essa pergunta.
  21. O GTA San Andreas funciona normalmente quando você inicia? Esse erro sempre aparece? Mesmo que você aperte Sim e inicia novamente o MTA:SA?
×
×
  • Create New...