• Help getting alive players name
    4 replies, posted
Okay, so on my round system when there's just 1 player alive, it will run this. How do I make it so it prints: "RoopeFI has won the round!" if only im alive. Everything else is fine I just wanna know how do I get the name here ._. [lua] for k,v in pairs(player.GetAll()) do v:PrintMessage( HUD_PRINTTALK, /*NEED NAME HERE*\ " has won the round!") if v:Alive() then v:PrintMessage( HUD_PRINTTALK, "You have won the round!") end end [/lua]
[lua] for k, winner in pairs( player.GetAll() ) do if ( v:Alive() ) then for k2, v in pairs( player.GetAll() ) do if (v != winner) then v:ChatPrint(v:Name().." is the winner!") else v:ChatPrint("You are a winner!") end end end end [/lua]
This doesn't work.
[lua] for _, winner in pairs( player.GetAll() ) do if ( winner:Alive() ) then for _, v in pairs( player.GetAll() ) do if (v != winner) then v:ChatPrint(winner:Name().." is the winner!") else v:ChatPrint("You are a winner!") end end end end [/lua]
Working great, thanks!
Sorry, you need to Log In to post a reply to this thread.