Advertisement
Laine_prikol

Untitled

Jun 30th, 2017
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.99 KB | None | 0 0
  1. script_name("KillMessage")
  2. script_author("Laine_prikol")
  3. script_description("Send message on death!")
  4. require "moonloader"
  5. function MessagesSave(message)
  6. file = io.open("moonloader/execommand.cfg", "a")
  7. io.output(file)
  8. io.write(message)
  9. io.close(file)
  10. end
  11. function main()
  12.   while not isSampAvailable() do wait(100) end
  13. file = io.open("moonloader/execommand.cfg", "r")
  14. if file == nil then
  15. sampAddChatMessage("[KillMessage] ERROR: CAN'T LOAD CONFIG FILE! Please create config file in: moonloader/killmessage.cfg", 0xff00ff)
  16. end
  17. if file ~= nil then
  18. sampAddChatMessage("KillMessage by Laine_prikol loaded!", 0x00ff00)
  19. mess = file:read("*a")
  20. local i = 0
  21. tabls = {}
  22.   for line in io.lines('moonloader/execommand.cfg') do
  23.   i = i + 1
  24.   tabls[i] = line
  25.   end
  26. io.close(file)
  27.  
  28. local a = #tabls
  29.  
  30. while true do
  31. wait(10)
  32. health = getCharHealth(playerPed)
  33.     if health < 0 then
  34.         local randomMessage = math.random(1,a)
  35.         sampSendChat(""..tabls[randomMessage])
  36.         wait(6000)
  37.     end
  38. end
  39. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement