Jump to content

Dziugasc

Members
  • Posts

    106
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Dziugasc

  1. So I got code but it doesn't work and when I tested with other player it didn't invited him. Server: Client:
  2. Sveiki, taigi šita forumo kategorija gan tyloka nusprendžiau prikelti. Taigi, Ištikro rašau kad surasčiau žmonių norinčių prisidėti prie mano MTA projekto "San Andreas Black Room" taigi tokio tipo serverių dažniausiai rasite San-Andreas Multi Player. Per visa laiką kurį žaidžiau MTA buvau rades 2 panašaus tipo serverius abu buvo gan populiarus vienu metu, bet dėl kaikurių priežasčių jie išmirė. Taigi, manau užteks tiek istorijos taigi kokio tipo tai serveris: Taigi tai yra Deathmatch(Ginklų) serveris jame žaidėjai galetų šaudytis dirbti darbus kituose miestuose, pradėti verslą, įkurti gaujas, Pirkti Namus,Nuosavas mašinas. Projekto Discord : https://discord.gg/87JAjBr Jame galit rasti daug įdomių "botų" ir galit nieko netrugdomi ir bevargo surasti serverio žaidėjus. Na grįztam prie projekto. Aišku bus ir visoki mini-game kaip: Tetris - Manau visi žino kas tai. RC Battles - Tai tik mano planuose bet tai būtų kaip 1v1 bet su RC mašinėlėm gal ir Komandinis tipas būtų iStunt - 100 skirtingų trasų nuo lengviausios iki psichiškai nesveikai sunkios. Pagrindinis tikslas kuo greičiau pasiekti Hunter pickup Zombių Apokalipsė - Irgi planuose.Manau šiam reiks daugiausia darbo taigi tai atrodytų kaip koks RPG kur galėtum gerinti savo ginklus, atrakinti skillus, žudyti zombius. Lenktynės - nuo paprasto traktoriaus iki Hydros lekenčios kaip torpeda visa kita manau suprasit kas greitesnis tas pirmesnis. Na pakalbėkim apie verslus taigi, žmogus galėtų įkurti versla už gan didelę kaina, bet viską lemtų ar kitus sudomins tavo verslas, aišku gali vienas nutempti savo verslą iki viršunės. Dideli verslai turėtų nuosavus fabrikus, ofisus. Manau su verslais atsirastų darbo naujokams pavyzdžiui kurjeris turėtų pervežt prekes į parduotuves kituose miestuose. Kai verslas turi darbuotojų ir kuo verstis verslo įkurėjas uždirbtų ar net pardavinėti akcijas. Pagal mane projekto pagrindas visvien lieka Deathmatch/Gang War taigi papasakosiu apie tai DM jau turėtų visi suprast nusitaikai į prieša ir šauni kas gali būt sunkiau? O, kaip apie Gang War? Gang War pagal mane yra ir labai svarbi serverio dalis gaujos galėtų užimti zonas LV mieste ir kai turėtų pakankamai galios mieste galetų įsikurti į mieste esančias gaujų bazes likusias po garsiujų gaujų karo kuris baigesi jų visų sunaikinimu aišku atsirastų konkurentų kurie noretų iš gaujos pavogti bazę bet jei puolimas nepavyktų bazė gautų 2x arba 3x apsauga nei normaliai. Pagrindinis galios šaltinis būtų zonos kitaip sakant turfai iš jų gaujos galėtų įsigyti ginklų,transporto, gynybos bazei ir galėtų užsisakyti spec. Mechaniko paslaugas pagerinti gaujos mašinas Tikiuosi atsiras norinčių prisideti dabar dirbu su gaujų sistema. Atrodo lėtai darau serveri bet patikėkit galima sakyt visą laiką aš esu vienintelis kuris kuria jį, aišku buvo keli žmonės bet rado naujos veiklos. Jei kam įdomu rašiau ~1val
  3. So i made gui for invites and tried to make whenever gang leader invites some player it would setTeam,setSkin,setColor,setTag but idk how Client: SERVER btw how to make max number in editbox like RGB 255 if higher turn to 255
  4. So hello everyone, so i always wanted to make my own city in MTA so i did it. Time it took to make 1.5months of mapping video: https://m.youtube.com/watch?v=k4ICUgdT-sU its pretty long but i tested is it not buggy (btw it is stunt city) you can suggest good names for it because i cant figure cool name for it
  5. You could check Mtasa://217.182.177.103:27315 It's almost done
  6. Wow 400$ and very sad that youre selling it. I really like inrior system i never seen something like that and would buy it but it says only gamemode. I hope someone buys it and becomes succesful with it
  7. Try doing without gui editor for example you want one button instead of other copy one xyz and replace with gui editor you would make bugs or something like that
  8. So my name is Dziugas i am 16years old. And i live in Lithuania it's near Poland and Baltic Sea. I always liked to play video games my first games was Mafia The city of Lost Heaven and Grand Theft Auto San San Andreas. I started creating server 6months ago from scratch with my friend Skardine aka Skarbonke and without him i wouldn't think of ideas that he suggested to me. (Edit) So now let's talk about what i want. So my gamemode Black-Room is gangwar/freeroam first of all i want Gang and Turf system gang creation gui is basically Gang name,Tag,Color in (r,g,b), skin to create it you need 30millions when you create you get Founder status in gang on scoreboard it would show [GANG] Grove Street for example and your name would be [Tag]Name and you can /gang it would show window with members and in bottom invite / remove and gang has 7ranks 6th is Vice President max 2members 5,4,3 can be called randomly 2nd is Member 1st Trial You can set rank with /setrank (Player) rank player has to be online and now let's talk about gang bases and turfs only members that was in gang for 12hour or longer can take turfs/bases and it would be 3bases or more in each city and ~40turfs bigger turf more people needs to be in it. GANG bases when gang takes base it gets 6hour protection if you stole from another gang base it gets 12hour same with turfs after you take base you can enter /gang it would show window with gang cars and gang guns you could buy them with money gained from deposits or money gained from turfs (the larger turf = more money) all turfs would give 4millions/hour. Gang cars would have 100lives they would decrease only if they are out of the base when they explodes guns are similar but it's every spawn and count of guns would be diffrent for example 2000ak for 10mil 1500m4 for 20mil or rocket launcher 100 for 500mil.In gang base somewhere it would be marker with gang information like members,turfs owned, money from turfs at bottom there would be 2buttons Guns where you could select guns that you want spawn with it checkboxes and money deposit.Now let's talk more about turfs as said before only members that was in gang for 12hours and there would be 2people zones(4turfs very small) 3people(about 21turfs)4poeple(10turfs) and 5people zones(5turfs very large). Gangs/turfs would be saved in MySQL or SQlite databases! Next thing is called spawn guns it's system in MySql or SQlite where you buy guns and they stay in you account for 1year for example 25sniper bullets 2millions. Spawn point system for gangs in their bases or in random turf for professions in their spawnpoints and every person would have 30sec protection from damage if he shoots player protection instanly breaks. And every profession would have it's advantages for example Sniper if he stays in same place he would dissapear from radar or map. House and Garage system so i have car system and i would want to link it with Garage system for example there would be 10 Garage levels if you don't have garage max cars would be 5cars 10level Garage max 50cars every garage level up would cost Level 1 25mil, 2nd 50mil, 3rd 75mil, 4th 100mil, 5th 125mil, 6th 150mil, 7th 175mil, 8th 200mil, 9th 225mil,10th 250mil if player has house he can upgrade garage to Level 10 if not just to 3. Now let's talk about House system once i found system that i would like but i can't connect it to mysql link is https://community.multitheftauto.com/index.php?p=resources&s=details&id=5228 i want that you would link this house system to garage system. And if there's anyone that could script it for free it would be very nice. I can pay by giving my whole gamemode with maps or buying game like CS GO REQUIREMENTS: Scripts has to be uncompiled that i could edit things, It should be good quality, No secret things. NOTE: For additional information PM me! And if you can help me with connection to MySQL server i tried but it shows error that it can't connect. Sorry for mistakes in my words etc.
  9. So i got this turf system edited little bit but it doesn't remove turfing when player leaves turf
  10. Success because of you guys i'm really happy
  11. well i did that but still it does not create gang debug doesn't say anything
  12. So i have this code and i tried to make gang creation system GUI is 50% done and does not create teams on TAB [Scoreboard] i tried making that it would create it on tab but nothing would happen also i don't know how to make gang tag and skin gang tag would look like this [GANG] in beginning means that this team is GANG not something else [GANG] Grove Street [GS]Dziugasc i don't want to change player name with tag just attach it on beginning of name Here is server side what i tried
  13. so i want to edit LVDM gangs and zones but i am very very big noob and don't know how to do it i tried to do something but it would do many errors what help i need is making gangs and zones to SQLite and make it on scoreboard example [GANG] Grove Street (1) [GS]Dziugasc
  14. Dziugasc

    Editor help

    Try stop editor and then start editor Make sure you have editor_edf ir something like that
  15. how to change MySQL to SQLite maybe someone has modified version of database?
  16. so i have this code exports.scoreboard:addScoreboardColumn( 'time', root, 150 ) -- Online time is the element data local DB = dbConnect( "sqlite", "time.db" ) addEventHandler("onResourceStart", resourceRoot, function ( ... ) dbExec( DB, "CREATE TABLE IF NOT EXISTS online( playerACC, weeks,days, hours, minutes, secs )") for i, player in ipairs( getElementsByType("player") ) do local accountN = getAccountName( getPlayerAccount( player ) ) local getData = dbPoll( dbQuery( DB, "SELECT * FROM online WHERE playerACC=?", accountN), -1 ) if ( #getData == 0 ) then setPlayerTime( player, 0, 0, 0, 0, 0 ) else for i, data in ipairs( getData ) do local weeks = data.weeks or 0 local days = data.days or 0 local hours = data.hours or 0 local minutes = data.minutes or 0 local seconds = data.secs or 0 setPlayerTime( player, weeks ,days, hours, minutes, seconds ) end end setTimer( updatePlayerTime, 1000, 0, player ) end end) addEventHandler("onPlayerLogin", root, function ( ... ) local accountN = getAccountName( getPlayerAccount( source ) ) local getData = dbPoll( dbQuery( DB, "SELECT * FROM online WHERE playerACC=?", accountN), -1 ) if ( #getData == 0 ) then setPlayerTime( source, 0, 0, 0, 0, 0 ) else for i, data in ipairs( getData ) do local weeks = data.weeks or 0 local days = data.days or 0 local hours = data.hours or 0 local minutes = data.minutes or 0 local seconds = data.secs or 0 setPlayerTime( source, weeks ,days, hours, minutes, seconds ) end end setTimer( updatePlayerTime, 1000, 0, source ) end) function setPlayerTime( player, weeks ,days, hours, minutes, secs ) local accountN = getAccountName( getPlayerAccount( player ) ) if ( accountN ) then local dbe = dbQuery( DB, "SELECT * FROM online WHERE playerACC=?", accountN) local result = dbPoll( dbe, -1 ) local realTime = table.concat{ weeks.."w ",days.."d "..hours.."h ", minutes.."min.", secs.."s " } --", secs.."s " setElementData( player, "time", realTime ) if ( #result == 0 ) then dbExec( DB, "INSERT INTO online( playerACC, weeks, days, hours, minutes, secs ) VALUES( ?, ?, ?, ?, ?, ? ) ", accountN, tonumber( weeks ), tonumber( days ), tonumber( hours ), tonumber( minutes ), tonumber( secs ) ) else dbExec( DB, "UPDATE online SET playerACC=?, weeks=?, days=?, hours=?, minutes=?, secs=?", accountN, tonumber( weeks ), tonumber( days ), tonumber( hours ), tonumber( minutes ), tonumber( secs) ) end end end function updatePlayerTime( player ) local accountN = getAccountName( getPlayerAccount( player ) ) if ( accountN ) then local getData = dbPoll( dbQuery( DB, "SELECT * FROM online WHERE playerACC=?", accountN), -1 ) if ( getData ) then for index, data in ipairs( getData ) do data.secs = data.secs + 1 if ( data.secs == 5 ) then data.hours = data.hours + 1 data.secs = 0 elseif ( data.minutes == 60 ) then data.hours = data.hours + 1 data.minutes = 0 elseif ( data.hours == 24 ) then data.days = data.days + 1 data.hours = 0 elseif ( data.days == 7 ) then data.weeks = data.weeks + 1 data.days = 0 end setPlayerTime( player, data.weeks, data.days, data.hours, data.minutes, data.secs ) end end end end And i have 3problems and one question . 1st problem WARNING: [gameplay]/killcount-scoreboard/server.lua 62. bad argument @ 'getAccountName' [Expected element at argument 1] [DUP x11] . 2nd problem that it converts seconds 60sec to 1min i tried changing it and it worked but it can't convert second third and fourth only seconds. 3rd problem that it saves data only to one account for example there is 3players it should load time every player but it load 1st only acc for example on sqlite it shows: Dziugasc I 0weeks I 0days I 15hours I 35minutes I 45 seconds Dziugasc I 0weeks I 0days I 15hours I 35minutes I 45 seconds Dziugasc I 0weeks I 0days I 15hours I 35minutes I 45 seconds And question how to make that it would show only time that player was online for example he was online only 1d and 18hours and on scoreboard it would show 1d 18h in my scoreboard it shows 0w 0d 0h 15min. [I don't need 0 that way it would be nicer to look.
  17. https://pastebin.com/89wg7kz9 doesn't create scoreboard collum exports.scoreboard:addScoreboardColumn('time') function createTables() time = executeSQLQuery("CREATE TABLE IF NOT EXISTS time ( playerUser TEXT, playerName TEXT, time TEXT)") if ( time == false ) then outputDebugString( "*Error Table time" ) else outputDebugString( "*Create/Load Table time" ) end end addEventHandler ( "onResourceStart" , resourceRoot, createTables) function addDataValue ( player, data, value) local user = getAccountName( getPlayerAccount( player ) ) local selectUser = executeSQLQuery("SELECT * FROM time WHERE playerUser=?", user) if #selectUser == 0 then return end for _, info in ipairs( selectUser ) do if data == "time" then local setValue = info.time + value executeSQLQuery("UPDATE `time` SET `time`=? WHERE `playerUser`=?", setValue, user) end end refreshNowDatas(player) end function getDataValue ( player, data) local user = getAccountName( getPlayerAccount( player ) ) local selectUser = executeSQLQuery("SELECT * FROM time WHERE playerUser=?", user) if #selectUser == 0 then return end for _, info in ipairs( selectUser ) do if data == "time" then return formatValue(info.time) end end end function setDataValue ( player, data, value) local user = getAccountName( getPlayerAccount( player ) ) local selectUser = executeSQLQuery("SELECT * FROM time WHERE playerUser=?", user) if #selectUser == 0 then return end if data == "time" then executeSQLQuery("UPDATE `time` SET `time`=? WHERE `playerUser`=?", value, user) end refreshNowDatas(player) end function startDataValue( player) if isPlayerLogged(player) then local user = getAccountName( getPlayerAccount( player ) ) local selectUser = executeSQLQuery("SELECT * FROM time WHERE playerUser=?", user) if #selectUser == 0 then executeSQLQuery("INSERT INTO `time`(`playerUser`,`playerName`,`time`) VALUES(?,?,?)", user, getPlayerName(player),"0","0","0") outputDebugString("New Data Added by "..string.gsub(getPlayerName(player), "(#%x%x%x%x%x%x)","")) end setElementData(player,"playerOnline",getTickCount()) setColorInLogin(player) setDataValue( player, "playerName", getPlayerName(player)) onRecallTeam( player ) loginDonator( player ) --getPlayerTeamStatus( player ) refreshNowDatas(player) end end local msValues = { week = 607800000, day = 86400000, hour = 3600000, minute = 60000, } function msToTimeString(playedTime) if playedTime then local weeks = math.floor(playedTime/msValues.week) local days = math.floor(playedTime/msValues.day) local playedTime = playedTime - (msValues.day*days) local hours = math.floor(playedTime/msValues.hour) local playedTime = playedTime - (msValues.hour*hours) local minutes = math.floor(playedTime/msValues.minute) return weeks.." w, "..days.." d, "..hours.." h, "..minutes.." min." end end function formatValue( value) return tonumber(string.format("%."..(0).."f",value)) end function getRankingData( player, data ) local select = executeSQLQuery("SELECT * FROM time ") local RankingData = {} for _, info in ipairs( select ) do local getData = false if data == "time" then getData = info.time end if info.playerName and getData then getData = formatValue(getData) table.insert( RankingData,{ name = info.playerName, data = getData}) end table.sort(RankingData,function(a,b) return(tonumber(a.data) or 0 ) > ( tonumber(b.data) or 0 ) end ) if data == "time" then for i,data in ipairs (RankingData) do data.data = msToTimeString(data.data) end end callClientFunction(player,"refreshRanking",RankingData) end function getPlayerAllData( player , getPlayer) local user = getAccountName( getPlayerAccount( getPlayer ) ) local selectUser = executeSQLQuery("SELECT * FROM time WHERE playerUser=?", user) local RankingData = {} if #selectUser == 0 then return end for _, info in ipairs( selectUser ) do local name = info.playerName local time = msToTimeString(info.time) table.insert( RankingData,{ name, time}) callClientFunction(player,"refreshPlayerStats",RankingData) end end end
  18. Also how to make that it would show for example if player online only 10min it will show 10min. But no hours days or weeks another example player plays 1w 5d 12h 35min. So that it wouldn't show everything if player has only minutes or hours
  19. so hello so i tried adding days and weeks but all i got was error and i can't figure way how to make days from hours and then weeks from days code: exports.scoreboard:addScoreboardColumn('time') local t = { } function checkValues( source,arg1,arg2) if (arg2 >= 60) then t[ source ][ 'min' ] = tonumber( t[ source ][ 'min' ] or 0 ) + 1 t[ source ][ 'sec' ] = 0 end if (arg1 >= 60) then t[ source ][ 'min' ] = 0 t[ source ][ 'hour' ] = tonumber( t[ source ][ 'hour' ] or 0 ) + 1 end return arg1, arg2 end setTimer( function( ) for _, v in pairs( getElementsByType( "player" ) ) do if (not t[ v ]) then t[ v ] = { ["hour"] = 0, ["min"] = 0, ["sec"] = 0 } end t[ v ][ 'sec' ] = tonumber( t[ v ][ 'sec' ] or 0 ) + 1 local min,sec = checkValues ( v, t[ v ][ 'min' ] or 0, t[ v ][ 'sec' ] or 0 ) local hour = tonumber( t[ v ][ 'hour' ] or 0 ) setElementData( v, "time", tostring( hour )..'h '..tostring( min )..'min.' ) end end, 1000, 0 ) function onPlayerQuit ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then local sValue = getElementData( source,'time' ) local hour = tonumber( t[ source ][ 'hour' ] or 0 ) local min = tonumber( t[ source ][ 'min' ] or 0 ) local sec = tonumber( t[ source ][ 'sec' ] or 0 ) setAccountData ( playeraccount, "time-hour", tostring(hour) ) setAccountData ( playeraccount, "time-min", tostring(min) ) setAccountData ( playeraccount, "time-sec", tostring(sec) ) setAccountData ( playeraccount, "time", tostring(sValue) ) end t[ source ] = nil end function onPlayerLogin (_, playeraccount ) if ( playeraccount ) then local time = getAccountData ( playeraccount, "time" ) local hou = getAccountData ( playeraccount, "time-hour") local min = getAccountData ( playeraccount, "time-min") local sec = getAccountData ( playeraccount, "time-sec") if ( time ) then setElementData ( source, "time", time ) t[ source ]["hour"] = tonumber(hou) t[ source ]["min"] = tonumber(min) t[ source ]["sec"] = tonumber(sec) else setElementData ( source, "time",0 ) setAccountData ( playeraccount, "time",0 ) end end end addEventHandler ( "onPlayerQuit", root, onPlayerQuit ) addEventHandler ( "onPlayerLogin", root, onPlayerLogin )
  20. I found kills but now i need deaths local SQL = Connection("sqlite", "kills.db"); SQL:exec("CREATE TABLE IF NOT EXISTS player_kills (account_name varchar(255), account_kills INT)"); exports.scoreboard:scoreboardAddColumn("Kills", root, 120, "Kills"); local function getDatabaseAccountData(accName) if accName then local query = SQL:query("SELECT * FROM player_kills WHERE account_name=?", accName); local result = query:poll(-1); if result and type(result) == "table" then if (#result) > 0 then return result[1]["account_kills"]; end end end return false; end local function setDatabaseAccountData(accName, kills) if accName and kills then local data = getDatabaseAccountData(accName) if data then SQL:exec("UPDATE player_kills SET account_kills=? WHERE account_name=?", kills, accName); return true; else SQL:exec("INSERT INTO player_kills (account_name, account_kills) VALUES (?,?)", accName, kills); return true; end end return false; end addEventHandler("onPlayerWasted", root, function(_, killer) if killer and killer ~= source then -- Incase a killer is a vehicle, check if there's a killer driver of it if killer:getType() == "vehicle" then if killer:getController() then killer = killer:getController(); end end if killer:getType() ~= "player" then return end; if not killer.account:isGuest() then local currentStreak = tonumber(killer:getData("Kills")) or 0; killer:setData("Kills", currentStreak + 1); end end end ); addEventHandler("onResourceStart", resourceRoot, function() for _, player in pairs(getElementsByType("player")) do local acc = player:getAccount() if not acc:isGuest() then local accName = acc:getName(); local data = getDatabaseAccountData(accName); if data then player:setData("Kills", data); else player:setData("Kills", 0); end else player:setData("Kills", "Guest"); end end end ); addEventHandler("onPlayerJoin", root, function() source:setData("Kills", "Guest"); end ); addEventHandler("onPlayerLogin", root, function(_, acc) if not acc:isGuest() then local accName = acc:getName(); local data = getDatabaseAccountData(accName); if data then source:setData("Kills", data); else source:setData("Kills", 0); end end end ); addEventHandler("onPlayerLogout", root, function(acc) if not acc:isGuest() then local currentStreak = tonumber(source:getData("Kills")) or 0; local accName = acc:getName(); setDatabaseAccountData(accName, currentStreak); source:setData("Kills", 0); end end ); addEventHandler("onPlayerQuit", root, function() local acc = source:getAccount() if acc and not acc:isGuest() then local currentStreak = tonumber(source:getData("Kills")) or 0; local accName = acc:getName(); setDatabaseAccountData(accName, currentStreak); end end );
  21. Good idea but can someone tell where i made mistake because it doesnt save kills or deaths maybe examples?
  22. so i tried to make saving system that saves kills and deaths but it doesn't save full script local root = getRootElement() local scoresRoot = getResourceRootElement(getThisResource()) local scoreColumns = {"Kills", "Deaths", "ratio", "status"} local isColumnActive = {} local KDR_DECIMAL_PLACES = 2 --http://lua-users.org/wiki/SimpleRound local function round(num, idp) local mult = 10^(idp or 0) return math.floor(num * mult + 0.5) / mult end local function setScoreData (element, column, data) if isColumnActive[column] then setElementData(element, column, data) end end local dbConnection = dbConnect("sqlite", "backupexprank.db") local qh = dbQuery( dbConnection,"CREATE TABLE IF NOT EXISTS scores (name text,Kills text,Deaths text)") dbFree( qh ) function saveScore(sourcePlayer) local account = getPlayerAccount(sourcePlayer) local name = getAccountName(account) local Kills = getAccountData(account, "Kills") local Deaths = getAccountData(account, "Deaths") local qh = dbQuery( dbConnection, "SELECT * FROM scores where name=?",name) local res = dbPoll(qh,-1) dbFree( qh ) if #res > 0 then dbExec( dbConnection, "UPDATE scores SET Deaths=? where name=? ", Deaths,name ) dbExec( dbConnection, "UPDATE scores SET Kills=? where name=? ", Kills,name ) outputChatBox ( "Saved account " .. name .. " with the Kills " .. Kills .. " with the Deaths" .. Deaths .. " to our database") else dbExec(dbConnection, "INSERT INTO scores VALUES(?, ?, ?)", name, Kills, Deaths) outputChatBox ( "Saved account " .. name .. " with the Kills " .. Kills .. " with the Deaths" .. Deaths .. " to our database") end end addCommandHandler("savestats", saveScore) local function resetScores (element) setScoreData(element, "Kills", 0) setScoreData(element, "Deaths", 0) local status = "" if isPedDead(element) then status = "Dead" end setScoreData(element, "status", status) end local function updateRatio (element) local Deaths = getElementData(element, "Deaths") if Deaths == 0 then setScoreData(element, "ratio", "-") else local kdr = round(getElementData(element, "Kills") / Deaths, KDR_DECIMAL_PLACES) setScoreData(element, "ratio", tostring(kdr)) end end function updateActiveColumns () for i, column in ipairs(scoreColumns) do if get(column) then isColumnActive[column] = true exports.scoreboard:addScoreboardColumn(column) elseif isColumnActive[column] then isColumnActive[column] = false exports.scoreboard:removeScoreboardColumn(column) end end end addEventHandler("onResourceStart", scoresRoot, function () updateActiveColumns() for i, player in ipairs(getElementsByType("player")) do resetScores(player) end end ) addEventHandler("onResourceStop", scoresRoot, function () for i, column in ipairs(scoreColumns) do if isColumnActive[column] then exports.scoreboard:removeScoreboardColumn(column) end end end ) addEventHandler("onPlayerJoin", root, function () resetScores(source) end ) addEventHandler("onPlayerWasted", root, function (ammo, killer, weapon) if killer then if killer ~= source then -- killer killed victim setScoreData(killer, "Kills", getElementData(killer, "Kills") + 1) setScoreData(source, "Deaths", getElementData(source, "Deaths") + 1) if isColumnActive["ratio"] then updateRatio(killer) updateRatio(source) end else -- victim killed himself setScoreData(source, "self", getElementData(source, "self") + 1) end else -- victim died setScoreData(source, "Deaths", getElementData(source, "Deaths") + 1) if isColumnActive["ratio"] then updateRatio(source) end end setScoreData(source, "status", "Dead") end ) addEventHandler("onPlayerSpawn", root, function () setScoreData(source, "status", "") end ) i need that it would save always without typing command like player died save to db
×
×
  • Create New...