В этом туториале Я научу вас делать ВИП-функции(Которые доступны только ВИПам).
Итак,это будет полезно для тех,кто будет открывать донат на сервере.
Это всё серверная сторона.
--[[Donat]]
--Создаём префикс для чата.
function vipchat(text, msgtype)
local root = getRootElement()
local account = getAccountName(getPlayerAccount(source))
local name = getPlayerName(source)
if (msgtype == 0) then
if isObjectInACLGroup("user." .. account, aclGetGroup("VIP")) then
outputChatBox("#855863[ВИП] #FFFFFF" .. name .. ":#FFFFFF " .. text, root, 255, 255, 0, true)
end
end
end
addEventHandler("onPlayerChat", root, vipchat)
--Окей,создаём функцию,которая даёт деньги ВИПу.
function vipfunc ()
local account = getAccountName(getPlayerAccount(source))
if isObjectInACLGroup("user." .. account, aclGetGroup("VIP")) then
givePlayerMoney(source, 10000)
end
end
addCommandHandler("vipmoney",vipfunc)
--[[
Делаем его невидимым.Спасибо Flaker'у за ресурс.
]]
local teams = { "Red", "Blue" }
local groups = { "VIP" }
blip = { }
function toggleInvis ( source )
local nameTag = getPlayerNametagText ( source )
if ( source and getElementType ( source ) == "player" and hasPlayerAccessToInvisible (source) == true ) then
if ( getElementAlpha ( source ) > 200 ) then
setPlayerNametagShowing ( source, false )
setElementAlpha ( source, 0 )
local attachedElements = getAttachedElements ( source )
for ElementKey, ElementValue in ipairs ( attachedElements ) do
if ( getElementType ( ElementValue ) == "blip" ) then
destroyElement ( ElementValue )
end
end
outputChatBox ( "#FFFF00*Инфо* #00FF00Невидимость включена", source, 0, 255, 0, true )
else
setPlayerNametagShowing ( source, true )
setElementAlpha ( source, 255 )
local nameTag = getPlayerName ( source )
local r, g, b = getPlayerNametagColor ( source )
blip [ source ] = createBlipAttachedTo ( source, 0, 2, r, g, b, 255 )
outputChatBox ( "#FFFF00*INFO* #00FF00Невидимость выключена", source, 0, 255, 0, true )
end
else
outputDebugString ( "Player: ".. nameTag .." try to use invisible, but he hasn't access to it!" )
end
end
addCommandHandler ( "invisible", toggleInvis )
function hasPlayerAccessToInvisible (thePlayer) -- Делаем проверки
local allowed = false
if ( thePlayer ) then
for id, team_cur in ipairs(teams) do
if ( getPlayerTeam ( thePlayer ) and getTeamName ( getPlayerTeam ( thePlayer ) ) == team_cur ) then
allowed = true
break
end
end
if not(allowed == true) then
for id, group_cur in ipairs(groups) do
if ( isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( thePlayer ) ), aclGetGroup ( group_cur ) ) ) then
allowed = true
break
end
end
end
return allowed
end
end
addEventHandler ( "onPlayerQuit", root, -- Когда он выходит - уничтожать блип
function ( )
if isElement ( blip [ source ] ) then
destroyElement ( blip [ source ] )
end
end
)
addEventHandler ( "onPlayerLogout", root, -- Когда он выходит из аккаунта - уничтожать блип
function ( )
if isElement ( blip [ source ] ) then
destroyElement ( blip [ source ] )
end
end
)
Думаю,всё,если что - могу дополнить туториал.
function hasPlayerAccessToInvisible source