Jump to content

Bkrickl

Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by Bkrickl

  1. Sory here is the full code! function getAliveGuys ( mode ) if not mode then return end if mode == 1 then pAlive = { }; for _, player in ipairs ( getElementsByType ( "player" ) ) do if ( getElementData ( player, "state" ) == "alive" ) then table.insert ( pAlive, player ); end end return pAlive; elseif mode == 2 then return #pAlive; elseif mode == 3 then if pAlive then pAlive = nil; end return false end end function getDeadGuys ( ) local pDead = 0 for _, player in ipairs ( getElementsByType ( "player" ) ) do if getElementData ( player, "state" ) == "dead" then pDead = pDead + 1; end end return pDead; end function giveMoneyWinDie ( ) local account = getPlayerAccount ( source ); local playersAlive = getAliveGuys ( 2 ); local playersDead = getDeadGuys ( ); local pAll = playersAlive + playersDead; local checkYourPos = pAll - playersDead; local pos = nil; if tonumber ( checkYourPos ) == 1 then pos = 1 else pos = checkYourPos + 1; 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 mother = getPlayerCount ( ) if mother == 1 then outputChatBox ( "* There are #abcdef2#FFFFFF or more players #abcdefneeded #FFFFFFto earn money!",source, 255, 255, 255, true ); else 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 ); local hi = getPlayerName(source) outputChatBox ( "* "..hi.."#ffffff was #abcdef[#ff0000" .. pos .. posName .. "#abcdef]",g_Root, 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 )
  2. function giveMoneyWinDie ( ) local account = getPlayerAccount ( source ); local playersAlive = getAliveGuys ( 2 ); local playersDead = getDeadGuys ( ); local pAll = playersAlive + playersDead; local checkYourPos = pAll - playersDead; local pos = nil; if tonumber ( checkYourPos ) == 1 then pos = 1 else pos = checkYourPos + 1; 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 mother = getPlayerCount ( ) if mother == 1 then outputChatBox ( "* There are #abcdef2#FFFFFF or more players #abcdefneeded #FFFFFFto earn money!",source, 255, 255, 255, true ); else 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 ); local hi = getPlayerName(source) outputChatBox ( "* "..hi.."#ffffff was #abcdef[#ff0000" .. pos .. posName .. "#abcdef]",g_Root, 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 ) I tried this for everybody get money when he waste in Dm Racing. 3rd get 50 2nd get xxx and so but it doesnt work like it should sometimes everybody ist 1st or everybody ist 4th or s.th. like this Kann anyboday help me please
×
×
  • Create New...