Jump to content

Mario222

Members
  • Posts

    12
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Mario222's Achievements

Square

Square (6/54)

0

Reputation

  1. I need a Rank-Points system that can be displayed on the scoreboard for a server with maps of Race and DD-DM-Shooter. Composed as follow. Number 1 - Win 20 Points. Number 2 - Win 10 Points. Number 3 - Win 5 Points. Number 4 to down - 2 Points. And the number of rank based on the number of existing accounts and who have more rank based on his points, and the one who has more points the higher his rank will be the largest being the number 1.
  2. I wanna kill a last survivor in DD or Fun maps before when is the last survivor like 2 seconds after but i don't know how to do it.
  3. Yes i didn't saw that i fixed the problem. How to make it give money to the player regardless of whether it is a DD map or a race I can use the function of getAlivePlayers getDeadPlayers ???
  4. I have this resource that gives money to players based on their rank that I configure and adapt for only 20 players (maximum limit that I put on my server), it is a DD server but also a race and some from FunDD. So, the resource doesn't work, I have maps of both types and I need it to work in terms of rank but with the number of people left as I configure it, but that the winner, when no one is left alive, can take their money but I can't achieve how do it, I'm sorry if I bother but I'm still new to this Lua. -- # Server Side ! local Ranks = { {1,400}, {2,200}, {3,100}, {4,80}, {5,50}, {6,30}, {7,20}, {8,20}, {9,20}, {10,10} {11,10} {12,10} {13,10} {14,10} {15,10} {16,5} {17,5} {18,5} {19,5} {20,5} } addEventHandler("onPlayerWasted",root, function ( ) for _,v in ipairs ( Ranks ) do if ( exports["race"]:getPlayerRank( source ) == v[1] ) then givePlayerMoney ( source,v[2] ) end end end )
  5. addEventHandler ( 'onGamemodeMapStart', root, function ( mapres ) local txMapName = getResourceName ( mapres ); pHasBought = false; allGotVehicle = false; getAliveGuys ( 3 ); saveSqlPlayed ( txMapName ); end ) function rStart ( ) pHasBought = false; allGotVehicle = false; executeSQLQuery ( "CREATE TABLE IF NOT EXISTS tx_MapShop ( mapName TEXT, played INTEGER )" ); getAllMapsFromManager ( ); txBMaps = { } end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource ( ) ), rStart ) function buyNextMap ( player, mapName ) if not player or not mapName then return end if ( isGuestAccount ( getPlayerAccount ( player ) ) == false ) then if pHasBought == false then local money = tonumber ( getPlayerMoney ( player ) ); local theTime = getMsFromMin ( 1 ); if money >= tonumber ( price ) then if ( not txBMaps [ mapName ] ) then txBMaps [ mapName ] = true executeCommandHandler ( "bm", player, mapName ); --This function need admin rights pHasBought = player; setTimer ( removeMapFromList, theTime.ms, 1, mapName ); else outputChatBox ( "* #ff0000'#ffffff" .. mapName .. "#ff0000' #ffffffwill be #abcdefavailable #ffffffin #abcdef10 #ffffffminutes", player, 255, 255, 255, true ); end else outputChatBox ( "* You #abcdefdon't #ffffffhave enough #abcdefmoney #ffffffto buy the map!", player, 255, 255, 255, true ); end else outputChatBox ( "* A #abcdefmap #ffffffis already bought at the moment! Please #abcdeftry #ffffffagain later", player, 255, 255, 255, true ); end else outputChatBox ( "* You should be #abcdeflogged in to buy the map!", player, 255, 255, 255, true ); end end addEvent ( "doBuyMap", true ) addEventHandler ( "doBuyMap", root, buyNextMap ) function removeMapFromList ( mapName ) outputChatBox ( "* #abcdef" .. mapName .. " #ffffff - #ffffffis now #abcdefavailable #ffffffat the #abcdefMap Shop!", root, 255, 255, 255, true ); txBMaps [ mapName ] = nil; end addEvent ( "onRaceStateChanging", true ) addEventHandler ( "onRaceStateChanging", root, function ( newState ) if ( newState == "Running" ) then for k,v in pairs ( getElementsByType ( "player" ) ) do local hisVehicle = getPedOccupiedVehicle ( v ); if not hisVehicle then return end setElementData (v, "gotMoney", false ); if isPedInVehicle ( v ) then allGotVehicle = true; end end if allGotVehicle then getAliveGuys ( 1 ); end end end ) addEventHandler ( "onPlayerJoin", root, function ( ) setElementData ( source, "gotMoney", false ); --Atm only setElementData end ) --Functions by Admin Panel (lil_Toady) function getAllMaps ( loadList, s ) local tableOut if loadList then tableOut = { }; local gamemodes = { }; gamemodes = call ( getResourceFromName ( "mapmanager" ), "getGamemodes" ); for id, gamemode in ipairs ( gamemodes ) do tableOut [ id ] = { }; tableOut [ id ].name = getResourceInfo(gamemode,"name") or getResourceName(gamemode); tableOut [ id ].resname = getResourceName(gamemode); tableOut [ id ].maps = {}; local maps = call ( getResourceFromName ( "mapmanager" ), "getMapsCompatibleWithGamemode", gamemode ); for _, map in ipairs ( maps ) do table.insert ( tableOut [ id ][ "maps" ],{ name = getResourceInfo ( map, "name" ) or getResourceName ( map ),resname = getResourceName ( map ) } ); end table.sort ( tableOut [ id ][ "maps" ],sortCompareFunction ); end table.sort ( ( tableOut ), sortCompareFunction ); table.insert ( tableOut, { name = "no gamemode", resname = "no gamemode", maps = { } } ); local countGmodes = #tableOut; local maps = call ( getResourceFromName ( "mapmanager" ), "getMapsCompatibleWithGamemode" ); for id, map in ipairs ( maps ) do table.insert ( tableOut [ countGmodes ][ "maps" ],{ name = getResourceInfo ( map, "name" ) or getResourceName ( map ), resname = getResourceName (map ) } ); end table.sort ( tableOut [ countGmodes ][ "maps" ], sortCompareFunction ); end local map = call ( getResourceFromName ( "mapmanager" ), "getRunningGamemodeMap" ); local gamemode = call ( getResourceFromName ( "mapmanager" ), "getRunningGamemode" ); gamemode = gamemode and getResourceName ( gamemode ) or "N/A"; map = map and getResourceName ( map ) or "N/A"; triggerClientEvent ( "refreshCompleted", loadList, tableOut, gamemode, map, s ); end addEvent ( "doRefreshMapList", true ) addEventHandler ( "doRefreshMapList", root, getAllMaps ) function sortCompareFunction ( s1, s2 ) if type ( s1 ) == "table" and type ( s2 ) == "table" then s1, s2 = s1.name, s2.name; end s1, s2 = s1:lower ( ), s2:lower( ); if s1 == s2 then return false end local byte1, byte2 = string.byte ( s1:sub ( 1, 1 ) ), string.byte ( s2:sub ( 1, 1 ) ); if not byte1 then return true elseif not byte2 then return false elseif byte1 < byte2 then return true elseif byte1 == byte2 then return sortCompareFunction ( s1:sub ( 2 ), s2:sub ( 2 ) ); else return false end end function getAliveGuys() local alivePlayers = 0 for index,player in ipairs(getElementsByType("player")) do if getElementData(player,"state") == "alive" then alivePlayers = alivePlayers + 1 end end return alivePlayers end function getDeadGuys() local deadPlayers = 0 for index,player in ipairs(getElementsByType("player")) do if getElementData(player,"state") == "dead" then deadPlayers = deadPlayers + 1 end end return deadPlayers end function giveMoneyWinDie ( ) local account = getPlayerAccount ( source ); local playersAlive = getAliveGuys ( 1 ); local playersDead = getDeadGuys ( ); local checkYourPos = playersAlive + 1 local pos = nil; if not (checkYourPos <= 0) then if tonumber ( checkYourPos ) == 1 then pos = 1 else pos = checkYourPos; end if tonumber ( checkYourPos ) == 2 then pos = 2; end if pos == 1 or pos == 21 or pos == 31 then posName = "st"; elseif pos == 2 or pos == 22 or pos == 32 then posName = "nd"; elseif pos == 3 or pos == 23 or pos == 33 then posName = "rd"; else posName = "th"; end if not getElementData ( source, "gotMoney" ) then outputDebugString( "pos: " .. tostring(pos) ); local money = math.ceil ( getPlayerCount ( ) * 50 / pos ); outputDebugString( "money: " .. tostring(money) ); givePlayerMoney ( source, money ); outputChatBox ( "* You were #abcdef[#ff0000" .. pos .. posName .. "#abcdef]#ffffff and #abcdefearned #ffffff" .. money .. "#00ff00$!", source, 255, 255, 255, true ); setElementData ( source, "gotMoney", true ); if account then outputDebugString( "player money: " .. tostring(getPlayerMoney(source)) ); setAccountData ( account, "money", tostring ( getPlayerMoney ( source ) ) ); end end end end addEventHandler ( "onPlayerWasted", root , giveMoneyWinDie ) I'm sorry for not giving complete info, it's a shopmap panel, and I tried to modify it to avoid giving negative numbers, that is, when a player loses in the first place, he gives him $ 50, but instead of giving them the $ 50, he You remove them, and if you have 0, you end up with -50 $.
  6. I have a problem, this is a part of my resource that gives money to players based on their position, but instead of giving them money, it subtracts that amount, I don't know how to solve it. function giveMoneyWinDie ( ) local account = getPlayerAccount ( source ); local playersAlive = getAliveGuys ( 1 ); local playersDead = getDeadGuys ( ); local checkYourPos = playersAlive + 1 local pos = nil; if not (checkYourPos <= 0) then if tonumber ( checkYourPos ) == 1 then pos = 1 else pos = checkYourPos; end if tonumber ( checkYourPos ) == 2 then pos = 2; end if pos == 1 or pos == 21 or pos == 31 then posName = "st"; elseif pos == 2 or pos == 22 or pos == 32 then posName = "nd"; elseif pos == 3 or pos == 23 or pos == 33 then posName = "rd"; else posName = "th"; end if not getElementData ( source, "gotMoney" ) then local money = math.ceil ( getPlayerCount ( ) * 50 / pos ); givePlayerMoney ( source, money ); outputChatBox ( "* You were #abcdef[#ff0000" .. pos .. posName .. "#abcdef]#ffffff and #abcdefearned #ffffff" .. money .. "#00ff00$!", source, 255, 255, 255, true ); setElementData ( source, "gotMoney", true ); if account then setAccountData ( account, "money", tostring ( getPlayerMoney ( source ) ) ); end end end end addEventHandler ( "onPlayerWasted", root , giveMoneyWinDie )
  7. I want to see, if i can to create teams from admin panel, and those teams could be saved in SQL. My teams are deleted when my server is restarted.
  8. How to configure the admin panel so that the teams are not deleted when the server is restarted and save the teams in sql?
  9. I used to enter in that server in 2012-2013. But i don't know what happened, but the staff banned some countries including venezuela, and i remember in those years, watch a lot of players from latinamerica, that server used to have 30/40 players every day, but after banning some countries i think that server is a little bit dead. I enter for nostalgic because i remember some friends of my, like winter and mike. I like this sv and i enter every day.
  10. I want to know how to save teams, maybe in SQL, I am not an expert, I just want some help for a server that I am building, I have teams through a script but with teams related to the acl, but I want to know if there is a method to save The teams even though the server is restarted and create them from the admin panel perhaps, and also that the players are saved in the team.
×
×
  • Create New...