1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | 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...
![[Image: xtcul7J.png]](http://i.imgur.com/xtcul7J.png)
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.