I'm getting some wird errors from Lua:
[CODE] [ERROR] gamemodes/learning/gamemode/extensions/sh_administrative.lua:5: 'then' expected near 'if'
1. unknown - gamemodes/learning/gamemode/extensions/sh_administrative.lua:0[/CODE]
Code in these lines:
[CODE]Line 5: if(ply:IsUserGroup("VIP")) then[/CODE]
Full function:
[CODE]function CheckRank(ply, rank)
if(rank == "VIP")
if(ply:IsUserGroup("VIP")) then
return true
elseif(ply:IsUserGroup("Moderator")) then
return true
elseif(ply:IsUserGroup("Administrator")) then
return true
elseif(ply:IsUserGroup("Superadmin")) then
return true
elseif(ply:IsUserGroup("Owner")) then
return true
else
return false
end
elseif(rank == "Moderator")
if(ply:IsUserGroup("Moderator")) then
return true
elseif(ply:IsUserGroup("Administrator")) then
return true
elseif(ply:IsUserGroup("Superadmin")) then
return true
elseif(ply:IsUserGroup("Owner")) then
return true
else
return false
end
elseif(rank == "Administrator")
if(ply:IsUserGroup("Administrator")) then
return true
elseif(ply:IsUserGroup("Superadmin")) then
return true
elseif(ply:IsUserGroup("Owner")) then
return true
else
return false
end
elseif(rank == "Superadmin")
if(ply:IsUserGroup("Superadmin")) then
return true
elseif(ply:IsUserGroup("Owner")) then
return true
else
return false
end
elseif(rank == "Owner")
if(ply:IsUserGroup("Owner")) then
return true
else
return false
end
else
return false
error("[Administrative]Function CheckRank: Invalid Arguments")
end
end[/CODE]
Line 4 change
[code]if(rank == "VIP")[/code]
to
[code] if(rank == "VIP") then[/code]
You're missing a lot of "then"s in your code.
My eyes.
Please use tables for such stuff.
[QUOTE=Netheous;49985438]My eyes.
Please use tables for such stuff.[/QUOTE]
No thank you :3
I love coding long shit :3
[QUOTE=GodGuardian;49985461]No thank you :3
I love coding long shit :3[/QUOTE]
But it's inefficient and looks awful :3
Also, you return before you get to the "error" function, meaning it will never run.
Right out bright with more shitty errors.
[CODE][ERROR] gamemodes/learning/gamemode/extensions/sh_administrative.lua:153: function arguments expected near ','
1. unknown - gamemodes/learning/gamemode/extensions/sh_administrative.lua:0
[/CODE]
Line 153:
[CODE] if( string.Find(v:Nick, pname) ) then
[/CODE]
v:Nick()
It's no wonder your code is full of errors, you do it in the most inefficient way possible.
...
I need help not judges.
[QUOTE=GodGuardian;49985537]...
I need help not judges.[/QUOTE]
then ask your mommy
Stop leaking shitty "custom stuff" from scriptfodder, that'll help.
Why don't you kill yourself while you're at it.
Suck garry's dick, he'll fix all your Lua problems for you.
[editline]22nd March 2016[/editline]
Oh and your mother is a whore.
No one?
you got an answer literally 30 seconds after posting the error
[lua]
rankstuffs = {
"VIP" = {"VIP", "Moderator", "Administrator", "Superadmin", "Owner"},
"Moderator" = {"Moderator", "Administrator", "Superadmin", "Owner"},
"Administrator" = {"Administrator", "Superadmin", "Owner"},
"Superadmin" = {"Superadmin", "Owner"},
"Owner" = {"Owner"}
}
function CheckRank(ply, rank)
if (table.HasValue(rankstuffs[rank], ply:GetUserGroup() )) then
return true
end
end
[/lua]
just so i dont have to stare at that nightmare
Edit
forgot the delimiters on the rankstuffs table
Sorry, you need to Log In to post a reply to this thread.