Search the Community
Showing results for tags 'help!'.
-
Good morning everyone. I wanted to show you a bug. I am using Parallels, a program to virtualize Windows on my MacBook Pro M1PRO. I was able to download the MTA, download GTA too. But when, I go to open the mta, it shows the GTA start screen and then crashes. I already installed the mta again, I tried many things. I want help please. This is the bug: Version = 1.5.9-release-21024.0.000 Time = Mon Nov 8 13:42:37 2021 Module = C:\WINDOWS\SYSTEM32\D3D9.DLL Code = 0xC000001D Offset = 0x0004DAA0 EAX=00000000 EBX=00000000 ECX=00000000 EDX=00000000 ESI=00000000 EDI=00000000 EBP=0577FA50 ESP=0577F38C EIP=718FDAA0 FLG=00000000 CS=3A643A64 DS=3A643A64 SS=3A643A64 ES=3A643A64 FS=3A643A64 GS=577F6B0
-
Faz algum tempo que não entro no meu MTA, quando fui entrar em um servido, encontrei a seguinte frase: "você foi banido de MTA por: Victor KK" Print: https://photos.app.goo.gl/91JB848qJuTGGbAm9 Gostaria de saber o motivo, nunca usei nada de ilegal, só queria voltar a jogar normalmente o meu serial é: E822A65620EB36E8ADBFC604C6CA12F4
-
BUENAS, EN EL SERVIDOR LOCAL FUNCIONAN TODOS MIS RESOURCES (autos,script,accs ETC) PASE TODO AL HOST Y TODO BIEN, SOLO QUE NO PUEDO SACAR AUTOS DEL PANEL F1 , QUE PUEDE SER ???
-
Hello Community, since i changed from my hdd to an ssd, i have the error CD48 on my main server to play on. Screen: https://prnt.sc/KXzWfkvoS-nr Reinstall of the Game or MTA changed nothing. Also the delete of the resources folder doesn't helped. May one of you know what i can do here. I Can connect to every other MTA Server, just the Vio-Reallife Server gives me this error.
-
I've been playing MTA on and off on 2715x1527x32 and it was always above 60 fps, today I changed my resolution to 1920x1080x32 before launching the game and when I did that my game got limited to 10 fps. When that I happened I decided to go back to my old resolution however that didn't fix the fps issue. I tried to reinstall the game and it still didn't work, I even changed the bit level in properties but that keeps getting unchecked after I run the game, I also tried running the game on CPU 0 but but there was no hope. I tried all of the resolutions in the drop-box list and still didn't work apart from the 720x480x32 and lower. The game used to run butter smooth but now I can't even play it because ever since I updated that resolution today. How can I resolve this issue? Thanks
-
function giveV(player, car_id) if player and isElement(player) then if car_id and type(car_id) == 'number' then local _,i = hasV(player, car_id) local garagem = getElementData(player, 'conce.garage') or {} if i then outputChatBox('Você já tem este carro!') --infobox return false else table.insert(garagem, {id = car_id}) setElementData(player, 'conce.garagem', garagem) outputChatBox('Você adquiriu um '..vehicle[car_id].name..'.') --infobox return true end else outputDebugString('Aguardando arg #2 válido para a function hasV') return false end else outputDebugString('Aguardando arg #1 válido para a function hasV') return false end end I'm struggling to make a dealership script, but the giveV function doesn't add the car to the garage list even if the checks pass. Can anyone help?
- 1 reply
-
- helpme
- please help!
-
(and 2 more)
Tagged with:
-
Hello everybody. I need a help. I have a ray that casts from XY to X₁Y₁ with random angle. I need to get a Z₁ coordinate from X₁Y₁. How can I do it? Help me, please, I'll be very grateful for that!
-
local x,y,z,lx,ly,lz = getCameraMatrix() addCommandHandler("getmatrixcam", function() outputChatBox("your position is:" ..x,y,z,lx,ly,lz.. ".") end) Does anyone know what the problem is with this code? (I am using the translator). I'm new to scripting... ERRO: Bad argument @'outputChatBox' [expected bool at argument 5, got number '-1710.618...']
-
Hola, tanto tiempo. Hago este post para realizar una pregunta... el siguiente código (client side) crea peds con distintas posiciones en su respectiva tabla, he tenido un problema: quiero que al matar un ped ESE específicamenre el que maté se destruya y reaparezca en 20 segundos pero al matarlo lo que sucede es que todos los peds de la tabla se destruyen, espero su ayuda.... por aquí dejo una pequeña parte de mi tabla; local PedPlaces = { {-1556, 2355, 10, 350}, {-1346, 2255, 10, 250}, {-1256, 2155, 10, 123}, {-1217, 1667, 10, 69} } for i, v in pairs (PedPlaces) do PED = createPed(15,v[1],v[2],v[3], v[4]) end
-
It's me again. I was testing my edited vehicle script and found a error, when the player enters in the vehicle, It's doesnt matter the chair, they can turn on the engine even if they sit down behind the driver position. I was wondering, there is a recourse that could prevent this? I mean, only execute the comand "turn on the vehicle" when player is sitting in the driver's chair
-
So, i've tryed to edit allowed/disallowed weapons, and from weapon ID list in P>Freeroam>Settings comes [ 0 ] for no reson. In console i've got this error: ERROR: [gameplay]/freeroam/util_server.lua:35: bad argument #1 to 'pairs' (table expected, got number) I have tryed to delete settings.xml from deathmatch folder (Not work) Reinstalling FreeRoam itself (Not Work) Restarting FreeRoam (NW) Help me repair that without restarting server please D=
-
Hi! I've made a simple menu using DGS and it works just fine on F1 key press but it pops up when I start the resource. I want it to not be visible on resource start but rather on F1 key press. This is the code: DGS = exports.dgs local reguli = xmlLoadFile( "reguli.xml" ) local reguli1 = xmlNodeGetValue( reguli ) local allstars = xmlLoadFile( "allstars.xml" ) local allstars1 = xmlNodeGetValue( allstars ) local donatii = xmlLoadFile( "donatii.xml" ) local donatii1 = xmlNodeGetValue( donatii ) local window = DGS:dgsCreateWindow( 0.2, 0.3, 0.6, 0.4, "Allstars Roleplay", true, 0xFF5E0464 ) DGS:dgsWindowSetSizeable( window, false ) showCursor ( true ) DGS:dgsWindowSetCloseButtonEnabled(window, false) local tab = DGS:dgsCreateTabPanel ( 0, 0.1, 1, 1, true, window, 20, 0xFF999999 ) local tab1 = DGS:dgsCreateTab ( "Despre Allstars", tab, 1, 1, 0xFF5E0464 ) local tab2 = DGS:dgsCreateTab ( "Reguli Roleplay", tab, 1, 1, 0xFF5E0464 ) local tab3 = DGS:dgsCreateTab ( "Donatii", tab, 1, 1, 0xFF5E0464 ) memo1 = DGS:dgsCreateMemo( 0, 0, 1, 1, reguli1, true, tab2, 0xFFFFFFFF, 1, 1, nil, 0xFF333333 ) DGS:dgsMemoSetReadOnly( memo1, true ) memo2 = DGS:dgsCreateMemo( 0, 0, 1, 1, allstars1, true, tab1, 0xFFFFFFFF, 1, 1, nil, 0xFF333333 ) DGS:dgsMemoSetReadOnly( memo2, true ) memo3 = DGS:dgsCreateMemo( 0, 0, 1, 1, donatii1, true, tab3, 0xFFFFFFFF, 1, 1, nil, 0xFF333333 ) DGS:dgsMemoSetReadOnly( memo3, true ) function dgsToggleVisible() if ( DGS:dgsGetVisible (window) == true ) then DGS:dgsSetVisible (window, false ) showCursor(false) else DGS:dgsSetVisible (window, true ) showCursor(true) end end bindKey ( "F1", "down", dgsToggleVisible )
-
Opa.. Bom dia/tarde/noite Tenho um script de ativar VIP e Queria ajuda para Setar o VIP em ( x ) Dias Comando_VIP = "ativar" Grupo = "Console" -- Grupo no Painel P ( Manage ACL ) function getPlayerFromPartialName ( name ) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end function Dar_VIP_AirNewSCR ( source, cmd, player, VIP, Dinheiro ) if getElementData ( source, "Console_AirNewSCR" ) == "Sim" then if player and VIP then local Jogador = getPlayerFromPartialName ( player ) if Jogador then if not isGuestAccount ( getPlayerAccount ( Jogador ) ) then local Conta = getAccountName ( getPlayerAccount ( Jogador ) ) if VIP == "Prata" then if isObjectInACLGroup ("user."..Conta, aclGetGroup ( "Prata" ) ) then aclGroupRemoveObject ( aclGetGroup( VIP ), "user."..Conta ) return outputChatBox ( "* Erro: Esse Jogador já é VIP Prata", source, 255, 255, 255, true ) end elseif VIP == "Ouro" then if isObjectInACLGroup ("user."..Conta, aclGetGroup ( "Ouro" ) ) then aclGroupRemoveObject ( aclGetGroup( VIP ), "user."..Conta ) return outputChatBox ( "* Erro: Esse Jogador já é VIP Ouro", source, 255, 255, 255, true ) end elseif VIP == "Esmeralda" then if isObjectInACLGroup ("user."..Conta, aclGetGroup ( "Esmeralda" ) ) then aclGroupRemoveObject ( aclGetGroup( VIP ), "user."..Conta ) return outputChatBox ( "* Erro: Esse Jogador já é VIP Esmeralda", source, 255, 255, 255, true ) end elseif VIP == "Diamante" then if isObjectInACLGroup ("user."..Conta, aclGetGroup ( "Diamante" ) ) then aclGroupRemoveObject ( aclGetGroup( VIP ), "user."..Conta ) return outputChatBox ( "* Erro: Esse Jogador já é VIP Diamante", source, 255, 255, 255, true ) end end if VIP == "Prata" or VIP == "Ouro" or VIP == "Esmeralda" or VIP == "Diamante" then --return outputChatBox ( "* Erro: Esse VIP não existe!", source, 255, 255, 255, true ) --end aclGroupAddObject ( aclGetGroup( VIP ), "user."..Conta ) Musica_Selecionada = math.random ( 1, 3 ) triggerClientEvent ( root, "AirNewSCR_Ativar_VIP", root, Musica_Selecionada, VIP ) if Musica_Selecionada == 1 then --outputChatBox ( "Arquivos/Rae_Sremmurd_Black_Beatles_ft_Gucci_Mane.mp3", source ) Musica_Tocando = "XXXTENTACION - MoonLight" Bonus = 0 elseif Musica_Selecionada == 2 then --outputChatBox ( "Arquivos/Post_Malone_Congratulations_ft_Quavo.mp3", source ) Musica_Tocando = "Old Town Road" Bonus = 50 elseif Musica_Selecionada == 3 then --outputChatBox ( "XXXTENTACION_Look_At_Me.mp3", source ) Musica_Tocando = "FUNK DO MICKEY MOUSE" Bonus = 100 end setElementData ( root, "Ultimo_Ativador", getPlayerName(Jogador) ) setElementData ( root, "VIP_do_Ultimo_Ativador", VIP ) outputChatBox ( " ", root ) outputChatBox ( " ", root ) outputChatBox ( "=======================================================", root, 255, 255, 255, true ) outputChatBox ( "* O(A) Jogador(a) "..getPlayerName(Jogador).." #ffffffAtivou um Plano VIP "..VIP, root, 255, 255, 255, true ) if Bonus == 0 then outputChatBox ( "* Muito Obrigado(a) pela compra do vip em nosso server", root, 255, 255, 255, true ) if Dinheiro ~= false then givePlayerMoney ( Jogador, 0 ) givePlayerMoney ( Jogador, 0 ) end elseif Bonus == 50 then outputChatBox ( "* Muito Obrigado(a) pela compra do vip em nosso server", root, 255, 255, 255, true ) if Dinheiro ~= false then givePlayerMoney ( Jogador, 0 ) givePlayerMoney ( Jogador, 0 ) end elseif Bonus == 100 then outputChatBox ( "* Muito Obrigado(a) pela compra do vip em nosso server", root, 255, 255, 255, true ) if Dinheiro ~= false then givePlayerMoney ( Jogador, 0 ) givePlayerMoney ( Jogador, 0 ) end end outputChatBox ( "* Musica Tocando: "..Musica_Tocando, root, 255, 255, 255, true ) outputChatBox ( "=======================================================", root, 255, 255, 255, true ) outputChatBox ( " ", root ) outputChatBox ( " ", root ) outputDebugString ( "[ Ativação ] - O(A) Admin "..getPlayerName(source).." Ativou um VIP para o(a) Jogador(a) "..getPlayerName(Jogador).."!" ) outputDebugString ( "[ Ativação ] - Bonus do VIP Gerado: "..Bonus.."%" ) setTimer ( function() restartResource ( getThisResource ( ) ) -- Reinicia o Mod Automaticamente! outputDebugString ( "[ AirNewSCR ] - Resource 'Scripts_AtivarVIP' Reiniciado Automaticamente! " ) end, 15000, 1 ) end end else outputChatBox ( "* Erro: Jogador não encontrado!", source, 255, 255, 255, true ) end end end end addCommandHandler ( Comando_VIP, Dar_VIP_AirNewSCR ) function Verificar_Emprego_Atual ( ) for i, player in ipairs(getElementsByType("player")) do local acc = getPlayerAccount(player) if acc and not isGuestAccount(acc) then local accName = getAccountName (acc) if isObjectInACLGroup ("user."..accName, aclGetGroup ( Grupo ) ) then setElementData ( player, "Console_AirNewSCR", "Sim" ) else setElementData ( player, "Console_AirNewSCR", "Não" ) end end end end setTimer ( Verificar_Emprego_Atual, 1500, 0 ) -- By AirNewSCR
-
Preciso de ajuda estou mexendo em um mod de armas que transfere de um jogador para outro mas n consegui colocar preço pra vender alguém me ajuda ===Client=== -- Script Criado by Torugo -- -- www.Modsbr-MTA.blogspot.com.br -- -- Obrigado por Baixar ;D -- local KEY = "F6" -- Hot Key outputChatBox("#0ffff0 Sistema de Armas criado por Torugo",255,0,0,true) -- My Right's ( Don't Change it ) -- ## Important Functions function centerWindow(center_window) -- local screenW,screenH=guiGetScreenSize() local windowW,windowH=guiGetSize(center_window,false) local x,y = (screenW-windowW)/2,(screenH-windowH)/2 guiSetPosition(center_window,x,y,false) end function getPedWeapons(ped) -- local playerWeapons = {} if ped and isElement(ped) and getElementType(ped) == "ped" or getElementType(ped) == "player" then for i=2,9 do local wep = getPedWeapon(ped,i) if wep and wep ~= 0 then table.insert(playerWeapons,wep) end end else return false end return playerWeapons end -- ## Main Window ## wnd = guiCreateWindow(202,74,427,458,"Sistema de Transferir Armas",false) players_grid = guiCreateGridList(0.0211,0.0546,0.4707,0.9258,true,wnd) guiGridListSetSelectionMode(players_grid,1) guiGridListAddColumn(players_grid,"Pessoas...",0.9) weapons_grid = guiCreateGridList(0.5035,0.0546,0.4707,0.5415,true,wnd) guiGridListSetSelectionMode(weapons_grid,1) guiGridListAddColumn(weapons_grid,"Armas",0.6) guiGridListAddColumn(weapons_grid,"Municao",0.3) info = guiCreateLabel(0.5012,0.6092,0.4707,0.0699,"Digite o valor da municao",true,wnd) guiLabelSetColor(info,0,255,0) guiLabelSetVerticalAlign(info,"center") guiLabelSetHorizontalAlign(info,"center",false) guiSetFont(info,"default-bold-small") ammo = guiCreateEdit(0.5035,0.679,0.4731,0.0852,"",true,wnd) send = guiCreateButton(0.5035,0.7838,0.4731,0.0895,"Enviar Armas",true,wnd) guiSetFont(send,"default-bold-small") close = guiCreateButton(0.5035,0.8843,0.4731,0.0895,"Fechar",true,wnd) guiSetFont(close,"default-bold-small") guiSetVisible(wnd,false) centerWindow(wnd) bindKey(KEY,"down", function () if guiGetVisible(wnd) then guiSetVisible(wnd,false) showCursor(false) guiSetInputEnabled(false) else guiSetVisible(wnd,true) showCursor(true) guiSetInputEnabled(true) putPlayers() putWeapons() end end ) function putPlayers() guiGridListClear(players_grid) for _,player in ipairs(getElementsByType("player")) do local row = guiGridListAddRow(players_grid) guiGridListSetItemText(players_grid,row,1,getPlayerName(player),false,false) end end function putWeapons() guiGridListClear(weapons_grid) for _,weapon in ipairs(getPedWeapons(localPlayer)) do if getPedTotalAmmo(localPlayer,getSlotFromWeapon(weapon)) > 0 then local row = guiGridListAddRow(weapons_grid) guiGridListSetItemText(weapons_grid,row,1,getWeaponNameFromID(weapon),false,false) guiGridListSetItemText(weapons_grid,row,2,getPedTotalAmmo(localPlayer,getSlotFromWeapon(weapon)),false,false) end end end function RefreshLists() putPlayers() putWeapons() end addEventHandler("onClientGUIClick",close, function () guiSetVisible(wnd,false) showCursor(false) guiSetInputEnabled(false) end ,false) addEventHandler("onClientGUIClick",send, function () local sel_1 = guiGridListGetSelectedItem(players_grid) local sel_2 = guiGridListGetSelectedItem(weapons_grid) if sel_1 ~= -1 and sel_2 ~= -1 then local PlayerName = guiGridListGetItemText(players_grid,sel_1,1) local player = getPlayerFromName(PlayerName) if isElement(player) then if player ~= localPlayer then local WeaponName = guiGridListGetItemText(weapons_grid,sel_2,1) local WeaponAmmo = guiGridListGetItemText(weapons_grid,sel_2,2) local WeaponID = getWeaponIDFromName(WeaponName) local Ammo = guiGetText(ammo) if tonumber(Ammo) and tonumber(Ammo) >= 10 then if tonumber(WeaponAmmo) >= tonumber(Ammo) then setTimer(RefreshLists,500,1) triggerServerEvent("SendWeapon",localPlayer,player,WeaponID,Ammo) else outputChatBox("Erro: Você não tem munição suficiente para esta arma",255,0,0) end else outputChatBox("Error: Escreva um número na Editar",255,0,0) end else outputChatBox("Erro: Não é possível enviar Arma Para Seu Auto",255,0,0) end else RefreshLists() outputChatBox("Error: Jogador não encontrado, Lists refrescado",255,0,0) end end end ) fileDelete("Client.Lua") ===Server=== -- Script Criado por Torugo -- -- www.Modsbr-MTA.blogspot.com.br -- -- Obrigado por Baixar ;D -- addEvent("SendWeapon",true) addEventHandler("SendWeapon",root, function (player,id,ammo) local id = tonumber(id) local ammo = tonumber(ammo) giveWeapon(player,id,ammo) takeWeapon(source,id,ammo) outputChatBox("#ffffff Enviou #ff0000" .. getWeaponNameFromID(id) .. "#ffffffPara #ff0000" .. getPlayerName(player),source,255,0,0,true) outputChatBox("# " .. getPlayerName(source) .. " #ffffffEnviou #ff0000" .. getWeaponNameFromID(id) .. " #ffffffPara você com #ff0000" .. ammo .. " #FFFFFFMunição",player,255,0,0,true) end ) ===Meta=== <meta> <info author="Torugo" name="Sistema de Transferir armas" version="1.0.0" type="script" /> <script src="Client.Lua" type="client" /> <script src="Server.Lua" type="server" /> </meta> se alguém puder me ajudar
-
Create a login system, faced with this problem: I need to for the player who came to run the resource with authorization. But I don't know how to do it, because my resource runs for everyone. Please help, or if you know how to make it easier - please describe.
-
Hello, well, I was trying to access the MTA PUBG / Battlegrounds server and I get the following in a small tab "Download error: Error downloading requested files, waiting time was reached, [Very slow operation, less than 10 bytes / s transferred last 10 seconds] [DayZ / ggs8ct5rpy.cmf]" Help me please I want to play.
-
Before the multi-theft allowed the use of ReShade was blocked more recently, the Rehade and nothing else wants an ENB series for weak PCs like mine I hope you enjoy
-
[ERRO]Resources ERROR: [Resources]\LojaCarros\server.lua:467: exports: Call to non-running server resource (scr-Lib) [string "?"] Se alguém puder me ajuda ficarei grato, já procurei muito no google e uma pessoa me disse que tinha que ligar o (scr-Lib) só que eu não encontro esse resource para efetua a ligação.
-
Hi Guis I was making a small script and it was firs writer so i have problem when a player win system give times put the times frozen in scoreboard it doesnt move i see the debug and i find that server.lua:206: attempt to index global 'A' (a nill value) [DUP x5] server.lua:206: attempt to index global 'A' (a nill value) So Its The server side Codes and any one help me pls !! captchaNums = 5 -- captcha letters length wordTimeInSec = 25 --- the time before the word disappear in seconds [ default 11 seconds ] --prizefrom,prizeto = 500,800 -- the prize random num timerfrom,timerto = 1.5,5.5 -- the random timer that shows the word [ default from 3 to 15 minutes ] ---- unChangeable wordOn = false --theWord = nil --thePrize = nil wordTime = wordTimeInSec * 1000 Error = { "هلا", "هلا", "انا", "ضض", "تنورا", "حياكم", "سيرفر" } g_root = getRootElement() addEvent("send_M",true) addEventHandler("send_M",root, function( Q, K, K1, A) if tonumber(A) then createCode(Q,A) coans = K coans1 = K1 Amont = A end end ) function createCode(Q,A) for k,v in ipairs( getElementsByType("player") ) do exports.easytext:displayMessageForPlayer(v,1, "=========", wordTime, 0.07, 0.5, 0, 255, 0, 255, 1.6) exports.easytext:displayMessageForPlayer(v,2, "Word : "..Q.."", wordTime, 0.07, 0.533, 255, 255, 0, 255, 1.6) exports.easytext:displayMessageForPlayer(v,3, "Prize : "..A.." Hours ", wordTime, 0.07, 0.563, 255, 255, 0, 255, 1.6) exports.easytext:displayMessageForPlayer(v,4, "=========", wordTime, 0.07, 0.593, 0, 255, 0, 255, 1.6) end startCodeTimer() wordOn = true end function startCodeTimer() codeTimer = setTimer( function () removeCode() OutPut("تم الغاء المسابقة لعدم وجود إجابات",root,0,255,0,true) end , wordTime , 1 ) end function removeCode() for k,v in ipairs( getElementsByType("player") ) do exports.easytext:clearMessageForPlayer(v,1) exports.easytext:clearMessageForPlayer(v,2) exports.easytext:clearMessageForPlayer(v,3) exports.easytext:clearMessageForPlayer(v,4) end if isTimer ( codeTimer ) then killTimer(codeTimer) end coans = nil coans1 = nil wordOn = false end function playerchatqaw ( msg, msgty, A) if coans1 == Error then coans = nil coans1 = nil OutPut("تم الغاء المسابقة لعدم وجود إجابات",getRootElement(),255,255,0,true) removeCode() else if coans then if string.find(msg,coans,1) then OutPut("وقد ربح "..Amont.." ساعة ╰ "..getPlayerName(source).." ╯ الفائز هو",getRootElement(),math.random(255),math.random(255),math.random(255),true) local pTime = { getPlayerTime ( source ) } setElementData ( source, 'PlayTime', tostring ( pTime [ 1 ] + Amont .. ':' .. pTime [ 2 ] .. ':' .. pTime [ 3 ] ) ) --givePlayerMoney(source,Amont) removeCode() coans = nil coans1 = nil end end end end addEventHandler ("onPlayerChat",g_root,playerchatqaw) function playerchatqaw1 ( msg, msgty, A) if coans1 == Error then coans = nil coans1 = nil OutPut("!! تم الغاء السؤوال لنفاذ الوقت",getRootElement(),255,255,0,true) removeCode() else if coans1 then if string.find(msg,coans1,1) then OutPut("وقد ربح "..Amont.." ساعة ╰ "..getPlayerName(source).." ╯ الفائز هو",getRootElement(),math.random(255),math.random(255),math.random(255),true) givePlayerMoney(source,Amont) removeCode() coans = nil coans1 = nil end end end end addEventHandler ("onPlayerChat",g_root,playerchatqaw1) ---------------------------------------------------------------------------------------------- function getPlayerTime ( Player ) local TimeData = getElementData(Player,'PlayTime') or '0:0:0'; if ( TimeData ) then return tonumber(split(TimeData,':')[1]) , tonumber(split(TimeData,':')[2]), tonumber(split(TimeData,':')[3]); end end exports.scoreboard:addScoreboardColumn('PlayTime') addEvent("addTime",true) addEvent("removeTime",true) addEvent("ToServer",true) local t = { } local w = {} addEventHandler("ToServer",root, function (word,get,time) if word and tonumber(get) and tonumber(time) then table.insert(w,{word,get}) setTimer(function () for _,v in ipairs(w) do if v[1] == word and v[2] == get then table.remove(w,i) end end end,time*60*60*1000,1) end end ) addEventHandler("onConsole",root, function (msg) for _,v in ipairs(w) do if msg == v[1] then local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then if not getAccountData ( playeraccount, "time-"..msg) then addPlayerTime(source,v[2]) setAccountData( playeraccount, "time-"..msg,true) end end end end end ) addEventHandler("addTime",root, function (to,time) if to == "all" then for _,v in ipairs(getElementsByType("player")) do addPlayerTime(v,time) end else plr = getPlayerFromName(to) if plr then addPlayerTime(plr,time) end end end ) addEventHandler("removeTime",root, function (to,time) if to == "all" then for _,v in ipairs(getElementsByType("player")) do removePlayerTime(v,time) end else plr = getPlayerFromName(to) if plr then removePlayerTime(plr,time) end end end ) function addPlayerTime(plr,time) time = math.floor(time) A[plr]['hour'] = tonumber(A[plr]['hour'] or 0) + time end function removePlayerTime(plr,time) time = math.floor(time) A[plr]['hour'] = tonumber(A[plr]['hour'] or 0) - time end function checkValues( source,arg1,arg2) if (arg2 >= 60) then A[ source ][ 'min' ] = tonumber( A[ source ][ 'min' ] or 0 ) + 1 A[ source ][ 'sec' ] = 0 end if (arg1 >= 60) then A[ source ][ 'min' ] = 0 A[ source ][ 'hour' ] = tonumber( A[ source ][ 'hour' ] or 0 ) + 1 end return arg1, arg2 end setTimer( function( ) for _, v in pairs( getElementsByType( "player" ) ) do if (not A[ v ]) then A[ v ] = { ["hour"] = 0, ["min"] = 0, ["sec"] = 0 } end A[ v ][ 'sec' ] = tonumber( A[ v ][ 'sec' ] or 0 ) + 1 local min,sec = checkValues ( v, A[ v ][ 'min' ] or 0, A[ v ][ 'sec' ] or 0 ) local hour = tonumber( A[ v ][ 'hour' ] or 0 ) setElementData( v, "PlayTime", tostring( hour )..':'..tostring( min )..':'..tostring( sec ) ) end end, 1000, 0 ) function onPlayerQuit ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then local sValue = getElementData( source,'PlayTime' ) local hour = tonumber( A[ source ][ 'hour' ] or 0 ) local min = tonumber( A[ source ][ 'min' ] or 0 ) local sec = tonumber( A[ source ][ 'sec' ] or 0 ) setAccountData ( playeraccount, "PlayTime-hour", tostring(hour) ) setAccountData ( playeraccount, "PlayTime-min", tostring(min) ) setAccountData ( playeraccount, "PlayTime-sec", tostring(sec) ) setAccountData ( playeraccount, "PlayTime", tostring(sValue) ) end A[ source ] = nil end function onPlayerLogin (_, playeraccount ) if ( playeraccount ) then local time = getAccountData ( playeraccount, "PlayTime" ) local hou = getAccountData ( playeraccount, "PlayTime-hour") local min = getAccountData ( playeraccount, "PlayTime-min") local sec = getAccountData ( playeraccount, "PlayTime-sec") if ( time ) then setElementData ( source, "PlayTime", time ) A[ source ]["hour"] = tonumber(hou) A[ source ]["min"] = tonumber(min) A[ source ]["sec"] = tonumber(sec) else setElementData ( source, "PlayTime",0 ) setAccountData ( playeraccount, "PlayTime",0 ) end end end addEventHandler ( "onPlayerQuit", root, onPlayerQuit ) addEventHandler ( "onPlayerLogin", root, onPlayerLogin ) Any Help pls
- 10 replies
-
- play time
- server side
-
(and 1 more)
Tagged with: