PLUGIN = nil function Initialize(Plugin) Plugin:SetName("AltisLife") Plugin:SetVersion(1) --Loads Plugin Commands cPluginManager.BindCommand("/alert", "", AlertPol, "- Alert the police") -- Hooks PLUGIN = Plugin -- NOTE: only needed if you want OnDisable() to use GetName() or something like that -- Command Bindings LOG("Initialized " .. Plugin:GetName() .. " v." .. Plugin:GetVersion()) return true end --Sets alarm triggered by AlertPol when the arguments are valid. function setAlarm(playerName, Message) Root:BroadcastChat("CNN News: " ..Message.. " From: " ..playerName) end --Function for Alert Police function AlertPol(Split, Player) if (#Split ~= 2) then Player:SendMessageFailure("You're Arguments Are Invalid, here's the format: /alert 'Message'") return True end if(#Split ~= 1) then playerName = Player:GetName() Message = Split[2] Player:SendMessageSuccess("Your report has been sent to the police, please hold on") --Triggers setAlarm function, go to line 19 for more info setAlarm(playerName, Message) return True end end function OnDisable() LOG(PLUGIN:GetName() .. " is shutting down...") end
So this is my code for an upcoming Altis Life plugin, which is of course gonna have a different name. I'm waiting for MCServer to be less derpy with ai and stuff, and add minecarts.
Console reports no problems on startup, but when executing /alarm Test...
-{INFO} Your report has been sent to the police, please hold on
-{INFO}Something went wrong while executing command "/alert test'
Then on the console...
So, i'm new to LUA programming, so can you guys explain to me in depth what the error is, and how I can prevent it next time? Thanks
EDIT: Yes I did copy the template from the documentation, and snipped off some of the explode example.