Welcome to Сообщество игровых серверов NETZONA.ORG

Присоединяйтесь к нам сейчас, чтобы получить доступ ко всем нашим функциям. Зарегистрировавшись и войдя в систему, вы сможете создавать темы, публиковать ответы в существующих темах, давать репутацию другим участникам, получать собственный личный мессенджер и многое другое. Это также быстро и совершенно бесплатно, так чего же вы ждете?
  • Приветствуем на сайте, Гость! Обязательно ознакомьтесь с условиями и правилами Публичной оферты Проекта NetZONA.org: https://netzona.org/help/public-offer/

  • Приветствуем на сайте, Гость! Обязательно ознакомьтесь с условиями и правилами использования Ваших файлов cookie на Проекте NetZONA.org: https://netzona.org/help/cookies/

  • Приветствуем на сайте, Гость! Обязательно ознакомьтесь с Политикой конфиденциальности Проекта NetZONA.org: https://netzona.org/pages/privacy-policy/

  • Ответы на основные вопросы: https://netzona.org/threads/populjarnye-voprosy-i-otvety-na-nix.6122/

  • Приветствуем на сайте, Гость! Приобрести (купить) Информационную услугу (в том числе группу "Проверенный") на Проекте NetZONA.org: https://netzona.org/account/upgrades

Помогите с ServerGuard

DalySherman

Пользователь
Регистрация
14 Янв 2019
Сообщения
28
Реакции
0
Баллы
16
Всем привет!
У меня возникла проблемка из-за моей неопытности.
В общем, я хочу некоторые модули из ULX перенести в ServerGuard, немогли бы вы мне помочь, показать как это делается на примере одного из модулей.
======================================================================

------------------------------ [setmodel]------------------------------
CATEGORY_NAME = "DerTod's Extras"
function ulx.setmodel( calling_ply, target_plys, message )
if not ULib.fileExists( message ) or string.Explode("/",message)[1] != "models" then
ULib.tsayError( calling_ply, "That model doesn't exist on the server!", true )
return
end

if not message or message == "model path" or message == "" then
ULib.tsayError( calling_ply, "No model path given.", true )
return
end

// I know, the following code looks shitty and inefficient. But is will do for now. If you have suggestions that can improve it, while
// maintaining its current functionality, please let me know. It is 3am and I want to sleep :D

// Names of the players that already have the choosen model.
local already = {}

// Players that already have the choosen model.
local already2 = {}

local message = string.lower(message)

for k,v in pairs(target_plys) do
local playermodel = string.lower(target_plys[k]:GetModel())
if playermodel == message then
// Adds some juicy players to the tables (if they already have the choosen model).
already[#already+1] = v:GetName()
already2[#already2+1] = v
else
// Sets the models of the targeted players (if they don't already have it).
target_plys[k]:SetModel(tostring(message))
local string = message
end
end
// Are you still reading this? This tells the calling player that the targeted players already have the choosen model.
local already_string = table.concat(already, ", ", 1, #already)
if already_string and already_string != "" then
ULib.tsay( calling_ply, already_string.." already has/have this model!", true )
end
// This removes the players that already have the choosen model from the targeted players. Only the ones that don't have the choosen model remain.
for k,v in pairs(already2) do
table.RemoveByValue(target_plys, v)
end
// This logs the executed command in the usual ULX fashion. Nice and easy.
ulx.fancyLog( {calling_ply }, "#P changed the model of #T to #s", calling_ply, target_plys, message )
end

local setmodel = ulx.command( CATEGORY_NAME, "ulx setmodel", ulx.setmodel, "!setmodel", true )
setmodel:addParam{ type=ULib.cmds.PlayersArg}
setmodel:addParam{ type=ULib.cmds.StringArg, hint="model path" }
setmodel:defaultAccess( ULib.ACCESS_ADMIN )
setmodel:help( "Set the model of a player." )
 

Черная Лиса

Пользователь
Регистрация
28 Мар 2020
Сообщения
173
Реакции
0
Баллы
30
Возми два самых шаблонных модуля ;/
Кинь сюда. Надо искать общее.
 

MrSmile

Пользователь
Регистрация
14 Мар 2020
Сообщения
417
Реакции
0
Баллы
35
setmodel присутствует в serverguard(ну покрайне мере в моём)
 
Назад
Сверху Снизу