Fabioxps Posted April 2, 2013 Share 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 Link to comment
Fabioxps Posted April 2, 2013 Author Share Posted April 2, 2013 can someone help me please? Link to comment
DNL291 Posted April 2, 2013 Share Posted April 2, 2013 Why ask if this is correct? If not working tell us what the problem is. Link to comment
Fabioxps Posted April 2, 2013 Author Share 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 Link to comment
Fabioxps Posted April 2, 2013 Author Share Posted April 2, 2013 if I type the command does not show the names of the players, but my Link to comment
Fabioxps Posted April 2, 2013 Author Share Posted April 2, 2013 when I type the command appears my name Link to comment
Castillo Posted April 2, 2013 Share Posted April 2, 2013 You want to get all the online player ranks? Link to comment
Fabioxps Posted April 2, 2013 Author Share Posted April 2, 2013 I want to know what were the three players who died in the end Link to comment
Castillo Posted April 2, 2013 Share 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 ) Link to comment
Fabioxps Posted April 2, 2013 Author Share 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 ) Link to comment
INVINCIBLE Posted April 2, 2013 Share 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 Link to comment
Fabioxps Posted April 3, 2013 Author Share Posted April 3, 2013 I want to see the three players who die in last place Link to comment
Fabioxps Posted April 22, 2013 Author Share 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 ) Link to comment
Jaysds1 Posted April 22, 2013 Share 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) Link to comment
Fabioxps Posted April 22, 2013 Author Share Posted April 22, 2013 not working appears the name of all players winner Link to comment
Jaysds1 Posted April 22, 2013 Share 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... Link to comment
Fabioxps Posted April 23, 2013 Author Share 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 Link to comment
Jaysds1 Posted April 23, 2013 Share 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? Link to comment
Fabioxps Posted April 23, 2013 Author Share 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 Link to comment
Jaysds1 Posted April 23, 2013 Share 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) Link to comment
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