Помогите отредактировать lua

Статус
В этой теме нельзя размещать новые ответы.

LKK

Известный
Автор темы
83
9
Версия SA-MP
  1. 0.3.7 (R1)
Помогите отредактировать скрипт Fast invite, на кнопку i - /invite , а мне нужно добавить ещё на О анг /rang как это сделать? внизу код луа.
Fast invite:
local ev = require('lib.samp.events')
require "lib.moonloader"
local fastcmd = false
local id2 = 1111
function main()
    repeat wait(100) until isSampAvailable()
    sampAddChatMessage('{06eb27}[Script]Fastcmd Loaded', -1)
    while true do
    wait(0)
        local res, ped = getCharPlayerIsTargeting(playerHandle)
        if res then
            local proverka = wasKeyPressed(73)
            if proverka then
                res, ped = getCharPlayerIsTargeting(playerHandle)
                res, id = sampGetPlayerIdByCharHandle(ped)
                if id2 ~= id then
                    id2 = id
                    sampSendChat("/invite "..id, -1)
                end
            end
        end
    end
end
 
Решение
Lua:
local ev = require('lib.samp.events')

function main()
    repeat wait(100) until isSampAvailable()
    sampAddChatMessage('{06eb27}[Script]Fastcmd Loaded', -1)
    while true do wait(0)
        local res, ped = getCharPlayerIsTargeting(playerHandle)
        res1, id = sampGetPlayerIdByCharHandle(ped)
        if res then
            if wasKeyPressed(73) then
                sampSendChat("/invite "..id)
            end
            if wasKeyPressed(79) then
                sampSendChat("/rang "..id)
            end
        end
    end
end

damag

Женюсь на официантке в моем любимом баре
Проверенный
1,152
1,192
Lua:
local ev = require('lib.samp.events')

function main()
    repeat wait(100) until isSampAvailable()
    sampAddChatMessage('{06eb27}[Script]Fastcmd Loaded', -1)
    while true do wait(0)
        local res, ped = getCharPlayerIsTargeting(playerHandle)
        res1, id = sampGetPlayerIdByCharHandle(ped)
        if res then
            if wasKeyPressed(73) then
                sampSendChat("/invite "..id)
            end
            if wasKeyPressed(79) then
                sampSendChat("/rang "..id)
            end
        end
    end
end
 

Nessel

Участник
120
24
Выбирай какой лучше:
function main()
   while not isSampAvailable() do wait(100) end
   while true do
   wait(0)
   local result, target = getCharPlayerIsTargeting(playerHandle)
   if result then result, playerid = sampGetPlayerIdByCharHandle(target) end
    name = sampGetPlayerNickname(playerid)
     if result and isKeyJustPressed(0x49) then
        sampSendChat("/invite " ..playerid)
    end 
    if result and isKeyJustPressed(0x4F) then
        sampSendChat("/rang " ..playerid)
    end
   end
end
 
  • Нравится
Реакции: LKK
Статус
В этой теме нельзя размещать новые ответы.