Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions [admin]/admin/client/admin_gui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ end

function guiCreateList(x, y, w, h, tabHeight, header, relative, parent, right)
local list = guiCreateButton(x, y, w, h, header, relative, parent, right)

local parentWidth, parentHeight = guiGetSize(parent, false)

local absoluteWidth = parentWidth * w
local absoluteHeight = parentHeight * h

local dropDown = guiCreateStaticImage(absoluteWidth - 20, 0, 20, 20, "client\\images\\dropdown.png", false, list)
guiSetProperty(dropDown, 'AlwaysOnTop', 'True')

addEventHandler('onClientGUIClick', dropDown, function()
guiListSetVisible(list, true)
end, false)
Expand All @@ -75,7 +75,7 @@ function guiCreateList(x, y, w, h, tabHeight, header, relative, parent, right)

local edit = guiCreateEdit(0, 0, absoluteWidth - 20, 20, '', false, bg)
guiSetProperty(edit, 'AlwaysOnTop', 'True')

addEventHandler('onClientGUIChanged', edit, function()
guiListLoadItems(list)
end)
Expand All @@ -87,7 +87,7 @@ function guiCreateList(x, y, w, h, tabHeight, header, relative, parent, right)
local close = guiCreateButton(absoluteWidth-20, 0, 20, 20, 'X', false, bg)
guiSetProperty(close, 'AlwaysOnTop', 'True')
guiSetAlpha(close, 1)

addEventHandler('onClientGUIClick', close, function()
guiListSetVisible(list, false)
end, false)
Expand Down
2 changes: 1 addition & 1 deletion [admin]/admin/client/gui/admin_acl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function aManageACL ()
aACLSetRight = guiCreateButton ( 0.55, 0.40, 0.40, 0.04, "Enable Selected Right", true, aAclForm )
aACLRemoveRight = guiCreateButton ( 0.55, 0.45, 0.40, 0.04, "Disable Selected Right", true, aAclForm )
aACLDeleteRight = guiCreateButton ( 0.55, 0.55, 0.40, 0.04, "Delete Right", true, aAclForm )

aACLExit = guiCreateButton ( 0.75, 0.90, 0.27, 0.04, "Close", true, aAclForm )
aclDisplayOptions ( "", "" )

