gmod time to use chat commands again

i maked this code and worked



function ADS(ply, text)
	if text == '!freepy' then
	ply:SendLua([[gui.OpenURL("https://www.google.com.br")]])
	ply:ChatPrint("Permaneça 15 segundos com a página aberta")
	timer.Simple( 10, function() 
		ply:PS_GivePoints(50)
		ply:ChatPrint("Você ganhou 50 Pontos")
		end )
	end
end
hook.Add( "PlayerSay", "Chat", ADS )


but players so abuse this command, I’d just like to know how I can do it so they have to wait 5 minutes to use the command again
type
“you need wait 5 minutes to use the command again”

please refer to the Wiki to learn the required functions.

Useful resource to achieve the effect you desire

[editline]5th February 2017[/editline]

Hint: You can create a timer with the users steamid and check it when the timer is created

thanks

We’ll be happy to help if you get stuck

https://gyazo.com/2f8165f27405182e7dc0b932e1eb4922 <— when he made his account

https://gyazo.com/6de3296f7bb362c1e2f253aed967db1f <---- his posts in the last few days

Can someone just give him the working code because he is legit just going to keep making spam posts in the dev section asking the same question and taking credit for someone else’s code.

This should work.

Serverside



util.AddNetworkString( 'freepointscheck' )
util.AddNetworkString( 'freepointsboi' )

net.Receive( 'freepointsboi', function( len, ply )
	local pointsokay = net.ReadBool()
	if pointsokay == false then
		ply:SendLua([[gui.OpenURL("https://www.google.com.br")]])
		ply:ChatPrint("wait for 15 seconds you'll get your points")
		timer.Simple( 10, function()
			ply:PS_GivePoints(50)
			ply:SendLua([[timer.Create('nofreepoints', 1, 300, function() end)]])
			ply:ChatPrint('You got 50 points')
		end)
	else
	local timeleft = string.NiceTime( net.ReadString() )
		ply:ChatPrint('You have to wait for', timeleft )
	end
end)

function ADS(ply, text)
	if text == '!freepy' then
		net.Start('freepointscheck')
	end
end
hook.Add( 'PlayerSay', 'Chat', ADS )


Clientside



net.Receive('freepointscheck', function( len, ply )
	net.Start('nofreepoints')
	if timer.Exists('nofreepoints') then
		local timeleft = timer.TimeLeft('nofreepoints')
		net.WriteBool( true )
		net.WriteString( timeleft )
	else
		net.WriteBool( false )
	end
	net.SendToServer()
end)


If anyone sees an error correct me.

Secure your networking!!!

http://forum.facepunch.com/showthread.php?t=1551495

And yeah if you don’t fix your networking you’ll run into a lot of problems.

also -

happy bday huehue

teach me how :slight_smile: