Jump to content

P[ow]er

Members
  • Posts

    28
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by P[ow]er

  1. hello everybody i have problem with bet systeme, when anybody playing bet on any player and if this player win bet , system doesn't give the money to the player... where is the problem ? function createNewBet(thePlayer,toPlayer,newAmount,oldAmount,betState) local account = getPlayerAccount(thePlayer) if not (isGuestAccount(account)) then if getPlayerCount() >= minPlayers then if bettingEnabled == true then if (betState == 0) then if (toPlayer) then if (newAmount) then local newAmount = tonumber(math.ceil(tonumber(newAmount))) if (newAmount >= 1) then local playerCash = tonumber(getAccountData(account,"cash")) local maxBet = 10000 if (findPlayerByName(toPlayer)) then local toPlayerName = findPlayerByName(toPlayer) if (newAmount <= playerCash) then if newAmount <= maxBet then callClientFunction(thePlayer,"addNewBet",toPlayerName,newAmount) setAccountData(account,"cash",playerCash-newAmount) scoreboardRefresh(thePlayer) totalBetsAdd(thePlayer) --outputChatBox("#00FF00* #FFFFFFYou have placed your bet on "..getPlayerName(toPlayerName).."#FFFFFF for #ABCDEF$"..newAmount.."#FFFFFF!",thePlayer,255,255,255,true) outputChatBox(""..colorCode.."[bET] #FFFFFF"..getPlayerName(thePlayer).."#FFFFFF has placed a bet on "..getPlayerName(toPlayerName).."#FFFFFF for #ABCDEF$"..newAmount.."#FFFFFF!",getRootElement(),255,255,255,true) elseif newAmount > maxBet then outputChatBox(""..colorCode.."[bET] #FFFFFFYou are allowed to bet a maximum of #ABCDEF$"..maxBet.."#FFFFFF!",thePlayer,255,255,255,true) return false end else outputChatBox(""..colorCode.."[bET] #FFFFFFERROR! You don't have enough money!",thePlayer,255,255,255,true) end else outputChatBox(""..colorCode.."[bET] #FFFFFFERROR! The player you specified has not been found! (#FFFF00"..toPlayer.."#FFFFFF)",thePlayer,255,255,255,true) return false end else outputChatBox(""..colorCode.."[bET] #FFFFFFERROR! Invalid amount! [#ABCDEF$"..newAmount.."#FFFFFF]",thePlayer,255,255,255,true) end else outputChatBox(""..colorCode.."[bET] #FFFFFFERROR! Please specify an amount to bet! Correct syntax: #ABCDEF/bet [player] [amount]",thePlayer,255,255,255,true) return false end else outputChatBox(""..colorCode.."[bET] #FFFFFFERROR! Please specify a player! Correct syntax: #ABCDEF/bet [player] [amount]",thePlayer,255,255,255,true) return false end else outputChatBox(""..colorCode.."[bET] #FFFFFFYou have already placed your bet on "..betState.." #FFFFFFfor #ABCDEF$"..oldAmount.."#FFFFFF!",thePlayer,255,255,255,true) return false end else outputChatBox(""..colorCode.."[bET] #FFFFFFBetting time is over! You can place your bet on the next map.",thePlayer,255,255,255,true) end else outputChatBox(""..colorCode.."[bET] #FFFFFFBetting #dd1111disabled.#FFFFFF Minimum required players on server: #ABCDEF" ..minPlayers..""..colorCode.." | #FFFFFFConnected: #ABCDEF"..getPlayerCount(),thePlayer,255,255,255,true) end else outputChatBox(""..colorCode.."[bET] #FFFFFFYou have to be logged to bet!",thePlayer,255,255,255,true) end end function onPlayerBetWin(self,betAmount) local thePlayer = self local account = getPlayerAccount(thePlayer) if not (isGuestAccount(account)) then outputChatBox(""..colorCode.."[bET] #FFFFFF"..getPlayerName(self).."#FFFFFF has won his bet and has recieved #ABCDEF$".. betAmount*2 .."#FFFFFF!",getRootElement(),255,255,255,true) local playerCash = getAccountData(account,"cash") setAccountData(account,"cash",playerCash+betAmount+betAmount*2) totalBetsWonAdd(thePlayer) scoreboardRefresh(thePlayer) end end
×
×
  • Create New...