Lua скрипт не работает хелп!

LKK

Известный
Автор темы
83
9
Версия SA-MP
  1. 0.3.7 (R1)
Не работает скрипт /givegun id 1 - пкм+z в чём проблема? не могу понять, помогите!. (скрипт под Dimond rp) Код ниже.


Lua:
script_name('givegun')
script_author("Shishkin")

function main()
    if not isSampfuncsLoaded() or not isSampLoaded() then return end
    while not isSampAvailable() do wait(100) end
    wait(100)
    lua_thread.create(samp)
    wait(-1)
end

function samp()
   while true do
   wait(0)
   local result, target = getCharPlayerIsTargeting(playerHandle)
   if result then result, playerid = sampGetPlayerIdByCharHandle(target) end
     if result and isKeyJustPressed(VK_Z) then
     sampSendChat("/givegun "..playerid.." 1")
     end
   end
end
 
  • Нравится
Реакции: Shishkin

Shishkin

Известный
491
250
Мой код, переписал не много


Lua:
script_name('givegun')
script_author("Shishkin")

function main()
    if not isSampfuncsLoaded() or not isSampLoaded() then return end
    while not isSampAvailable() do wait(100) end
    wait(100)
    local result, target = getCharPlayerIsTargeting(playerHandle)
    if result then result, playerid = sampGetPlayerIdByCharHandle(target) end
    if result and isKeyJustPressed(0x5A) then
        sampSendChat("/givegun " .. playerid .. " 1")
    end
    wait(-1)
end
 
  • Bug
Реакции: paulohardy