Expand Down
10 changes: 5 additions & 5 deletions [admin]/admin/client/gui/admin_main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ y=y+B aTab1.VehicleHealth = guiCreateLabel ( 0.26, y, 0.25, 0.04, "Vehicle Heal
aTab1.VehicleCustomize = guiCreateButton ( 0.85, 0.89, 0.13, 0.04, "Customize", true, aTab1.Tab, "customize" )
aTab1.AnonAdmin = guiCreateCheckBox (0.745, 0.942, 0.20, 0.04, "Anonymous Admin", isAnonAdmin(), true, aTab1.Tab )
aTab1.GiveVehicle = guiCreateList( 0.71, 0.710, 0.27, 0.04, 0.275, "Give: "..getVehicleNameFromModel ( aCurrentVehicle ), true, aTab1.Tab, 'givevehicle')

local vehicles = {}
for i = 400, 611 do
local vehName = getVehicleNameFromModel(i)
Expand Down Expand Up @@ -495,7 +495,7 @@ function aAdminRefresh ()
local player = getPlayerFromName ( guiGridListGetItemPlayerName ( aTab1.PlayerList, guiGridListGetSelectedItem( aTab1.PlayerList ), 1 ) )
if ( player and aPlayers[player] ) then
local playerName = aPlayers[player]["name"]

if isColorCodeHidden() then
playerName = removeColorCoding(playerName)
else
Expand Down Expand Up @@ -525,11 +525,11 @@ function aAdminRefresh ()
if ( getElementInterior ( player ) ) then guiSetText ( aTab1.Interior, "Interior: "..getElementInterior ( player ) ) end
guiSetText ( aTab1.JetPack, iif ( isPedWearingJetpack ( player ), "Remove JetPack", "Give JetPack" ) )
if ( getPedWeapon ( player ) ) then guiSetText ( aTab1.Weapon, "Weapon: "..getWeaponNameFromID ( getPedWeapon ( player ) ).." (ID: "..getPedWeapon ( player )..")" ) end

local x, y, z = getElementPosition ( player )
local zoneName = getZoneName ( x, y, z, false )
local cityName = getZoneName ( x, y, z, true )

guiSetText ( aTab1.Area, "Area: "..getSensitiveText( iif ( zoneName == cityName, zoneName, zoneName.." ("..cityName..")" ) ) )

x = getSensitiveText('%.3f'):format(x)
Expand Down Expand Up @@ -1092,7 +1092,7 @@ function aClientClick ( button )
guiGridListClear ( aTab2.ResourceList )
triggerServerEvent ( "aSync", localPlayer, "resources" )
end

-- TAB 3, WORLD
elseif ( getElementParent ( source ) == aTab3.Tab ) then
if ( source == aTab3.SetGameType ) then aInputBox ( "Game Type", "Enter game type:", "", "setGameType" )
Expand Down
10 changes: 5 additions & 5 deletions [admin]/admin/client/gui/admin_permissions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function aPermissions.Show(player)
local x, y = guiGetScreenSize()
aPermissions.Form = guiCreateWindow(x / 2 - 200, y / 2 - 125, 400, 250, '', false)
guiSetAlpha(aPermissions.Form, 1)

aPermissions.LabelYourPerms = guiCreateLabel(0.03, 0.1, 0.35, 0.07, '', true, aPermissions.Form)
aPermissions.PlayerGroups = guiCreateGridList(0.03, 0.18, 0.35, 0.68, true, aPermissions.Form)
guiGridListAddColumn(aPermissions.PlayerGroups, "Group Name", 0.85)
Expand All @@ -35,11 +35,11 @@ function aPermissions.Show(player)

aPermissions.Update = guiCreateButton(0.03, 0.88, 0.435, 0.09, "Refresh", true, aPermissions.Form)
aPermissions.Hide = guiCreateButton(0.535, 0.88, 0.435, 0.09, "Close", true, aPermissions.Form)

addEventHandler('aPermissionsSync', localPlayer, aPermissions.onSync)
addEventHandler('aOnPermissionsChange', localPlayer, aPermissions.Refresh)
addEventHandler("onClientGUIClick", aPermissions.Form, aPermissions.onClick)

--Register With Admin Form
aRegister("PlayerPermissions", aPermissions.Form, aPermissions.Show, aPermissions.Close)
end
Expand Down Expand Up @@ -105,13 +105,13 @@ function aPermissions.ConfirmChange(add)
end

local gridlist = add and aPermissions.AllGroups or aPermissions.PlayerGroups

local selected = guiGridListGetSelectedItem(gridlist)

if (selected <= -1) then
return
end

local groupName = guiGridListGetItemText(gridlist, selected, 1)

local str = add and 'Are you sure you want to add "%s" to the "%s" group?' or 'Are you sure you want to remove "%s" from the "%s" group?'
Expand Down
2 changes: 1 addition & 1 deletion [admin]/admin/client/gui/admin_spectator.lua
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ function aSpectator.CheckCollision(x, y, z)
end
end
end

return nearest_distance or false
end

Expand Down
2 changes: 1 addition & 1 deletion [admin]/admin/client/gui/admin_warp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ function aClientWarpClick ( button, state, absX, absY )
aPlayerWarpClose ( false )
elseif ( source == aWarpToPosition ) then
aPlayerWarpToPosition ( )

-- Player Warp To Position Map
elseif ( source == aWarpToPositionMap ) then
calculatePosition ( absX, absY )
Expand Down
6 changes: 3 additions & 3 deletions [admin]/admin/meta.xml
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,14 @@
group="_fake packets"
accept="true,false"
desc="Ban IPs that attempt to send fake admin packets."
/>
/>

<setting name="*fakePacketsSerialban" value="false"
friendlyname="Serialban"
group="_fake packets"
accept="true,false"
desc="Ban serials that attempt to send fake admin packets."
/>
/>

<setting name="*fakePacketsIPbanLength" value="86400"
friendlyname="IPBan length"
Expand Down
2 changes: 1 addition & 1 deletion [admin]/admin/server/admin_server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function aHandleIP2CUpdate()
local hasAdminPermission = hasObjectPermissionTo(playerElement, "general.adminpanel", false)

if hasAdminPermission then

for playerToUpdateID = 1, #playersToUpdate do
local playerToUpdate = playersToUpdate[playerToUpdateID]

Expand Down
4 changes: 2 additions & 2 deletions [admin]/admin/server/admin_servermaps.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function getServerMaps (loadList)
local tableOut = {}

local mapmanager = getResourceFromName("mapmanager")

if mapmanager and (getResourceState(mapmanager) ~= "running") then
mapmanager = nil
end
Expand Down Expand Up @@ -61,7 +61,7 @@ function startGamemodeMap(gamemode, map)
if checkClient( true, source, 'startGamemodeMap' ) then return end

local mapmanager = getResourceFromName("mapmanager")

if mapmanager and (getResourceState(mapmanager) ~= "running") then
mapmanager = nil
end
Expand Down
62 changes: 31 additions & 31 deletions [admin]/admin2/client/admin_gui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -205,31 +205,31 @@ function guiSetContextMenu(element, menu)
if (button == "right") then
local sx, sy = guiGetScreenSize()
local x, y = getCursorPosition()
addEventHandler(
"onClientGUIClick",
element,
function(button, state)
contextSource = source
if (getElementType(source) == "gui-gridlist" and guiGridListGetSelectedItem(source) == -1) then
return
end
if (button == "right" and state == "up") then
local screenX, screenY = guiGetScreenSize()
local cursorX, cursorY = getCursorPosition()
cursorX, cursorY = screenX * cursorX, screenY * cursorY
guiSetPosition(menu, cursorX, cursorY, false)
guiSetVisible(menu, true)
guiBringToFront(menu)
addEventHandler(
"onClientGUIClick",
element,
function(button, state)
contextSource = source
if (getElementType(source) == "gui-gridlist" and guiGridListGetSelectedItem(source) == -1) then
return
end
if (button == "right" and state == "up") then
local screenX, screenY = guiGetScreenSize()
local cursorX, cursorY = getCursorPosition()
cursorX, cursorY = screenX * cursorX, screenY * cursorY
guiSetPosition(menu, cursorX, cursorY, false)
guiSetVisible(menu, true)
guiBringToFront(menu)

setTimer(
function()
addEventHandler(
"onClientClick",
root,
function(button2, clickState, x2, y2)
local sx2, sy2 = guiGetSize(menu, false)
local px, py = guiGetPosition(menu, false)
if (x2 < px or x2 > px + sx2) or (y2 < py or y2 > py + sy2) then
function(button2, clickState, x2, y2)
local sx2, sy2 = guiGetSize(menu, false)
local px, py = guiGetPosition(menu, false)
if (x2 < px or x2 > px + sx2) or (y2 < py or y2 > py + sy2) then
guiSetVisible(menu, false)
removeEventHandler("onClientClick", root, debug.getinfo(1, "f").func)
end
Expand All @@ -243,18 +243,18 @@ function guiSetContextMenu(element, menu)
end,
false
)
addEventHandler(
"onClientGUIClick",
menu,
function(button, state)
if (state ~= "up") then
return
end

guiSetVisible(menu, false)
end
)
end
addEventHandler(
"onClientGUIClick",
menu,
function(button, state)
if (state ~= "up") then
return
end
guiSetVisible(menu, false)
end
)
end

function guiContextMenuAddItem(element, text)
local height = 16
Expand Down
2 changes: 1 addition & 1 deletion [admin]/admin2/client/admin_session.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ addEventHandler(

aSession = data
aMap.UpdatePermissions()

if (hasPermissionTo("general.adminpanel")) then
outputChatBox("Press 'p' to open your admin panel", player)
bindKey("p", "down", "adminpanel")
Expand Down
12 changes: 6 additions & 6 deletions [admin]/admin2/client/main/admin_acl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,10 @@ function aAclTab.onClick(key, state)
local group = guiGridListGetItemText(aAclTab.Groups, selectedGroup, 1)

local result = messageBox("Are you sure you want to remove the user '"..object.."' from the '"..group.."' ACL group?", MB_QUESTION, MB_YESNO)

if (result) then
triggerServerEvent(EVENT_ACL, localPlayer, ACL_USERS, ACL_REMOVE, group, 'user.'..object)

aAclTab.Cache.Users[group] = nil
aAclTab.RefreshUsersList()
end
Expand All @@ -163,7 +163,7 @@ function aAclTab.onClick(key, state)
if (nick) then
local group = guiGridListGetItemText(aAclTab.Groups, selected, 1)
triggerServerEvent(EVENT_ACL, localPlayer, ACL_USERS, ACL_ADD, group, nick)

aAclTab.Cache.Users[group] = nil
aAclTab.RefreshUsersList()
end
Expand All @@ -179,7 +179,7 @@ function aAclTab.onClick(key, state)
if (name) then
local group = guiGridListGetItemText(aAclTab.Groups, selected, 1)
triggerServerEvent(EVENT_ACL, localPlayer, ACL_RESOURCES, ACL_ADD, group, name)

aAclTab.Cache.Resources[group] = nil
aAclTab.RefreshResourcesList()
end
Expand All @@ -195,10 +195,10 @@ function aAclTab.onClick(key, state)
local group = guiGridListGetItemText(aAclTab.Groups, selectedGroup, 1)

local result = messageBox("Are you sure you want to remove the resource '"..object.."' from the '"..group.."' ACL group?", MB_QUESTION, MB_YESNO)

if (result) then
triggerServerEvent(EVENT_ACL, localPlayer, ACL_RESOURCES, ACL_REMOVE, group, 'resource.'..object)

aAclTab.Cache.Resources[group] = nil
aAclTab.RefreshResourcesList()
end
Expand Down
6 changes: 3 additions & 3 deletions [admin]/admin2/client/main/admin_bans.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ function aBansTab.Create(tab)
sync(SYNC_BANS)
end

function aBansTab.onClientClick(button, state)
if (button == "left" and state == "up") then
if (source == aBansTab.Details) then
function aBansTab.onClientClick(button, state)
if (button == "left" and state == "up") then
if (source == aBansTab.Details) then
if (guiGridListGetSelectedItem(aBansTab.BansList) == -1) then
messageBox("No ban selected!", MB_ERROR, MB_OK)
else
Expand Down
4 changes: 2 additions & 2 deletions [admin]/admin2/client/widgets/admin_ban.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function aBan.Show(player)
if not aBan.Form then
aBan.Create()
end

-- If a player was selected, auto-fill the form with the player's info
if player then
aBan.playerName = getPlayerName(player)
Expand Down Expand Up @@ -224,7 +224,7 @@ function aBan.verifyForm()
else
banDuration = aBan.defaultDurations[durationSelection][2]
end

-- Verify ban IP
local banIP = ""
if guiCheckBoxGetSelected(aBan.IPCheckBox) then
Expand Down
2 changes: 1 addition & 1 deletion [admin]/admin2/client/widgets/admin_ban_details.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function aBanDetails.Show(banID, showUnban)
if not aBanDetails.Form then
aBanDetails.Create()
end

aBanDetails.banID = banID
local data = aBansTab.List[banID]
guiSetText(aBanDetails.NickText, "Player name: "..(data.nick or "Unknown"))
Expand Down
Loading