Fabioxps Posted April 2, 2013 Posted April 2, 2013 (edited) this is correct? addCommandHandler ( "rank", function(rankPlayersWasted) local rank = exports.race:getPlayerRank(rankPlayersWasted)+0 if (rank == 1) then outputChatBox("#ffffff1º "..getPlayerName(rankPlayersWasted).." Winner!",getRootElement(),0,0,0,true) elseif(rank == 2) then outputChatBox("#ffffff1º "..getPlayerName(rankPlayersWasted).." Second!",getRootElement(),0,0,0,true) elseif(rank == 3) then outputChatBox("#ffffff1º "..getPlayerName(rankPlayersWasted).." Third!",getRootElement(),0,0,0,true) end end) Edited April 2, 2013 by Guest
DNL291 Posted April 2, 2013 Posted April 2, 2013 Why ask if this is correct? If not working tell us what the problem is.
Fabioxps Posted April 2, 2013 Author Posted April 2, 2013 Why ask if this is correct? If not working tell us what the problem is. I want to appear the nick of the player who is in the rank and not on who types the command
Fabioxps Posted April 2, 2013 Author Posted April 2, 2013 if I type the command does not show the names of the players, but my
Fabioxps Posted April 2, 2013 Author Posted April 2, 2013 I want to know what were the three players who died in the end
Castillo Posted April 2, 2013 Posted April 2, 2013 addCommandHandler ( "rank", function ( ) for _, player in ipairs ( getElementsByType ( "player" ) ) do local rank = exports.race:getPlayerRank ( player ) if ( rank == 1 ) then outputChatBox ( "#ffffff1º ".. getPlayerName ( player ) .." Winner!", root, 0, 0, 0, true ) elseif ( rank == 2 ) then outputChatBox ( "#ffffff1º ".. getPlayerName ( player ) .." Second!", root, 0, 0, 0, true ) elseif ( rank == 3 ) then outputChatBox ( "#ffffff1º ".. getPlayerName ( player ) .." Third!", root, 0, 0, 0, true ) end end end )
Fabioxps Posted April 2, 2013 Author Posted April 2, 2013 I'm getting both players won addCommandHandler ( "rank", function (player) for _, player in ipairs ( getElementsByType ( "player" ) ) do local rank = exports.race:getPlayerRank ( player ) if ( rank == 1 ) then outputChatBox ( "#ffffff1º ".. getPlayerName ( player ) .." Winner!", root, 0, 0, 0, true ) elseif ( rank == 2 ) then outputChatBox ( "#ffffff2º ".. getPlayerName ( player ) .." Second!", root, 0, 0, 0, true ) elseif ( rank == 3 ) then outputChatBox ( "#ffffff3º ".. getPlayerName ( player ) .." Third!", root, 0, 0, 0, true ) end end end )
INVINCIBLE Posted April 2, 2013 Posted April 2, 2013 addCommandHandler ( "rank", function ( player ) local rank = getElementData(player,"race rank") if ( rank == 1 ) then outputChatBox ( "#ffffff1º ".. getPlayerName ( player ) .." Winner!", root, 0, 0, 0, true ) elseif ( rank == 2 ) then outputChatBox ( "#ffffff1º ".. getPlayerName ( player ) .." Second!", root, 0, 0, 0, true ) elseif ( rank == 3 ) then outputChatBox ( "#ffffff1º ".. getPlayerName ( player ) .." Third!", root, 0, 0, 0, true ) end end ) Try this
Fabioxps Posted April 3, 2013 Author Posted April 3, 2013 I want to see the three players who die in last place
Fabioxps Posted April 22, 2013 Author Posted April 22, 2013 getPlayerName(player) is wrong, someone help me please addCommandHandler ( "rank", function ( player ) local rank = getElementData(player,"race rank") if ( rank == 3 ) then outputChatBox ( "#ffffff3º "..getPlayerName(player).." Winner!", root, 0, 0, 0, true ) end end )
Jaysds1 Posted April 22, 2013 Posted April 22, 2013 try this: addCommandHandler ( "rank",function(source) --source is the player who entered the command for _,p in ipairs(getElementsByType("player"))do local rank = exports.race:getPlayerRank(p) local name = getPlayerName(p) if rank == 1 then outputChatBox("#ffffff1º "..name.." Winner!",root,0,0,0,true) elseif rank == 2 then outputChatBox("#ffffff1º "..name.." Second!",root,0,0,0,true) elseif rank == 3 then outputChatBox("#ffffff1º "..name.." Third!",root,0,0,0,true) end end end)
Fabioxps Posted April 22, 2013 Author Posted April 22, 2013 not working appears the name of all players winner
Jaysds1 Posted April 22, 2013 Posted April 22, 2013 try this: addCommandHandler ( "rank",function() for _,p in ipairs(getElementsByType("player"))do if exports.race:isPlayerFinished(p) then local rank = exports.race:getPlayerRank(p) local name = getPlayerName(p) if rank == 1 then outputChatBox("#ffffff1º "..name.." Winner!",root,0,0,0,true) elseif rank == 2 then outputChatBox("#ffffff1º "..name.." Second!",root,0,0,0,true) elseif rank == 3 then outputChatBox("#ffffff1º "..name.." Third!",root,0,0,0,true) end end end end) We needed to check if they're finished...
Fabioxps Posted April 23, 2013 Author Posted April 23, 2013 try this:addCommandHandler ( "rank",function() for _,p in ipairs(getElementsByType("player"))do if exports.race:isPlayerFinished(p) then local rank = exports.race:getPlayerRank(p) local name = getPlayerName(p) if rank == 1 then outputChatBox("#ffffff1º "..name.." Winner!",root,0,0,0,true) elseif rank == 2 then outputChatBox("#ffffff1º "..name.." Second!",root,0,0,0,true) elseif rank == 3 then outputChatBox("#ffffff1º "..name.." Third!",root,0,0,0,true) end end end end) We needed to check if they're finished... not working
Jaysds1 Posted April 23, 2013 Posted April 23, 2013 wait, so you're trying to see who's 1st , 2nd , and 3rd through command? When do you try this command?
Fabioxps Posted April 23, 2013 Author Posted April 23, 2013 wait, so you're trying to see who's 1st , 2nd , and 3rd through command?When do you try this command? all players appears in winner
Jaysds1 Posted April 23, 2013 Posted April 23, 2013 try this then: addCommandHandler ( "rank",function() for _,p in ipairs(getElementsByType("player"))do local finished = exports.race:isPlayerFinished(p) or getElementData(p,"race.finished") if finished then local rank = exports.race:getPlayerRank(p) or getElementData(p,"race rank") local name = getPlayerName(p) if rank == 1 then outputChatBox("#ffffff1º "..name.." Winner!",root,0,0,0,true) elseif rank == 2 then outputChatBox("#ffffff1º "..name.." Second!",root,0,0,0,true) elseif rank == 3 then outputChatBox("#ffffff1º "..name.." Third!",root,0,0,0,true) end end end end)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now