SA:MP Arizona Скрипт

notess

Новичок
Автор темы
11
4
Можно как то переписать этот скрипт чтобы человек когда пишет "инв" то давал уже инвайт


Lua:
local id
local accept=false
local ev=require "lib.samp.events"
function main()

    repeat wait(0) until isSampAvailable()
          while true do wait(0)
          if wasKeyPressed(0x31) and not sampIsChatInputActive() and not sampIsDialogActive() then
         result, ped = getCharPlayerIsTargeting(PLAYER_HANDLE)
              if result then
               _, id = sampGetPlayerIdByCharHandle(ped)
                 sampSendChat('/invite '..id)
                 wait(300)
                 sampSendChat('/givecbook '..id.." 100")
                 wait(1000)
                 sampSendChat('/invite '..id)
                 accept=true
             end
         end
     end
 end

 function ev.onServerMessage(c,t)
     if accept and t:find("(%S+)_(%S+) принял ваше предложение вступить к вам в организацию.") then
         sampSendChat("/giverank "..id.." 6")
         accept=false
     end
    if t:find(".*приглашаете игрока.*") then
        sampSendChat('/me передал бандану')
    end
 end