F
F
Fakes2021-01-10 11:16:55
Lua
Fakes, 2021-01-10 11:16:55

Wrote my first mini script, but it doesn't work, tell me what's wrong?

require "lib.moonloader"
local keys = require "vkeys"
 function main()
 if not isSampLoaded() or not isSampfuncsLoaded()
   then return
   end
    while not isSampAvailable()
do wait()
end
sampAddChatMessage('CarHelp активен', 0x800080)
while true do
wait(0)
   if isKeyJustPressed(VK_L)
   then 
   sampSendChat('/lock')
   end
   if isKeyJustPressed(VK_K)
   then 
   sampSendChat('/key')
end

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
dollar, 2021-01-10
@dollar

The main thing that is wrong is that the indents are not respected .
If you follow, then all unclosed end will be more clearly visible.

D
Dima Fott, 2021-02-17
@dimkafmlovediankafm

Very very very bad coding.

require "lib.moonloader"
local keys = require "vkeys"
function main()
   repeat wait(0) until isSampAvailable()
   sampAddChatMessage('CarHelp активен', 0x800080)
   while true do
      wait(0)
      if isKeyJustPressed(VK_L) then sampSendChat('/lock') end
      if isKeyJustPressed(VK_K) then sampSendChat('/key') end
   end
end

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question