Erreur lua > unexpected symbol near 'if'

  • Initiateur de la discussion
Seefox

Seefox

Inconnu au bataillon
Messages
472
Score réaction
63
Points
150
Bonjour, j'aimerais savoir qu'est-ce qu'i cloche dans ce code :

Code:
function Casier.Warn:OpenMenu() local tblBtns = { [1] = {Name = "3ème Personne", Color = Color( 10, 130, 255, 255 ), Func = function() LocalPlayer():ConCommand( "simple_thirdperson_enable_toggle" ) end }, [2] = {Name = "Poser votre argent à terre", Color = Color( 10, 130, 255, 255 ), Func = function() DropMoney() end }, [3] = {Name = "Poser votre arme à terre", Color = Color( 10, 130, 255, 255 ), Func = function() RunConsoleCommand( "say", "/drop" ) end }, [4] = {Name = "Appeller un admin", Color = Color( 10, 130, 255 ), Func = function() CallAdmin() end }, [5] = {Name = "VIP", Color = Color( 255, 200, 0, 255 ), Func = function() RunConsoleCommand( "say", "!donation" ) end }, [6] = {Name = "Workshop", Color = Color( 20, 150, 20 ), Func = function() RunConsoleCommand( "say", "!addon" ) end }, [7] = {Name = "StopSound", Color = Color( 20, 150, 20 ), Func = function() LocalPlayer():ConCommand( "stopsound" ) end }, [8] = {Name = "Quitter le serveur", Color = Color( 20, 150, 20 ), Func = function() RunConsoleCommand( "disconnect" ) end }, } local tblBtnsAdm = { if LocalPlayer():IsAdmin() then [9] = {Name = "Mode Admin", Color = Color( 255, 30, 30 ), Func = function() RunConsoleCommand( "say", "!admin" ) end }, [10] = {Name = "Logs", Color = Color( 255, 30, 30 ), Func = function() RunConsoleCommand( "blogs" ) end }, [11] = {Name = "Casier", Color = Color( 255, 30, 30 ), Func = function() LocalPlayer():ConCommand( "awarn_menu" ) end }, [12] = {Name = "Gestion des Props", Color = Color( 255, 30, 30 ), Func = function() RunConsoleCommand( "say", "!apg" ) end }, [13] = {Name = "Gestion des Inventaires", Color = Color( 255, 30, 30 ), Func = function() RunConsoleCommand( "itemstore_admin" ) end }, end }
 
Inj3

Inj3

Messages
327
Score réaction
201
Points
160
Un if dans une table o_O
Pas possible.
 
  • Initiateur de la discussion
Seefox

Seefox

Inconnu au bataillon
Messages
472
Score réaction
63
Points
150
Inj3 à dit:
Un if dans une table o_O
Pas possible.
Comment je pourrais faire alors pour faire apparaitre ces petits boutons que si la personne est admin ? :'(
 
NoaGamingFR

NoaGamingFR

Wait :)
Messages
3 650
Score réaction
625
Points
340
Seefox à dit:
Comment je pourrais faire alors pour faire apparaitre ces petits boutons que si la personne est admin ? :'(
Bah j'my connais pas, mais avant d'appeller la fonction ^^'
 
  • Initiateur de la discussion
Seefox

Seefox

Inconnu au bataillon
Messages
472
Score réaction
63
Points
150
Je suis perdu

Code:
function Casier.Warn:OpenMenu() local tblBtns = { [1] = {Name = "3ème Personne", Color = Color( 10, 130, 255, 255 ), Func = function() LocalPlayer():ConCommand( "simple_thirdperson_enable_toggle" ) end }, [2] = {Name = "Poser votre argent à terre", Color = Color( 10, 130, 255, 255 ), Func = function() DropMoney() end }, [3] = {Name = "Poser votre arme à terre", Color = Color( 10, 130, 255, 255 ), Func = function() RunConsoleCommand( "say", "/drop" ) end }, [4] = {Name = "Appeller un admin", Color = Color( 10, 130, 255 ), Func = function() CallAdmin() end }, [5] = {Name = "VIP", Color = Color( 255, 200, 0, 255 ), Func = function() RunConsoleCommand( "say", "!donation" ) end }, [6] = {Name = "Workshop", Color = Color( 20, 150, 20 ), Func = function() RunConsoleCommand( "say", "!addon" ) end }, [7] = {Name = "StopSound", Color = Color( 20, 150, 20 ), Func = function() LocalPlayer():ConCommand( "stopsound" ) end }, [8] = {Name = "Quitter le serveur", Color = Color( 20, 150, 20 ), Func = function() RunConsoleCommand( "disconnect" ) end }, }
if LocalPlayer():IsAdmin() then function Casier.Warn:OpenMenuAdm() local tblBtnsAdm = { [9] = {Name = "Mode Admin", Color = Color( 255, 30, 30 ), Func = function() RunConsoleCommand( "say", "!admin" ) end }, [10] = {Name = "Logs", Color = Color( 255, 30, 30 ), Func = function() RunConsoleCommand( "blogs" ) end }, [11] = {Name = "Casier", Color = Color( 255, 30, 30 ), Func = function() LocalPlayer():ConCommand( "awarn_menu" ) end }, [12] = {Name = "Gestion des Props", Color = Color( 255, 30, 30 ), Func = function() RunConsoleCommand( "say", "!apg" ) end }, [13] = {Name = "Gestion des Inventaires", Color = Color( 255, 30, 30 ), Func = function() RunConsoleCommand( "itemstore_admin" ) end }, }
end
 
Discord d'entraide
Rejoignz-nous sur Discord