Draw a square where a player executed a command

Hello, I have this code in lua/server (3 is the taxi team)

concommand.Add( "callTaxi", function( ply, cmd, args ) -- Creates a console command

    if ply:Team() == 3 then -- Tests if the player is in the team
        ply:PrintMessage( HUD_PRINTTALK, "You can't call a taxi while being a taxi." )
    elseif ply:Team() != 3 then
        if team.NumPlayers( 3 ) != 0 then -- If there is players in the team
            taxiTeam = team.GetPlayers( 3 ) -- Gets all the players in the team
            taxiTeamPlayer = table.Random( taxiTeam ) -- Choose a random player from the team
            taxiTeamPlayer:PrintMessage( HUD_PRINTTALK, "A player need you." )
            -- Draw a square where the player who executed the command is --
        elseif team.NumPlayers( 3 ) == 0 then
            ply:PrintMessage( HUD_PRINTTALK, "No taxi in the city." )

end )

And I want to draw a square where the player executed the command “callTaxi” and removes it when the “taxiTeamPlayer” as came close to the destination. (Kind of GPS)
I know I can use

render.DrawQuadEasy but I don’t know how to do what I want.

-Snip- misread

You’ve got various options here.
You can either use the 3D option and follow the example of the wiki on render.DrawQuadEasy or use the 2D option, getting a vectors 2D position on the screen with

Vector:ToScreen and drawing it with the draw library and via


If you want to continue by any of the two, you should set some sort of local variable clientside and use
the net library to send to the client the Player that he requires to go to and maybe even any other params you want to pass, and also a Think hook that checks the distance of the LocalPlayer with the other player and when there is less than a certain distance, stop the thing from appearing to that player locally.

[editline]4th October 2017[/editline]

That is a 3D rendering hook. HUDPaint is a 2D rendering hook. That answer is just out of context.

I’ve done this (in lua/client) :

playerPos = LocalPlayer():GetPos()
hook.Add( "PostDrawTranslucentRenderables", "mapPoint", function()
    render.DrawQuadEasy( Vector( playerPos ), Vector( playerPos ), 64, 64, Color( 255, 255, 255, 200 ), 0)
end )

But it follows the player and rotate when the player is moving, and it has a strange texture that change. (That is really strange, I can’t describe it)

Wow that seems hard, I don’t understand.

Store the var outside the hook.

I changed my code to use

cam.Start3D with the given exemple because this is easier and this do not glitch like the


hook.Add( "HUDPaint", "drawPlayer", function()
end )

But how can I execute it when the player executed a command (or from the server, but I don’t understand how to use

net library) ? I’ve tried this :

function drawPlayer( ply )
concommand.Add( "drawAPlayer", drawPlayer)

But it doesn’t work. And how can I undraw the model (is it even possible) ?

It has to be isnide a hook, you can’t just do it once. It has to be done for every frame.

Probably because you didn’t add any specific texture before RenderQuadEasy.

Try using render.SetTexture() directly before and it should work fine…