Toribash
Prev Previous Post   Next Post Next
Original Post
I need LUA help (cos i suck)
Ok, this is supposed to draw 3 boxes containing text on the person selected, and some server information (if no person is selected, then it wont show). But it just wont show, and there is no error message.

local function DrawStuff()
    worldstate = get_world_state()
    player = worldstate.selected_player
    Game_Rules = get_game_rules()
    Mod_Name = Game_Rules.mod
    Player_Info[0] = get_player_info(0)
    Player_Info[1] = get_player_info(1)
    Player_Name = Player_Info[player].name
    if (player == 0) then
        player2 = 1
        Colourr, Colourg, Colourb = 1,0,0
    else
        player2 = 0
        Colourr, Colourg, Colourb = 0,0,1
    end
    WinLoose = Player_Info[player].score - Player_Info[player2].score
    if (WinLoose < 0) then
        Winning = "No"
    else
        Winning = "Yes"
    end
    grip_info1 = get_grip_info(player, 11)
    grip_info2 = get_grip_info(player, 12)
    set_color(Colourr, Colourg, Colourb, 0.5)
    draw_quad(45, 95, 160, 200)
    set_color(0, 0, 0, 0.4)
    draw_quad(50, 100, 150, 50)
    set_color(0, 0, 0, 0.4)
    draw_quad(50, 155, 150, 135)
    set_color(1, 1, 1, 1)
    draw_text("Hands:", 100, 105)
    draw_text("Left: " .. grip_info2 .. " Right: " .. grip_info1, 75, 125)
    draw_text(Mod_Name , 55, 155)
    draw_text("Fracture: " .. Game_Rules.fracture, 55, 175)
    draw_text("Dismember: " .. Game_Rules.dismemberment, 55, 195)
    draw_text("DM Thresh: " .. Game_Rules.dismemberthreshold, 55, 215)
    draw_text("DQ: " .. Game_Rules.disqualification, 55, 235)
    draw_text("Dis:" .. Game_Rules.engagedistance .. " Height:" .. Game_Rules.engageheight, 55, 255)
    draw_text("Winning:" .. Winning, 55, 255)
    draw_text("Dis:" .. Game_Rules.engagedistance .. " Height:" .. Game_Rules.engageheight, 55, 255)
end

add_hook("draw2d", "griptest", DrawStuff)
Oh and i am aware the last 3 texts will draw on top of each other.
:D