If by that you mean indent it properly... For some reason the [ code ] tag gets rid of my indentation. It still looks right in the preview though
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts MenuQuote from: KAKAN on Apr 15, 2017, 11:24 AMum, you forgot this?
function payoutPlayers(){
local topArray = [];
foreach(scoreinfo in playerScores){
if(scoreinfo){
topArray.push({player = scoreinfo.player, score = scoreinfo.score});
}
}
topArray.sort(sortScores);
local _payout = currentMinigame.payout;
foreach(pos, scoreinfo in topArray){
if(scoreinfo.player){
local realpos = GetNth(pos + 1);
scoreinfo.player.Cash += _payout;
BigMessage(scoreinfo.player, "You came " + realpos + " in " + currentMinigame.name, 5000, 3);
_payout = abs(_payout * 0.8);
}
}
}
Quote from: EK.IceFlake on Apr 15, 2017, 04:05 AMA much more solid workaround would be to keep an array of every online player with their instance
Quote from: kennedyarz on Apr 15, 2017, 12:26 AMHi, I do not know anything about LU, but you could not deal with those capital letters?
Quote from: KAKAN on Apr 15, 2017, 09:17 AMLU works with that. See the first code. That's the thing.
NewTimer("delayedCash", realpos * 100, 1, _player, _payout);
function delayedCash(player, cash){
player.Cash += cash;
}
function payoutPlayers(){
local topArray = [];
foreach(id, score in playerScores){
if(score > 0){
topArray.push({id = id, score = score});
}
}
topArray.sort(sortScores);
local _payout = currentMinigame.payout;
foreach(pos, scoreinfo in topArray){
local _player = FindPlayer(scoreinfo.id);
if(typeof(_player) != "Player") _player = FindPlayer( scoreinfo.id );
if(_player && typeof(_player) == "Player"){
local realpos = pos + 1;
//_player.Cash += _payout; //Why does this not work!!!!??!?!?
//Delay the payout, this does seem to work
NewTimer("delayedCash", realpos * 100, 1, _player, _payout);
BigMessage(_player, "You came " + realpos + " in the " + currentMinigame.name, 5000, 3);
_payout = abs(_payout * 0.8);
}else{
print("Error retrieving player for payout");
}
}
}
function delayedCash(player, cash){
player.Cash += cash;
}
function payoutPlayers(){
local topArray = [];
foreach(id, score in playerScores){
if(score > 0){
topArray.push({id = id, score = score});
}
}
topArray.sort(sortScores);
local _payout = currentMinigame.payout;
foreach(pos, scoreinfo in topArray){
local _player = FindPlayer(scoreinfo.id);
if(_player){
local realpos = pos + 1;
//_player.Cash += _payout;
BigMessage(_player, "You came " + realpos + " in the " + currentMinigame.name, 5000, 3);
_payout = abs(_payout * 0.8);
}
_player = null;
}
}
SCRIPT: before if(_player): Theremin
SCRIPT: before _player.Cash: Theremin
SCRIPT: Cash: 18005 _player: Theremin(Player)pos: 1 payout: 15000(integer)
SCRIPT: before BigMessage: Theremin
SCRIPT: Cash: 18005 _player: Theremin(Player)pos: 1 payout: 15000(integer)
SCRIPT: before if(_player): Rhytz
SCRIPT: before _player.Cash: Rhytz
SCRIPT: Cash: 4054 _player: Rhytz(Player)pos: 2 payout: 12000(integer)
SCRIPT: before BigMessage: Rhytz
SCRIPT: Cash: 4054 _player: Rhytz(Player)pos: 2 payout: 12000(integer)
SCRIPT: [lu-minigames] Minigame ended
SCRIPT: before if(_player): Theremin
SCRIPT: before _player.Cash: Theremin
SCRIPT: Cash: 18005 _player: Theremin(Player)pos: 1 payout: 15000(integer)
SCRIPT: before BigMessage: Theremin
SCRIPT: Cash: 33005 _player: Theremin(Player)pos: 1 payout: 15000(integer)
SCRIPT: before if(_player): 1
SCRIPT: before _player.Cash: 1
AN ERROR HAS OCCURED [the index 'Cash' does not exist]
CALLSTACK
*FUNCTION [payoutPlayers()] Scripts/lu-minigames/main_s.nut line [164]
*FUNCTION [stopMinigame()] Scripts/lu-minigames/main_s.nut line [141]
LOCALS
[playerScores] ARRAY
[currentMinigame] TABLE
[realpos] 2
[_player] 1
[@ITERATOR@] 2
[scoreinfo] TABLE
[pos] 1
[_payout] 12000
[topArray] ARRAY
[this] TABLE
[minigameState] "ended"
[eligiblePlayers] TABLE
[currentMinigame] TABLE
[this] TABLE