Jump to content

Search the Community

Showing results for tags 'bug'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Multi Theft Auto: San Andreas 1.x
    • Support for MTA:SA 1.x
    • User Guides
    • Open Source Contributors
    • Suggestions
    • Ban appeals
  • General MTA
    • News
    • Media
    • Site/Forum/Discord/Mantis/Wiki related
    • MTA Chat
    • Other languages
  • MTA Community
    • Scripting
    • Maps
    • Resources
    • Other Creations & GTA modding
    • Competitive gameplay
    • Servers
  • Other
    • General
    • Multi Theft Auto 0.5r2
    • Third party GTA mods
  • Archive
    • Archived Items
    • Trash

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Gang


Location


Occupation


Interests

  1. i have this code: addEvent( "eszakirablas", true ) addEventHandler( "eszakirablas", root, function (thePlayer) if ( idozito [ thePlayer ] ~= nil ) then outputChatBox ( "#01AC41[SuperFun] #FFffFFA következő széfrablásig várnod kell #01AC41".. math.floor ( getTimerDetails ( idozito [ thePlayer ] ) / 60000+1 ) .." percet.", thePlayer, 255, 0, 0, true ); else setElementFrozen(thePlayer, true) setPedAnimation(thePlayer , "rob_bank", "cat_safe_rob", 10000, true, true, true, false) setTimer(setElementFrozen,10000,1,thePlayer,false) randomM = math.random(500000,1500000) setTimer(function() givePlayerMoney(thePlayer,randomM) end,10000,1) setTimer(outputChatBox, 10000,1,"#01AC41[SuperFun] #FFffFFÖsszesen raboltál #01AC41"..randomM.." #ffffffforintot.",thePlayer,255,255,255,true) setTimer(outputChatBox, 900000, 1,"#01AC41[SuperFun - #8C8C8CÉszaki] #FFffFFAz #01AC41északin #FFffFFújra kirabolhatod a széfet! #01AC41(/eszaki)",thePlayer,255,255,255,true) setTimer(Boltrablas,900000,1) idozito [ thePlayer ] = setTimer ( function ( thePlayer ) idozito [ thePlayer ] = nil; end, 900000, 1, thePlayer); end end ) and when the animation stop, and i change my skin, start off the animation.. how to fix this bug??
  2. So I am making a vehicle shop system. I want some vehicles to have changed handling when they spawn. There's a problem, 'cause a 'for loop' that sets handlings isn't executed. I don't know what could cause this. Here's the code: local vehSale = {} vehSale["premier"] = {426, 2000, {}} vehSale["blista-compact"] = {496, 2400, {}} hdl_blista_compact_rwd = {} hdl_blista_compact_rwd["driveType"] = "rwd" hdl_blista_compact_rwd["mass"] = 1040 vehSale["blista-compact-rwd"] = {496, 2800, hdl_blista_compact_rwd} hdl_blista_sport = {} hdl_blista_sport["driveType"] = "rwd" hdl_blista_sport["mass"] = 1100 hdl_blista_sport["engineAcceleration"] = 12.8 hdl_blista_sport["engineInertia"] = 4 hdl_blista_sport["collisionDamageMultiplier"] = 0.55 hdl_blista_sport["steeringLock"] = 35 vehSale["blista-sport"] = {496, 4500, hdl_blista_sport} function buyVehicle(source, cmdName, vName) if not vehSale[vName] then outputChatBox("There is no such vehicle for sale", source) return false end if getPlayerMoney(source) < vehSale[vName][2] then outputChatBox("You don't have money for that", source) return false end local veh = createVehicle(vehSale[vName][1], 0, 0, 0) spawnVehicle(veh, -1706, 13, 5) for k, v in ipairs(vehSale[vName][3]) do print(k) setVehicleHandling(veh, k, v) end setPlayerMoney(source, getPlayerMoney(source)-vehSale[vName][2]) outputChatBox("Vehicle bought", source) end addCommandHandler("buy", buyVehicle) So I made a table (vehSale) where I put all avaliable cars. Under key premier at 1st index is vehicle ID, 2nd - price, 3rd - Handlings to change. I wrote a function that lets players buy vehicles. It's named buyVehicle(). First it checks if vehicle is avaliable and if player can afford it. Next it spawns vehicle at San Fierro docks and then applies handling. And that part of code doesn't work. After loop subtracts player money and outputs "Vehicle bought". Anything but that loop does work. I tried this code at the beggining of program: for k, v in ipairs(getOriginalHanling(496)) do print(k) print(v) end And this doesn't work too. Man, f*ck this. I've just changed ipairs() to pairs() and ANYTHING is WORKING. Lol
  3. i added this line to a nametag script: if isChatBoxInputActive() then dxDrawImage ( sx - math.max(nameWidth/2, teamWidth/2) - imageSize - 1*scale, sy - imageSize, imageSize, imageSize, "logo.png" ) end but when i press 't', the image show in all players nametag.. how to fix this?
  4. After R4 (build 11428) - Updated 16th June 2017 when delete LS CIty hall, object delete not correct.
  5. I have been trying to bindkeys to a command clientside and save them inside a xml file. But the mta binding cache is stacking up. Keys: 'x', 'u', 'x' See screenshot bellow. The problem shows up when you edit the bindkey in the settings menu and load the xml file after saving it. To use the bindkeys, you have to bind it with any key on your keyboard. To know which bindkeys are bound to a command with your previous visit, you have to bind any key of your keyboard to that command in order to use: getBoundKeys / getKeyBoundToCommand If you use unbindKey, it will unbind the command for all other keys, but not remove it from the cache. And another problem, I can't remove keys/'alternative keys' from the cache unless I click on the 'Load defaults button on the right bottom'. This is the code I have been testing with:
  6. I have a bug on my server. The Rhinos have an extra wheel, In Grand Theft Auto San Andreas , When you write HESOYAM this wheel appears and in appearsMTA it always, I was researching and I did not find anything about this since I had two options, Download a model that has no wheels but use the Rhino Tracks cleo or disappear the extra wheel, For obvious reasons I preferred to disappear the extra wheel but still I have not found how to do it help me pls. (#)
  7. Olha oque está acontecendo , apareceu isso depois dessa atualização do mta
  8. now the radar "move" but... not the way I want it bug video: this is the code: local movingOffsetX, movingOffsetY = 0, 0 local isMoving = false bindKey('m', 'down', function() showCursor(not isCursorShowing()); end ) function drawRadar() showPlayerHudComponent("radar", false) if disableGTASAhealth then showPlayerHudComponent("health", false) end if disableGTASAarmor then showPlayerHudComponent("armour", false) end if disableGTASAoxygen then showPlayerHudComponent("breath", false) end if (not isPlayerMapVisible()) then if (isCursorShowing() and isMoving) then local cursorX, cursorY = getCursorPosition(); cursorX = cursorX * sx; cursorY = cursorY * sy; xFactor = cursorX - movingOffsetX; yFactor = cursorY - movingOffsetY; end local mW, mH = dxGetMaterialSize(rt) local x, y = getElementPosition(localPlayer) local X, Y = mW/2 -(x/(6000/worldW)), mH/2 +(y/(6000/worldH)) local camX,camY,camZ = getElementRotation(getCamera()) dxSetRenderTarget(rt, true) if alwaysRenderMap or getElementInterior(localPlayer) == 0 then dxDrawRectangle(xFactor, yFactor, worldW, worldH, 0xFF5E656B) dxDrawImage(X - worldW/2, mH/5 + (Y - worldH/2), worldW, worldH, "image/world.jpg", camZ, (x/(6000/worldW)), -(y/(6000/worldH)), tocolor(255, 255, 255, 255)) end dxSetRenderTarget() dxDrawRectangle((10)*xFactor, sy-((200+10))*yFactor, (300)*xFactor, (184)*yFactor, tocolor(0, 0, 0, 175)) dxDrawImage((10+5)*xFactor, sy-((200+5))*yFactor, (300-10)*xFactor, (175)*yFactor, rt, 0, 0, 0, tocolor(255, 255, 255, 255)) local rx, ry, rz = getElementRotation(localPlayer) local lB = (15)*xFactor local rB = (15+290)*xFactor local tB = sy-(205)*yFactor local bB = tB + (175)*yFactor local cX, cY = (rB+lB)/2, (tB+bB)/2 +(35)*yFactor local toLeft, toTop, toRight, toBottom = cX-lB, cY-tB, rB-cX, bB-cY for k, v in ipairs(getElementsByType("blip")) do local bx, by = getElementPosition(v) local actualDist = getDistanceBetweenPoints2D(x, y, bx, by) local maxDist = getBlipVisibleDistance(v) if actualDist <= maxDist and getElementDimension(v)==getElementDimension(localPlayer) and getElementInterior(v)==getElementInterior(localPlayer) then local dist = actualDist/(6000/((worldW+worldH)/2)) local rot = findRotation(bx, by, x, y)-camZ local bpx, bpy = getPointFromDistanceRotation(cX, cY, math.min(dist, math.sqrt(toTop^2 + toRight^2)), rot) local bpx = math.max(lB, math.min(rB, bpx)) local bpy = math.max(tB, math.min(bB, bpy)) local bid = getElementData(v, "customIcon") or getBlipIcon(v) local _, _, _, bcA = getBlipColor(v) local bcR, bcG, bcB = 255, 255, 255 if getBlipIcon(v) == 0 then bcR, bcG, bcB = getBlipColor(v) end local bS = getBlipSize(v) dxDrawImage(bpx -(blip*bS)*xFactor/2, bpy -(blip*bS)*yFactor/2, (blip*bS)*xFactor, (blip*bS)*yFactor, "image/blip/"..bid..".png", 0, 0, 0, tocolor(bcR, bcG, bcB, bcA)) end end if renderNorthBlip then local rot = -camZ+180 local bpx, bpy = getPointFromDistanceRotation(cX, cY, math.sqrt(toTop^2 + toRight^2), rot) --get position local bpx = math.max(lB, math.min(rB, bpx)) local bpy = math.max(tB, math.min(bB, bpy)) --cap position to screen local dist = getDistanceBetweenPoints2D(cX, cY, bpx, bpy) --get distance to the capped position local bpx, bpy = getPointFromDistanceRotation(cX, cY, dist, rot) --re-calculate position based on new distance if bpx and bpy then --if position was obtained successfully local bpx = math.max(lB, math.min(rB, bpx)) local bpy = math.max(tB, math.min(bB, bpy)) --cap position just in case dxDrawImage(bpx -(blip*2)/2, bpy -(blip*2)/2, blip*2, blip*2, "image/blip/4.png", 0, 0, 0) --draw north (4) blip end end dxDrawImage(cX -(blip*2)*xFactor/2, cY -(blip*2)*yFactor/2, (blip*2)*xFactor, (blip*2)*yFactor, "image/player.png", camZ-rz, 0, 0) end end addEventHandler("onClientRender", root, drawRadar) addEventHandler('onClientClick', getRootElement(), function(button, state, cursorX, cursorY) if (not isPlayerMapVisible()) then if (button == 'left' and state == 'down') then if (cursorX >= xFactor and cursorX <= xFactor + worldW and cursorY >= yFactor and cursorY <= yFactor + worldH) then isMoving = true; movingOffsetX = cursorX - xFactor; movingOffsetY = cursorY - yFactor; end else isMoving = false; end end end ) how to fix this bug?
  9. function adminuzi(thePlayer, commandName, ...) for i,v in pairs(getElementsByType( "player" )) do for group, serverGroupName in pairs( names ) do if isGuestAccount( getPlayerAccount( v ) ) then return end if group then if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup( group ) then message = table.concat({...}, " ") groupName = names["group"] end end end end outputChatBox("#0088FF["..groupName.."]#d8001f "..getPlayerName(thePlayer)..": "..message,getRootElement(),0,0,0,true) end addCommandHandler("asay", adminuzi) Sometimes working the "asay xy" cmd, sometimes not working. How to fix this bug?
  10. Estava eu um dia querendo jogar MTA ok abri o jogo entro em um servidor para fazer drift até que me deparo com um erro e eu falo "Droga isso nunca acontecia" eu pensei vou baixar um anti-virus baixei e não solucionou. Agradeço agora se um anjo me salvar <3
  11. Hi, i have problem, when i play long on server i can see rainbow ped model on screen and then game crashes.
  12. i have this script, and does not update online players number, why? local online = #getElementsByType("player") local messagesList = { online.."/30", "SF", } local currentMessage = 0 addEventHandler("onClientPreRender", getRootElement(), function() local online = #getElementsByType("player") dxDrawText(messagesList[currentMessage + 1], screenW * 0.6014+3, screenH * 0.9656+3, screenW * 0.6556, screenH * 0.9978, tocolor(0, 0, 0, 255), 2.20, "default-bold", "center", "bottom", false, false, false, false, false) dxDrawText(messagesList[currentMessage + 1], screenW * 0.6014, screenH * 0.9656, screenW * 0.6556, screenH * 0.9978, tocolor(255, 255, 255, 255), 2.20, "default-bold", "center", "bottom", false, false, false, false, false) end ) function updateMessage() if (currentMessage == 1) then currentMessage = 0 else currentMessage = currentMessage + 1 end end setTimer(updateMessage, 2000, 0)
  13. Hey community, I need some help. I host my server Today and everything was perfect. Then restart my server and there was a problem. For your information I have all the ports activated and verified, the firewall allows it A friend wanted to enter my server and could not. My server was not listed on the Internet. Right now I do not know what to do. I hope you can help me. In mtaserver.conf everything is perfect, try to verify it with another problem of another user and still not working. Thanks
  14. function findPlayer(name) local matches = {} for i,v in ipairs(getElementsByType("player")) do if getPlayerName(v) == name then return v end local playerName = getPlayerName(v):gsub("#%x%x%x%x%x%x", "") playerName = playerName:lower() if playerName:find(name:lower(), 0) then table.insert(matches, v) end end if #matches == 1 then return matches[1] end return false end addCommandHandler("pay", function(player, cmd, name, amount) local amount = tonumber(amount) if name and amount then local target = findPlayer(name) local money = getPlayerMoney(target) if money >= amount then takePlayerMoney(player, amount) givePlayerMoney(target, amount) outputChatBox("#FFffFF Átutaltál neki: #c8c8c8" .. getPlayerName(target) .. " #0088ff" .. amount .. " Forintot.", player, 0, 255, 0, true) outputChatBox("#c8c8c8 " .. getPlayerName(player) .. " #FFffFFutalt neked #0088ff" .. amount .. " Forintot.", target, 0, 255, 0, true) else outputChatBox("#FFffFF Nincs elég pénzed.", target, 255, 0, 0, true) end end end ) why can i 'pay' minus amount? how to fix this?
  15. my client: function coronaa() triggerServerEvent ("szoveg", root, getLocalPlayer()) end addEventHandler ( "onClientMarkerHit", ajtomegilyenek, coronaa ) and the server: addEvent( "szoveg", true ) addEventHandler( "szoveg", root, function(thePlayer) outputChatBox("Text", thePlayer, r,g,b, true) end) how to fix this?
  16. Help me pls, i need your help. i dont know where's the problem. pls man function playerDropAItem(itemName) local x,y,z = getElementPosition(source) local item,itemString = getItemTablePosition(itemName) local itemPickup = createItemPickup(item,x+math.random(-1.25,1.25),y+math.random(-1.25,1.25),z,itemString) end addEvent( "playerDropAItem", true ) <export function="playerDropAItem" type="server" />
  17. Necesito ayuda!!!! Alguién podria ser TAN AMABLE de decirme o enseñarme como puedo hacer que cuando dentro de mi server (Day-Z) monto la famosa (TENT O TIENDA DE CAMPAÑA) ésta no se aleje tanto del personaje al igual que cuando la desmonto. Ósea, mi intención es usar las tent o tienda de campaña para colocarla en la pared y luego retirarla sin que se pierda dentro de la pared. Estuve revisando los archivos del (Dayz) login y el survivorSystem.lua Y en login encontré esto que fué lo que más me llamo la ATENCIÓN: tent = createObject(3243, getAccountData(tentData, "last_x"), getAccountData(tentData, "last_y"), getAccountData(tentData, "last_z"), 0, 0, getAccountData(tentData, "last_rz") or 0) setObjectScale(tent, 1.3) tentCol = createColSphere(getAccountData(tentData, "last_x"), getAccountData(tentData, "last_y"), getAccountData(tentData, "last_z"), 4) attachElements(tentCol, tent, 0, 0, 0) setElementData(tentCol, "parent", tent) setElementData(tent, "parent", tentCol) setElementData(tentCol, "tent", true) setElementData(tentCol, "vehicle", true) setElementData(tentCol, "MAX_Slots", 100) for i, data in ipairs(vehicleDataTable) do setElementData(tentCol, data[1], getAccountData(tentData, data[1])) end end end --------------------------------------------------------------------- Yen el survivorSystem.lua encontré esto: function onPlayerPitchATent(itemName) setElementData(source, itemName, getElementData(source, itemName) - 1) setPedAnimation(source, "BOMBER", "BOM_Plant", -1,false,false,false,false) local source = source setTimer(function() local x, y, z = getElementPosition(source) local xr, yr, zr = getElementRotation(source) px, py, pz = getElementPosition(source) prot = getPedRotation(source) local offsetRot = math.rad(prot + 90) local vx = px + 5 * math.cos(offsetRot) local vy = py + 5 * math.sin(offsetRot) local vz = pz + 2 local vrot = prot + 180 tent = createObject(3243, vx, vy, z - 1, 0, 0, vrot) setObjectScale(tent, 1.3) tentCol = createColSphere(x, y, z, 4) attachElements(tentCol, tent, 0, 0, 0) setElementData(tentCol, "parent", tent) setElementData(tent, "parent", tentCol) setElementData(tentCol, "tent", true) setElementData(tentCol, "vehicle", true) setElementData(tentCol, "MAX_Slots", 100) triggerClientEvent(source, "refreshInventoryManual", source) end, 1500, 1) end ------------------------------------------------------------------------------ No se si me explico, pero deseo saber cúal de los dos debo editar para que cuando monte una (tienda de campaña-tent) no se me aleje del personaje y quede en la misma posición que el personaje, así puedo "bugearla" dentro de la pared y luego desmontarla. Como el server THE LONE SURVIVOR, que tienen esa misma configuracón.. MUCHAS GRACIAS PORL EER ESTO ESPERO ME AYUDES ME HARÁS FELIZ!!!!
  18. vGrosho

    KNIFE WAREHOUSE BUG

    I want to remove this resctriction, i where searching for something but i didn't find any solutions. Can someone help me with this ? http://prnt.sc/eclxwl
  19. Hey guys. Im a developer of a roleplay server and some players can duplicate items by lagging their internet. How can i fix this problem? Maybe i should use: getNetworkStats but i dont know which value goes up when they have lag. Thx for help!
  20. Hello, When I try To Connect to a Server It Shows Me a Message Says "To Join this server you must update MTA" But i Already Have The Latest Version Of Game I tried to Reinstall The Game, but still The Same Problem. Please! Tell me How to solve this Problem. Photos Of The Problem
  21. Hola, tengo un problema y no sé si es cosa mía o de como configuré este log-in (lo hice a partir de un video que decía como configurarlo y crearlo) el tema es que en el video (llegado el momento) dice que ejecutemos el comando anteriormente puesto y se le abre la ventana del login pero a mí me sucede todo lo contrario aunque yo haya establecido el mismo comando, haya puesto los mismos nombres en las funciones, etc. no pasa nada. Y ahora, no sé por qué, no me abre el "editor_gui" aunque ponga "/guied" o apriete "shift+c" (este dejo de funcionar a la segunda vez que use el "editor_gui") y como no lo puedo abrir, no puedo agregar un botón de regresar que me faltó en el registro para que vuelva al log-in panel. La verdad, no tengo ni idea de lo que sucede ni como arreglarlo ya que soy nuevo en Scripting y lo relacionado. (Mi primer resource es este login y al ver que no pasa nada es medio frustrante, jaja) Este es el client.lua: local screenM, screenH = guiGetScreenSize() function reg() winRegister = guiCreateWindow(387, 256, 414, 313, "Register panel by Seyer", false) guiWindowSetSizable(winRegister, false) usuario = guiCreateEdit(236, 24, 167, 43, "", false, winRegister) GUIEditor.label[1] = guiCreateLabel(17, 23, 159, 44, "Usuario:", false, winRegister) guiSetFont(GUIEditor.label[1], "sa-header") guiLabelSetColor(GUIEditor.label[1], 15, 239, 253) GUIEditor.label[2] = guiCreateLabel(19, 92, 217, 44, "Contraseña:", false, winRegister) guiSetFont(GUIEditor.label[2], "sa-header") guiLabelSetColor(GUIEditor.label[2], 15, 239, 253) GUIEditor.label[3] = guiCreateLabel(19, 160, 217, 44, "Contraseña:", false, winRegister) guiSetFont(GUIEditor.label[3], "sa-header") guiLabelSetColor(GUIEditor.label[3], 15, 239, 253) contraseña1 = guiCreateEdit(236, 94, 167, 42, "", false, winRegister) guiEditSetMasked(contraseña1,true) contraseña2 = guiCreateEdit(236, 160, 167, 44, "", false, winRegister) guiEditSetMasked(contraseña2,true) brtRegistrar = guiCreateButton(9, 234, 394, 69, "Register", false, winRegister) guiSetFont(GUIEditor.button[1], "sa-header") guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FF0FEFFD") GUIEditor.label[4] = guiCreateLabel(27, 205, 56, 19, "(máx. 25)", false, winRegister) guiSetFont(GUIEditor.label[4], "default-bold-small") guiLabelSetColor(GUIEditor.label[4], 254, 254, 254) GUIEditor.label[5] = guiCreateLabel(27, 136, 56, 19, "(máx. 25)", false, winRegister) guiSetFont(GUIEditor.label[5], "default-bold-small") guiLabelSetColor(GUIEditor.label[5], 254, 254, 254) GUIEditor.label[6] = guiCreateLabel(27, 67, 56, 19, "(máx. 25)", false, winRegister) guiSetFont(GUIEditor.label[6], "default-bold-small") guiLabelSetColor(GUIEditor.label[6], 254, 254, 254) addEvent("onClientGUIClick",brtRegistrar,function() user=guiGetText(usuario) c=guiGetText(contraseña1) c1=guiGetText(contraseña2) if(c==c1)then triggerServerEvent("rg",getLocalPlayer(),user,c) outputChatBox("Las contraseñas coinciden.") else outputChatBox("Las contraseñas no coinciden.") end addEvent("cerrar",true") addEventHandler("cerrar,getLocalPlayer(),function() guiSetVisible(winRegister,false) showCursor(false) addEvent("cerrar2",true") addEventHandler("cerrar,getLocalPlayer(),function() guiSetVisible(winLogin,false) showCursor(false) function login() winLogin = guiCreateWindow(387, 256, 414, 316, "Log-in panel by Seyer", false) guiWindowSetSizable(winLogin, false) usuario = guiCreateEdit(236, 24, 167, 43, "", false, winLogin) GUIEditor.label[1] = guiCreateLabel(17, 23, 159, 44, "Usuario:", false, winLogin) guiSetFont(GUIEditor.label[1], "sa-header") guiLabelSetColor(GUIEditor.label[1], 15, 239, 253) GUIEditor.label[2] = guiCreateLabel(19, 92, 217, 44, "Contraseña:", false, winLogin) guiSetFont(GUIEditor.label[2], "sa-header") guiLabelSetColor(GUIEditor.label[2], 15, 239, 253) contraseña1 = guiCreateEdit(236, 94, 167, 42, "", false, winLogin) btrLoggearse = guiCreateButton(10, 165, 394, 68, "Login", false, winLogin) guiSetFont(GUIEditor.button[1], "sa-header") guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FF0FEFFD") GUIEditor.label[3] = guiCreateLabel(27, 136, 56, 19, "(máx. 25)", false, winLogin) guiSetFont(GUIEditor.label[3], "default-bold-small") guiLabelSetColor(GUIEditor.label[3], 254, 254, 254) GUIEditor.label[4] = guiCreateLabel(27, 67, 56, 19, "(máx. 25)", false, winLogin) guiSetFont(GUIEditor.label[4], "default-bold-small") guiLabelSetColor(GUIEditor.label[4], 254, 254, 254) registro = guiCreateButton(11, 240, 393, 66, "Register", false, winLogin) guiSetFont(GUIEditor.button[2], "sa-header") guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FF0FEFFD") showCursor(true) addEvent("onClientGUIClick",registro,function() guiSetVisible(winLogin, false) reg() end) addEvent("onClientGUIClick",btrLoggearse,function() user = guiGetText(usuario) clave = guiGetText(pass) triggerServerEvent("lg",getLocalPlayer(),user,clave) end addCommandHandler("log",login) addEvent("abrirlogin",true) addEventHandler("abrirlogin",getLocalPlayer(),login) y este es el server.lua: function rg(user,clave) if(addAccount(user,clave))then outputChatBox("Regristado correctamente.") triggerClientEvent(source,"cerrar",source) logIn(source,getAccount(user,clave),clave) else outputChatBox("La cuenta ya existe.") end addEvent("rg",true) addEventHandler("rg", getRootElement(),rg) function lg(user,clave) cuenta = getAccount(user,clave) if(cuenta)then logIn(source,getAccount(user,clave),clave) triggerClientEvent(source,"cerrar2",source) else outputChatBox("La cuenta no existe o usuario y/o contraseña incorrectos.") end addEvent("lg",true) addEventHandler("lg", getRootElement(),lg) addEventHandler("onPlayerJoin",getRootElement(),function() triggerClientEvent(source,"abrirlogin",source) end) Saludos y gracias de antemano.
  22. Miika

    toJSON bug?

    Hello there, I've almost finished my vehicle shop / saving / control system but i got this error when i log out or reconnect: ERROR: wangcars/shop_server.lua:16: Couldn't convert userdata argument to JSON, only valid resources can be included for this function. I've tested and the result is table but toJSON says that it is userdata. It still saves it to accountdata in toJSON and i can unpack it with fromJSON. So is this mta bug or what? Saving function: addEventHandler("onPlayerLogout", root, function(account) local data = getElementData(source, "wangcars.data") if data then if account and not isGuestAccount(account) then if isElement(wangvehicle[source]) then local id = getElementData(wangvehicle[source], "wangcars.id") local x, y, z = getElementPosition(wangvehicle[source]) local rx, ry, rz = getElementRotation(wangvehicle[source]) data[id][6] = x..", "..y..", "..z..", "..rx..", "..ry..", "..rz data[id][8] = getElementHealth(wangvehicle[source]) setElementData(source, "wangcars.data", data) destroyElement(wangvehicle[source]) wangvehicle[source] = nil end setAccountData(account, "wangcars.data", toJSON(getElementData(source, "wangcars.data"))) -- error there, but it still saves it setElementData(source, "wangcars.data", false) triggerClientEvent(source, "wangcars.refreshgrid", source) end end end ) I have almost same function when player quit but no need to post it. I could just ignore this, but it's anoying because it always outputs error in debugscript when somebody disconnects and i'm trying to keep debug clean as possible.
  23. i created a info panel, with scrollpane, and labels. but in 1440x900 resolution is working fine, but i tested in 800x600, and the labels with the text sticking out from the window.. how to fix this? here is my code: local GUIEditor = { window = {}, scrollpane = {}, label = {} } GUIEditor.window[1] = guiCreateWindow(0.27, 0.21, 0.47, 0.59, "Segítség", true) guiWindowSetSizable(GUIEditor.window[1], false) guiSetAlpha(GUIEditor.window[1], 1.00) GUIEditor.scrollpane[1] = guiCreateScrollPane(0.01, 0.04, 0.97, 0.94, true, GUIEditor.window[1]) GUIEditor.label[1] = guiCreateLabel(0.00, 0.01, 1.00, 0.04, "Infó:", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[1], "default-bold-small") guiLabelSetColor(GUIEditor.label[1], 255, 0, 0) GUIEditor.label[2] = guiCreateLabel(0.00, 0.04, 0.98, 0.06, " Név: [HUN]Magyar Play Szerver 1.5\n Játékmód: play", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[2], "clear-normal") guiLabelSetColor(GUIEditor.label[2], 61, 161, 254) GUIEditor.label[3] = guiCreateLabel(0.00, 0.12, 1.00, 0.04, "Elérhetőségek:", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[3], "default-bold-small") guiLabelSetColor(GUIEditor.label[3], 255, 0, 0) GUIEditor.label[4] = guiCreateLabel(0.00, 0.16, 0.97, 0.10, " Facebook: www.tinyurl.com/magyarplay15\n TeamSpeak 3: -\n Skype: turboskype29", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[4], "clear-normal") guiLabelSetColor(GUIEditor.label[4], 61, 161, 254) GUIEditor.label[5] = guiCreateLabel(0.00, 0.28, 1.00, 0.04, "GYIK:", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[5], "default-bold-small") guiLabelSetColor(GUIEditor.label[5], 255, 0, 0) GUIEditor.label[6] = guiCreateLabel(0.02, 0.32, 0.92, 0.21, "\n -Ahogy betöltött a szerver, a kocsik elérhetőek az F1 panel\n megnyitásával, kattintva a \"jármű lekérés\" menüpontra.\n Azon belül a repülők az \"aircraft\", a motorkák a \"bikes\", hajók a\n \"boats\", kocsik a \"cars\".\n A másik módja a kocsik lehívásához a /sv parancs. /sv <kocsinév>\n Pl. /sv infernus", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[6], "clear-normal") guiLabelSetColor(GUIEditor.label[6], 61, 161, 254) GUIEditor.label[7] = guiCreateLabel(0.00, 0.31, 0.98, 0.06, " Hogyan tudok kocsit szerezni?", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[7], "clear-normal") guiLabelSetColor(GUIEditor.label[7], 254, 254, 254) GUIEditor.label[8] = guiCreateLabel(0.00, 0.54, 0.92, 0.03, " Hogy tudok fegyvert szerezni?", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[8], "clear-normal") guiLabelSetColor(GUIEditor.label[8], 254, 254, 254) GUIEditor.label[9] = guiCreateLabel(0.02, 0.58, 0.92, 0.21, " -Fegyvert venni, vagy F1-ből lehívni tudsz. De ha többet akarsz gyorsan\n egyszerre, akkor F2. Azon belül fegyvercsomag.\n Fegyvert szerezhetsz még más playerek megölésével.\n Amint meghal egy játékos, és volt nála fegyver, az kikerül a\n meghalt teste fölé és megjelenik az összes\n fegyver, amit Te felszedhetsz. Vigyázz! Ha meghalsz, te is\n elveszítheted azokat a fegyvereket.", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[9], "clear-normal") guiLabelSetColor(GUIEditor.label[9], 61, 161, 254) GUIEditor.label[10] = guiCreateLabel(0.00, 0.80, 0.92, 0.03, " Miért öltek meg?", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[10], "clear-normal") guiLabelSetColor(GUIEditor.label[10], 254, 254, 254) GUIEditor.label[11] = guiCreateLabel(0.02, 0.84, 0.92, 0.21, " -A szerver játékmódja \"play\", ami annyit mond, hogy a szerver\n próbál lehetőséget adni mindenkinek\n a szórakozásra. Így azon játékosok, akik passzív agresszív módon\n gyilkolással vezetik le\n feszültségeiket, szabad utat kapnak ennek megvalósítására. Szóval\n ha meghalsz, ne rinyálj, mivel\n megteheti, és ugyanúgy Te is megölhetsz bárkit.", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[11], "clear-normal") guiLabelSetColor(GUIEditor.label[11], 61, 161, 254) GUIEditor.label[12] = guiCreateLabel(0.00, 1.06, 0.92, 0.03, " Mi az a \"gift\" az F2-ben?", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[12], "clear-normal") guiLabelSetColor(GUIEditor.label[12], 254, 254, 254) GUIEditor.label[13] = guiCreateLabel(0.02, 1.10, 0.92, 0.21, " -Nagy köszönet érte turbesznek (főadmin, szerótulaj), aki\n megalkotta a \"Gift\" menüpontot az F2 panelben.\n A gift jelentése \"ajándék\".\n Ezzel a \"kattintással\" lehetőséged nyílik arra, hogy olyan dolgokat\n használj, amiket más esetben nem\n tudnál. Például tank, minigun 3000 tölténnyel, halhatatlanság, halhatatlan autó, nagy\n fegyvercsomag és egyebek. A giftet 12 óránként használhatod.", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[13], "clear-normal") guiLabelSetColor(GUIEditor.label[13], 61, 161, 254) GUIEditor.label[14] = guiCreateLabel(0.00, 1.31, 0.92, 0.03, " Mi az a [M] a játékos neve előtt?", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[14], "clear-normal") guiLabelSetColor(GUIEditor.label[14], 254, 254, 254) GUIEditor.label[15] = guiCreateLabel(0.01, 1.35, 0.92, 0.21, " -Ha látsz egy playert, akinek a neve előtt [M] vagy [A] van, az\n vagy Moderátor, vagy Admin. Ezek a játékosok\n ügyelik a szervert, moderálnak, szerveznek meg mindent, ők\n segítenek másokon és ők azok, akik irányítják a\n szervert. Ezek a játékosok színesen írnak. ( ! Ha valamelyik játékos\n előtt [M] van, de nem ír színesen, az nem rangos!)\n A moderátoroknak lehetőségük nyílik mások kikelésére,\n bannolására és mute-olására, Mivel ők tartják fenn a rendet\n a szerveren, a rájuk eső feladatokat el is végzik.", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[15], "clear-normal") guiLabelSetColor(GUIEditor.label[15], 61, 161, 254) GUIEditor.label[16] = guiCreateLabel(0.00, 1.57, 0.92, 0.03, " Hogy tudok admin/moderátor lenni?", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[16], "clear-normal") guiLabelSetColor(GUIEditor.label[16], 254, 254, 254) GUIEditor.label[17] = guiCreateLabel(0.01, 1.61, 0.92, 0.21, " -Sokszor felmerül a kérdés, de a választ nehéz rá megválaszolni. Ezt\n turbesz dönti el (NEM MÁS), és az ő\n követelései határozzák meg modira való lehetőséged. Az esetek\n 99.9%-ban a játékosoknak nincs esélyük\n moderátornak lenni, azonban próbálkozni nem\n törvénybeütköző.", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[17], "clear-normal") guiLabelSetColor(GUIEditor.label[17], 61, 161, 254) GUIEditor.label[18] = guiCreateLabel(0.01, 1.80, 0.92, 0.03, " Hogy tudok színesen írni?", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[18], "clear-normal") guiLabelSetColor(GUIEditor.label[18], 254, 254, 254) GUIEditor.label[19] = guiCreateLabel(0.01, 1.84, 0.92, 0.21, " -Két (2) módja van annak, hogy Te színesen tudj írni. Az egyik,\n hogy rangod van (vip, modi, admin), a másik,\n hogy veszel a giftben. A giftben fehéres-zöld szín van, ami\n megmarad addig, amíg turbesz el nem veszi.", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[19], "clear-normal") guiLabelSetColor(GUIEditor.label[19], 61, 161, 254) GUIEditor.label[20] = guiCreateLabel(0.01, 1.97, 0.92, 0.03, " Hogy tudok gyorsan menni?", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[20], "clear-normal") guiLabelSetColor(GUIEditor.label[20], 254, 254, 254) GUIEditor.label[21] = guiCreateLabel(0.02, 2.01, 0.92, 0.21, " -Ha kocsiban vagy, az ALT nyomva tartásával gyorsíthatod a kocsid\n maximum sebességre.", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[21], "clear-normal") guiLabelSetColor(GUIEditor.label[21], 61, 161, 254) GUIEditor.label[22] = guiCreateLabel(0.01, 2.08, 0.92, 0.03, " Írok a chaten, de csak ezt dobja ki: \"You are muted!\"", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[22], "clear-normal") guiLabelSetColor(GUIEditor.label[22], 254, 254, 254) GUIEditor.label[23] = guiCreateLabel(0.01, 2.12, 0.92, 0.21, " -Ez azért van, mert mute-olva lettél, tehát valami szabálytalanságot\n követtél el a chatben.\n Mute = letiltás a chatbe írás lehetőségéről\n Mute jár: spam, flood, idegesítő mondatok, szavanként elküldött\n szövegek, durva káromkodás...\n", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[23], "clear-normal") guiLabelSetColor(GUIEditor.label[23], 61, 161, 254) GUIEditor.label[24] = guiCreateLabel(0.01, 2.28, 0.92, 0.03, " Hogy tudok vízen menni és/vagy repülni?", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[24], "clear-normal") guiLabelSetColor(GUIEditor.label[24], 254, 254, 254) GUIEditor.label[25] = guiCreateLabel(0.01, 2.32, 0.92, 0.21, " -Ha kocsiban vagy (kivéve motor) és beírod, hogy /fly azzal repülni\n fogsz. Kikapcsolásához beírod mégegyszer.\n Ha vízen akarsz menni, arra ott a /water parancs. Ha ki szeretnéd\n kapcsolni, beírod mégegyszer.", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[25], "clear-normal") guiLabelSetColor(GUIEditor.label[25], 61, 161, 254) GUIEditor.label[26] = guiCreateLabel(0.01, 2.45, 0.92, 0.03, " Mi az a \"Privát üzenetek\"?", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[26], "clear-normal") guiLabelSetColor(GUIEditor.label[26], 254, 254, 254) GUIEditor.label[27] = guiCreateLabel(0.01, 2.49, 0.92, 0.21, " -Ezzel a funkcióval privát üzenetet küldhetsz. Rákattintásal kidobja\n a szerveren található összes játékost,\n és kiválasztva a neked megfelelőt, külön üzenetet küldhetsz neki,\n amit csak Ti ketten láttok.", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[27], "clear-normal") guiLabelSetColor(GUIEditor.label[27], 61, 161, 254) GUIEditor.label[28] = guiCreateLabel(0.01, 2.62, 0.92, 0.03, " Hogy lehet színes a nevem?", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[28], "clear-normal") guiLabelSetColor(GUIEditor.label[28], 254, 254, 254) GUIEditor.label[29] = guiCreateLabel(0.01, 2.66, 0.92, 0.21, " -Színkóddal. Beírod Google-ba, hogy színkódok és kidob egy\n csomót. 6 jegyből áll és a jegyek előtt van egy # (rács) jel.\n Úgy működik, hogy a színkód utáni rész a színes. Ha pl. a neved\n ADMIN és a piros színkódot (#FF0000) az ADMIN elé rakod,\n az egész ADMIN szó piros lesz. Viszont ha csak az IN elé, de az ADM\n után, csak az IN lesz piros, az ADM nem. Pár színkód a színkód panelben: /szinkod", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[29], "clear-normal") guiLabelSetColor(GUIEditor.label[29], 61, 161, 254) GUIEditor.label[30] = guiCreateLabel(0.01, 2.85, 0.92, 0.03, " Fontos:", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[30], "default-bold-small") guiLabelSetColor(GUIEditor.label[30], 255, 0, 0) GUIEditor.label[31] = guiCreateLabel(0.01, 2.88, 0.92, 0.21, " Kedves proletár!\n Tisztelettel megkérlek arra, hogy:\n -Ne káromkodj! Vannak fiatalabbak, akik előtt hanyagolni kell az\n obszcén szavak használatát!\n -Nem Role Play (RP) szerver. Ami azt jelenti, hogyha ezen a szerveren\n játszol,\n kapcsold ki a bindjeidet! Pl. XY beveri a fejét, de nem esik nagyobb\n baja\n Vagy gondolok itt a XY beköti az övét, eszik, iszik és egyéb más irritáló\n tevékenységekre.\n -Tartsd tiszteletben a más nyelvet beszélő elvtársaidat! Ne szidd le,\n csak mert török vagy angol.", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[31], "clear-normal") guiLabelSetColor(GUIEditor.label[31], 61, 161, 254) GUIEditor.label[32] = guiCreateLabel(0.01, 3.08, 0.92, 0.03, " Rangosok:", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[32], "default-bold-small") guiLabelSetColor(GUIEditor.label[32], 255, 0, 0) GUIEditor.label[33] = guiCreateLabel(0.01, 3.11, 0.92, 0.21, " [ADMIN]\n -turbesz", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[33], "clear-normal") guiLabelSetColor(GUIEditor.label[33], 61, 161, 254) GUIEditor.label[34] = guiCreateLabel(0.01, 3.17, 0.92, 0.03, " Modok:", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[34], "default-bold-small") guiLabelSetColor(GUIEditor.label[34], 255, 0, 0) GUIEditor.label[35] = guiCreateLabel(0.02, 3.20, 0.92, 0.21, " Ezeket megtalálod az f1-ben!\n\n .\n\n A szerveren sok játékosok által készített mappolás található. (Külön\n köszönet turbesznek!)", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[35], "clear-normal") guiLabelSetColor(GUIEditor.label[35], 254, 254, 254) guiSetVisible(GUIEditor.window[1], false) function helpm() if guiGetVisible ( GUIEditor.window[1] ) == false then guiSetVisible ( GUIEditor.window[1], true ) showCursor(true) elseif guiGetVisible ( GUIEditor.window[1] ) == true then guiSetVisible ( GUIEditor.window[1], false ) showCursor(false) end end bindKey ( "F9", "down", helpm) fileDelete("c.lua")
  24. function tesztlel() local random = math.random(1, 7) --change as appropriate if random == 1 then guiSetVisible(nyer, true) guiSetText(szveg, "Nyereményed: MINIGUN \n\nVárunk vissza 12 óra múlva. ;)\nHasználd egészséggel a nyereményed!") --guiSetVisible(GUIEditorwindow, false) triggerServerEvent("giveWeapon", getLocalPlayer(), group) local currentState = guiGetProperty( GUIEditorgomb1, "Disabled" ) if currentState == "True" then guiSetProperty( GUIEditorgomb1, "Disabled", "True" ) else guiSetProperty( GUIEditorgomb1, "Disabled", "True" ) end elseif random == 2 then guiSetVisible(nyer, true) guiSetText(szveg, "Nyereményed: GOD MODE \n\nVárunk vissza 12 óra múlva. ;)\nHasználd egészséggel a nyereményed!") function godmode ( ) cancelEvent ( ) end addEventHandler ( "onClientGUIClick", button2, function ( ) addEventHandler ( "onClientPlayerDamage", localPlayer, godmode ) toggleControl ( 'fire', false ) toggleControl ( 'action', false ) end ,false ) local currentState = guiGetProperty( GUIEditorgomb1, "Disabled" ) if currentState == "True" then guiSetProperty( GUIEditorgomb1, "Disabled", "True" ) else guiSetProperty( GUIEditorgomb1, "Disabled", "True" ) end elseif random == 3 then guiSetVisible(nyer, true) guiSetText(szveg, "Nyereményed: FEGYVERCSOMAG \n\nVárunk vissza 12 óra múlva. ;)\nHasználd egészséggel a nyereményed!") --guiSetVisible(GUIEditorwindow, false) triggerServerEvent("giveWeapon1", getLocalPlayer(), group) local currentState = guiGetProperty( GUIEditorgomb1, "Disabled" ) if currentState == "True" then guiSetProperty( GUIEditorgomb1, "Disabled", "True" ) else guiSetProperty( GUIEditorgomb1, "Disabled", "True" ) end elseif random == 4 then guiSetVisible(nyer, true) guiSetText(szveg, "Nyereményed: HALH.AUTÓ \n\nVárunk vissza 12 óra múlva. ;)\nHasználd egészséggel a nyereményed!") --guiSetVisible(GUIEditorwindow, false) local car = getPedOccupiedVehicle(localPlayer) if source == button3 then if isVehicleDamageProof(car) == false then setVehicleDamageProof(car, true) else if isVehicleDamageProof(car) == true then setVehicleDamageProof(car, false) end end end local currentState = guiGetProperty( GUIEditorgomb1, "Disabled" ) if currentState == "True" then guiSetProperty( GUIEditorgomb1, "Disabled", "True" ) else guiSetProperty( GUIEditorgomb1, "Disabled", "True" ) end elseif random == 5 then guiSetVisible(nyer, true) guiSetText(szveg, "Nyereményed: TANK \n\nVárunk vissza 12 óra múlva. ;)\nHasználd egészséggel a nyereményed!") --guiSetVisible(GUIEditorwindow, false) triggerServerEvent("tank",getLocalPlayer(),0,255,0,"Ezt a tankot addig használhatod amíg szeretnéd, vigyázz rá, mert 12 óráig nem kapsz újat.") local currentState = guiGetProperty( GUIEditorgomb1, "Disabled" ) if currentState == "True" then guiSetProperty( GUIEditorgomb1, "Disabled", "True" ) else guiSetProperty( GUIEditorgomb1, "Disabled", "True" ) end elseif random == 6 then group = "writing" triggerServerEvent("addToGroup", getLocalPlayer(), group) guiSetVisible(nyer, true) guiSetText(szveg, "Nyereményed: SZÍNESÍRÁS \n\nVárunk vissza 12 óra múlva. ;)\nHasználd egészséggel a nyereményed!") local currentState = guiGetProperty( GUIEditorgomb1, "Disabled" ) if currentState == "True" then guiSetProperty( GUIEditorgomb1, "Disabled", "True" ) else guiSetProperty( GUIEditorgomb1, "Disabled", "True" ) end elseif random == 7 then guiSetVisible(nyer, true) guiSetText(szveg, "Nyereményed: SEMMI! XD \n\nNe bánkódj!\n12 óra múlva hátha kapsz valamit! XD") local currentState = guiGetProperty( GUIEditorgomb1, "Disabled" ) if currentState == "True" then guiSetProperty( GUIEditorgomb1, "Disabled", "True" ) else guiSetProperty( GUIEditorgomb1, "Disabled", "True" ) end end end addEventHandler("onClientGUIClick", GUIEditorgomb1, tesztlel) I want, when the user click on the button, give a thing, and disable button and do not get it again gift
  25. When me and my friend press '2', the script show double answer (- 1 - 1 instead of -2) or when me press '1' and my friend press '2', the script show this: 1.) Answer1 - 1 - 0 and 2.) Answer2 - 1 - 0.. How to fix this? Sorry for my bad english. code: --client-- local szavon = false --is this something used to prevent double questions? it should be serverside :/ local ido = 30 local valasz = 0 local valasz2 = 0 -- I need an explanation of valasz and valasz2, if you use them to keep track of the selected answer then there are errors GUIEditor_Window = {} GUIEditor_Label = {} function szAblak(ker,v1,v2) --question, answ1, answ2, all strings if not szavon then local v_1 = v1 --answ1, useless variable local v_2 = v2 --answ2, useless variable local szavon = true local sw,sh = guiGetScreenSize() GUIEditor_Window[1] = guiCreateWindow(sw/1.48,sh/1.4,sw/3.2,sh/3.6,"Szavazás",false) --wow it's hard to me thinking relatives coord like this, wouldn't be % much easier? guiWindowSetMovable(GUIEditor_Window[1],false) guiWindowSetSizable(GUIEditor_Window[1],false) GUIEditor_Label[1] = guiCreateLabel(0.0474,0.1242,0.9161,0.2919,ker,true,GUIEditor_Window[1]) guiLabelSetHorizontalAlign(GUIEditor_Label[1],"center",true) guiSetFont(GUIEditor_Label[1],"default-bold-small") GUIEditor_Label[2] = guiCreateLabel(0.0657,0.4783,0.8759,0.1553,"1.) "..v_1,true,GUIEditor_Window[1]) GUIEditor_Label[3] = guiCreateLabel(0.0657,0.6335,0.8759,0.1491,"2.) "..v_2,true,GUIEditor_Window[1]) GUIEditor_Label[4] = guiCreateLabel(0.0474,0.8075,0.8,0.1,ido,true,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[4],150,150,255) guiSetFont(GUIEditor_Label[4],"clear-normal") bindKey ("1", "down", function() guiSetFont(GUIEditor_Label[3],"clear-normal") guiLabelSetColor(GUIEditor_Label[3],255,255,255) valasz = 1 guiLabelSetColor(GUIEditor_Label[2],255,200,200) guiSetFont(GUIEditor_Label[2],"default-bold-small") end ) bindKey ("2", "down", function() guiSetFont(GUIEditor_Label[2],"default-normal") guiLabelSetColor(GUIEditor_Label[2],255,255,255) valasz2 = 1 guiLabelSetColor(GUIEditor_Label[3],255,200,200) guiSetFont(GUIEditor_Label[3],"default-bold-small") end ) lejar = setTimer( function() ido = ido-1 guiSetText(GUIEditor_Label[4], ido ) if ido == 0 then szVeg() --so it will be called 30s after szAblak end end, 1000,30) end end function szVeg() if isTimer(lejar) then --is it possible? It's useless i think killTimer(lejar) end szavon = false guiSetText(GUIEditor_Label[4], "szavazatok számlálása..." ) guiSetFont(GUIEditor_Label[2],"default-normal") guiSetFont(GUIEditor_Label[3],"default-normal") guiLabelSetColor(GUIEditor_Label[3],255,255,255) guiLabelSetColor(GUIEditor_Label[2],255,255,255) local v1 = valasz --if 2 was pressed this will be 2, otherwise 0 local v2 = valasz2 --if 2 was pressed this will be 2, otherwise 0 triggerServerEvent("submit",getLocalPlayer(),v1,v2) --valasz will be 1 if 1 key got pressed, otherwise 0 end addEvent("szvzas",true) --this will be called once a one player in the server makes a question addEventHandler("szvzas",root, function(question,answ1,answ2) --the handler attached to the root (resourceRoot should also work) accept 3 arguments szAblak(question,answ1,answ2) --and call the function with these paramenters end ) addEvent("valaszok",true) addEventHandler("valaszok",getRootElement(), function(v1,v2) --after 5 second from szVeg this will be triggered --v1 1 or 0, v2 2 or 0. BOTH CAN BE 0!!!! ALSO BOTH CAN BE 1 AND 2. The font wans't already set? you are not changing any passed var serverside. This doesn't make sense guiSetText(GUIEditor_Label[4], "_@/\"" ) guiSetText(GUIEditor_Label[2], guiGetText(GUIEditor_Label[2]) .. " - " .. v1 ) guiSetText(GUIEditor_Label[3], guiGetText(GUIEditor_Label[3]) .. " - " .. v2 ) if v1 > v2 then --i need explanation here. It's error if you are using them to see what localPlayer choose guiSetFont(GUIEditor_Label[2],"default-bold-small") elseif v1 < v2 then guiSetFont(GUIEditor_Label[3],"default-bold-small") end setTimer( function()--reset to default destroyElement(GUIEditor_Window[1]) szavon = false ido = 30 valasz = 0 valasz2 = 0 end, 5000, 1) end ) --server-- addEvent( "submit", true ) addEventHandler( "submit", root, function (v1, v2) -- 1 or 0, 2 or 0 depending on keypress setTimer( function() triggerClientEvent(root, "valaszok", resourceRoot, v1, v2) end, 5000, 1) end ) function szvzas(playerSource, cmd, theQuestion, theFirstAnswer, theSecondAnswer) --read the wiki for more infos triggerClientEvent ( root, "szvzas", resourceRoot, theQuestion, theFirstAnswer, theSecondAnswer ) --trigger on root, event "szvzas", source is the resource, and there are 3 arguments end addCommandHandler ( "k", szvzas )
×
×
  • Create New...