- Initiateur de la discussion
thepsyca
Psychopathe
- Messages
- 2 164
- Score réaction
- 648
- Points
- 365
Bonsoir,
j'ai un petit soucis sur se bout de code :
Les deux commandes m'affiche l'erreur :
[ERROR] LuaCmd:1: '}' expected near ']'
1. unknown - LuaCmd:0
EDIT : cela viendrait-il de la limite de 255 caractères de SendLua ?
j'ai un petit soucis sur se bout de code :
Code:
function spawnNPCPos(ply, cmd, args) if (ply:IsAdmin() or ply:IsSuperAdmin()) then local filenpcName = args[1]; if !filenpcName then ply:SendLua("local tab = {Color(213,213,25),[[".. nlf.bot.config.llanguage[loc].nlfbotl1 .."]],Color(255,255,255), [[".. nlf.bot.config.llanguage[loc].nlfbotl2 .."]] }chat.AddText(unpack(tab))"); return; end; if file.Exists( "nlf/"..string.lower(game.GetMap()).."/npc_".. filenpcName ..".txt", "DATA") then ply:SendLua("local tab = {Color(213,213,25), [[".. nlf.bot.config.llanguage[loc].nlfbotl1 .."]],Color(255,255,255),[[".. nlf.bot.config.llanguage[loc].nlfbotl3 ..filenpcName.. nlf.bot.config.llanguage[loc].nlfbotl4 .."]] } chat.AddText(unpack(tab))"); return; end; local npcVector = string.Explode(" ", tostring(ply:GetEyeTrace().HitPos)); local npcAngles = string.Explode(" ", tostring(ply:GetAngles()+Angle(0, -180, 0))); file.Write("nlf/"..string.lower(game.GetMap()).."/npc_".. filenpcName ..".txt", ""..(npcVector[1]).." "..(npcVector[2]).." "..(npcVector[3]).." "..(npcAngles[1]).." "..(npcAngles[2]).." "..(npcAngles[3]).."", "DATA"); ply:SendLua("local tab = {Color(213,213,25),[[".. nlf.bot.config.llanguage[loc].nlfbotl1 .."]],Color(255,255,255),[[".. nlf.bot.config.llanguage[loc].nlfbotl5 .."]]}chat.AddText(unpack(tab))"); else ply:SendLua("local tab = {Color(213,213,25),[[".. nlf.bot.config.llanguage[loc].nlfbotl1 .."]],Color(255,255,255),[[".. nlf.bot.config.llanguage[loc].nlfbotl6 .."]]}chat.AddText(unpack(tab))"); end;
end;
concommand.Add("nlf_bot_spawn", spawnNPCPos);
function removeNPCPos(ply, cmd, args) if (ply:IsAdmin() or ply:IsSuperAdmin()) then local fileVaultName = args[1]; if !fileVaultName then ply:SendLua("local tab = {Color(213,213,25),[[".. nlf.bot.config.llanguage[loc].nlfbotl1 .."]],Color(255,255,255),[[".. nlf.bot.config.llanguage[loc].nlfbotl7 .."]] } chat.AddText(unpack(tab))"); return; end; if file.Exists("nlf/"..string.lower(game.GetMap()).."/npc_"..fileVaultName..".txt", "DATA") then file.Delete("nlf/"..string.lower(game.GetMap()).."/npc_"..fileVaultName..".txt"); ply:SendLua("local tab = {Color(213,213,25),[[".. nlf.bot.config.llanguage[loc].nlfbotl1 .."]],Color(255,255,255),[[".. nlf.bot.config.llanguage[loc].nlfbotl8 .."]]}chat.AddText(unpack(tab))"); return; end; else ply:SendLua("local tab = {Color(213,213,25),[[".. nlf.bot.config.llanguage[loc].nlfbotl1 .."]],Color(255,255,255),[[".. nlf.bot.config.llanguage[loc].nlfbotl9 .."]]}chat.AddText(unpack(tab))"); end;
end;
concommand.Add("nlf_bot_remove", removeNPCPos);
[ERROR] LuaCmd:1: '}' expected near ']'
1. unknown - LuaCmd:0
EDIT : cela viendrait-il de la limite de 255 caractères de SendLua ?
Dernière édition: