Hey, I am wondering how do you give a player an entity from clicking a button from a derma menu, like a hat entitie and when they click it it goes on their head? A thanks in advance!
Well, you would have the button in the menu call a console command on the server that adds the hat. Before doing so, you would of course check if the player has enough money and all that [b]serverside[/b].
So, something like this:
[lua]Clientside:
function showMenu()
...
button.DoClick = function()
RunConsoleCommand( "buyhat", "hat3" )
end
...
end
Serverside:
concommand.Add( "buyhat", function( ply, _, args )
local hat = args[1]
if ( hat and hatsThatAreBuyable[hat] and ply:GetMoney() > hatPrices[hat] ) then
addHat( ply )
end
end )[/lua]
end )
Thanks for the help!
Sorry, you need to Log In to post a reply to this thread.