[code]
-- Prevents the use of this character permanently or for a certain amount of time.
function CHAR:ban(time)
time = tonumber(time)
if (time) then
-- If time is provided, adjust it so it becomes the un-ban time.
time = os.time() + math.max(math.ceil(time), 60)
end
-- Mark the character as banned and kick the character back to menu.
self:setData("banned", time or true)
self:kick()
end
[/code]
That's the piece of code we'll be working with today. My goals are simple "-- Prevents the use of this character permanently or for a certain amount of time." I want that to change to "-- Prevents the use of this character for one hour."...
IDEAS:
Set (time) to (60) and remove "or true" from "self:setData("banned", time or true)". But I'm sure that won't completely sum this up.
NOTES:
I want the command "/charban" to only have one function, once called it bans that character for 60 minutes and kicks him to the menu.
As the old command would be: /charban (ply) 60 ...
New commands would be: /charban (ply)
:snip: I read this whole thing wrong
[editline]25th May 2016[/editline]
I'm pretty sure all you need to do is this:
[CODE]
function CHAR:ban()
self:setData("banned", os.time() + 60)
self:kick()
end
[/CODE]
If that doesn't work, at least try out the idea you had before yourself
[editline]25th May 2016[/editline]
By the way, this thread is meant to be one where people try and get help with different code that they have, but in your previous post I get the sense that you want us to do it all for you, which isn't the point of this thread.
The only reason I posted the thing before was just because I see it as a very simple solution, but I don't know if that would work. Experiment for yourself to see what does and doesn't work
I do not want you guys to do it all for me, I want to learn. I want you guys to teach me, I don't know where to learn, because the [URL="http://wiki.garrysmod.com/page/Main_Page"]Wiki[/URL] is complete shit. I don't understand what it's saying most of the time, it makes no sense.
edit:
Also, that code doesn't work. It doesn't give errors but it doesn't work the way I want. I tried what I said, but that didn't work either. Also, is there an easier way to test these sorts of things without resetting the server every damn time?
[QUOTE=Jasper Morgue;50390546]I do not want you guys to do it all for me, I want to learn. I want you guys to teach me, I don't know where to learn, because the [URL="http://wiki.garrysmod.com/page/Main_Page"]Wiki[/URL] is complete shit. I don't understand what it's say most of the time, it makes no sense.
edit:
Also, that code doesn't work. It doesn't give errors but it doesn't work the way I want. I tried what I said, but that didn't work either. Also, is there an easier way to test these sorts of things without resetting the server every damn time?[/QUOTE]
Is autorefresh not working for you?
[QUOTE=Jasper Morgue;50390546]I do not want you guys to do it all for me, I want to learn. I want you guys to teach me, I don't know where to learn, because the [URL="http://wiki.garrysmod.com/page/Main_Page"]Wiki[/URL] is complete shit. I don't understand what it's say most of the time, it makes no sense.
edit:
Also, that code doesn't work. It doesn't give errors but it doesn't work the way I want. I tried what I said, but that didn't work either. Also, is there an easier way to test these sorts of things without resetting the server every damn time?[/QUOTE]
Do you have cake anticheat installed?
The wiki is not complete shit, all you need to do is read it and try out the code examples to see what they do. You're asking not to be spoon fed and then posting a bunch of ideas and expecting code. You won't learn with that shitty attitude
[QUOTE=Coffeee;50391596]The wiki is not complete shit, all you need to do is read it and try out the code examples to see what they do. You're asking not to be spoon fed and then posting a bunch of ideas and expecting code. You won't learn with that shitty attitude[/QUOTE]
You're entitled to your opinion and I am entitled to mine. I do not have a bad attitude and I do not tolerate those people who make 'hateful' or 'unhelpful' comments on a help post. -ignored.
[QUOTE=danker pepers;50390890]Do you have cake anticheat installed?[/QUOTE]
No, never heard of it till I googled it after reading this post. I don't see how this would help in this situation though?
[QUOTE=Elec;50390608]Is autorefresh not working for you?[/QUOTE]
I disabled Lua Autorefresh with my host, I restart the system everytime on my own.
But I guess I can create a private server (not my dedi), and do some trials and error on it by enabling Lua Autorefresh? (anything else I can do, I seem to remember an online code checker or something of the sort?)
[QUOTE=Jasper Morgue;50390546]I don't understand what it's say most of the time, it makes no sense.[/QUOTE]
Post an example of a page that doesn't make sense and I'll try deciphering it for you
There are a couple of pages that I think are like this, but the majority of them are usable
[url]https://wiki.garrysmod.com/page/SANDBOX/PlayerSpawnProp[/url]
It just never explains where to put this type of information... :/
[QUOTE=Jasper Morgue;50467539][url]https://wiki.garrysmod.com/page/SANDBOX/PlayerSpawnProp[/url]
It just never explains where to put this type of information... :/[/QUOTE]
Yes, it does. Look at the little icon next to it in the search menu, it'll either be blue, orange, blue and orange or green.
Orange is clientside
Blue is serverside
Orange & blue is shared
Green is menu
Okay, I did not notice that thanks for that.
But would it go in a hooks file, or does this just mean it's called in sv_(filename).lua, somewhere in the gamemode folder?
I also know about cl_init(client), init(server), shared(both) inside the gamemode folder, if that's where they go.
&& What is menu?
[QUOTE=Jasper Morgue;50485902]Okay, I did not notice that thanks for that.
But would it go in a hooks file, or does this just mean it's called in sv_(filename).lua, somewhere in the gamemode folder?
I also know about cl_init(client), init(server), shared(both) inside the gamemode folder, if that's where they go.
&& What is menu?[/QUOTE]
[quote]The Menu state is a hidden and isolated state for the Main Menu. It has some vital functions available to make Main Menu functional and cannot communicate with Client or Server states. Any Lua ran in this state will run regardless of sv_allowcslua.[/quote]
[url]http://wiki.garrysmod.com/page/States[/url]
Awesome thanks for that guys!
Sorry, you need to Log In to post a reply to this thread.