Иконка ресурса

LUA Автоматический запрос ордера

  • 36
  • 25
voidptr_t добавил(а) новый ресурс:

Автоматический запрос ордера - Луа, которое позволяет смотря на дверь запросить ордер биндом

Lua:
concommand.Add("autowarrant", function(reason)
    local ent = LocalPlayer():GetEyeTrace().Entity
    if ent ~= NULL then
        if ent:isDoor() then
            local owner = ent:getDoorOwner()
            if owner ~= NULL then
                RunConsoleCommand("darkrp", "warrant", owner:SteamID(), reason)
            end
        end
    end
end)

Узнать больше об этом ресурсе...
 
  • 1
  • 0
Контакты для связи отсутствуют.
Вот оптимизированный варик

оптимизация:
concommand.Add("autowarrant", function(reason)

    local ent = LocalPlayer():GetEyeTrace().Entity

    if ent:IsValid() and ent:IsDoor() then

        local owner = ent:getDoorOwner()

        if owner:IsValid() and owner:IsPlayer() then

            RunConsoleCommand("darkrp", "warrant", owner:SteamID(), reason)

        end

    end

end)
 
Последнее редактирование модератором:
  • 33
  • 1
  • 0
Контакты для связи отсутствуют.
  • 154
  • 21
  • 59
Только на обычный darkrp поэтому обкак
темболее reason будет выдовать просто локалпллера а не введенный текст в команде
1674036245186.png


function(_,_,_,reason) надо сделать
 
  • 13
  • 1
Контакты для связи отсутствуют.
[ERROR] gamemodes/darkrp/gamemode/util/workarounds/main_sh.lua:4: attempt to call method 'isDoor' (a nil value)
1. unknown - gamemodes/darkrp/gamemode/util/workarounds/main_sh.lua:4
2. unknown - lua/includes/modules/concommand.lua:54
как заставить работать помогите
 
  • 154
  • 21
  • 59
JavaScript:
concommand.Add("autowarrant",function()
    local ent = LocalPlayer():GetEyeTrace().Entity
    if ent and ent:GetClass()=="prop_door_rotating" then
        if ent.getDoorOwner then
            local darkrp = ent:getDoorOwner()
            if darkrp then
                LocalPlayer():ConCommand("say /warrant "..darkrp:SteamID().." Нелегал")
            end
            return
        end
        if ent.DoorGetOwner then
            local darkrp = ent:DoorGetOwner()
            if darkrp then
                LocalPlayer():ConCommand("say /warrant "..darkrp:SteamID().." Нелегал")
            end
            return
        end
    elseif ent and ent:GetClass()=="player" then
        LocalPlayer():ConCommand("say /wanted "..ent:SteamID().." Нелегал")
    end
end)
моя версия от величайшего
 
Активность
Пока что здесь никого нет
Сверху Снизу