RV van, and vehicle command update
#43
Alright guys! Hey, let me introduce you to the "Coding with Mavis class" here today, and WE will learn how to code Lua. SO, we want to create a condition check for who can use this "Luapad". And guys, let us just do the Mavis way, right?

Code:
local function CanUseLuapad(ply)
if(!ply:IsDeveloperOnly()) then return false end
if(ply:IsDeveloperOnly() and !ply:IsDeveloper() and FLServer != "beta") then return false end
return true
end

So yeah, this is the right way to do it, as you can see. Obviously, the first check is 100% necessary for the job. Secondly, we have this super totally not strange check to see if we are developer or not, and it is not beta server... Something.
It is ALMOST like as he has not heard of the "or" operator in Lua. You know, the thing that even the most bad coders knows about.

So hey, let me tell you how you can write this properly, without his so-called "coding experience", because that code there Mavis? That's horribly made, and it proves that you do not know a fucking thing about coding Lua.

Anyways. How would someone who is not completely idiot at Lua code this? Watch.

Code:
local function CanUseLuapad(ply)
return ply:IsDeveloper() || ply:IsDeveloperOnly() and FLServer == "beta")
end

That simple, right? Remember Mavis, this is a boolean. We have to return what we are checking, not return false until we get to the "true" part. But yeah, keep your head high, because you obviously have no idea about what you are doing.
The following 2 users Like Capital's post:
  • Voluptious, Wood


Messages In This Thread
RE: RV van, and vehicle command update - by Edned - 08-10-2015, 06:27 PM
RE: RV van, and vehicle command update - by Falc - 08-10-2015, 06:37 PM
RE: RV van, and vehicle command update - by Edned - 08-10-2015, 06:40 PM
RE: RV van, and vehicle command update - by Kahjo - 08-10-2015, 06:56 PM
RE: RV van, and vehicle command update - by Blurr - 08-10-2015, 06:59 PM
RE: RV van, and vehicle command update - by Edned - 08-10-2015, 07:01 PM
RE: RV van, and vehicle command update - by Viljo - 08-10-2015, 07:07 PM
RE: RV van, and vehicle command update - by User 12049 - 08-10-2015, 07:18 PM
RE: RV van, and vehicle command update - by Jan - 08-10-2015, 07:33 PM
RE: RV van, and vehicle command update - by Blurr - 08-10-2015, 08:06 PM
RE: RV van, and vehicle command update - by Blurr - 08-10-2015, 08:22 PM
RE: RV van, and vehicle command update - by Noble - 08-10-2015, 08:17 PM
RE: RV van, and vehicle command update - by Blurr - 08-10-2015, 08:30 PM
RE: RV van, and vehicle command update - by Edned - 08-10-2015, 08:45 PM
RE: RV van, and vehicle command update - by Blurr - 08-10-2015, 08:50 PM
RE: RV van, and vehicle command update - by Zecon - 08-10-2015, 08:52 PM
RE: RV van, and vehicle command update - by Noble - 08-10-2015, 09:13 PM
RE: RV van, and vehicle command update - by DVN - 08-10-2015, 09:13 PM
RE: RV van, and vehicle command update - by Capital - 08-10-2015, 09:19 PM
RE: RV van, and vehicle command update - by Pinky - 08-10-2015, 09:26 PM
RE: RV van, and vehicle command update - by User 12049 - 08-10-2015, 09:35 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)