adisonboss
Wiek: 23 Na forum: 3332 dni Posty: 237
Piwa : 6
Witam mam problem ze skryptem. Ot?? w panelu genera?a brygadiera w PSP nie mog? ani zatrudnia? ani zwalnia? z ACL. ZA POMOC I
Client
mojeW , mojeH = 1680 , 1050
sW , sH = guiGetScreenSize ()
width , height = ( sW / mojeW ), ( sH / mojeH )
GUIEditorr = {
button = {},
window = {},
label = {},
combobox = {},
gridlist = {},
edit = {}
}
GUIEditorr . window [ 1 ] = guiCreateWindow ( 612 * width , 306 * height , 429 * width , 344 * height , "Panel Genera?a" , false )
guiWindowSetSizable ( GUIEditorr . window [ 1 ], false )
GUIEditorr . combobox [ 1 ] = guiCreateComboBox ( 24 * width , 65 * height , 150 * width , 158 * height , "--Wybierz--" , false , GUIEditorr . window [ 1 ])
GUIEditorr . combobox [ 2 ] = guiCreateComboBox ( 214 * width , 65 * height , 193 * width , 158 * height , "--Wybierz--" , false , GUIEditorr . window [ 1 ])
guiComboBoxAddItem ( GUIEditorr . combobox [ 2 ], "Genera? Brygadier" )
guiComboBoxAddItem ( GUIEditorr . combobox [ 2 ], "Nadbrygadier" )
guiComboBoxAddItem ( GUIEditorr . combobox [ 2 ], "Starszy Brygadier" )
guiComboBoxAddItem ( GUIEditorr . combobox [ 2 ], "Brygadier" )
guiComboBoxAddItem ( GUIEditorr . combobox [ 2 ], "M?odszy Brygadier" )
guiComboBoxAddItem ( GUIEditorr . combobox [ 2 ], "Starszy Kapitan" )
guiComboBoxAddItem ( GUIEditorr . combobox [ 2 ], "Kapitan" )
guiComboBoxAddItem ( GUIEditorr . combobox [ 2 ], "M?odszy Kapitan" )
guiComboBoxAddItem ( GUIEditorr . combobox [ 2 ], "Aspirant Sztabowy" )
guiComboBoxAddItem ( GUIEditorr . combobox [ 2 ], "Starszy Aspirant" )
guiComboBoxAddItem ( GUIEditorr . combobox [ 2 ], "Aspirant" )
guiComboBoxAddItem ( GUIEditorr . combobox [ 2 ], "M?odszy Aspirant" )
guiComboBoxAddItem ( GUIEditorr . combobox [ 2 ], "Starszy Ogniomistrz" )
guiComboBoxAddItem ( GUIEditorr . combobox [ 2 ], "Ogniomistrz" )
guiComboBoxAddItem ( GUIEditorr . combobox [ 2 ], "M?odszy Ogniomistrz" )
guiComboBoxAddItem ( GUIEditorr . combobox [ 2 ], "Starszy Sekcyjny" )
guiComboBoxAddItem ( GUIEditorr . combobox [ 2 ], "Sekcyjny" )
guiComboBoxAddItem ( GUIEditorr . combobox [ 2 ], "Starszy Stra?ak" )
guiComboBoxAddItem ( GUIEditorr . combobox [ 2 ], "Stra?ak" )
guiComboBoxAddItem ( GUIEditorr . combobox [ 2 ], "Brak" )
GUIEditorr . label [ 1 ] = guiCreateLabel ( 26 * width , 34 * height , 93 * width , 21 * height , "Login:" , false , GUIEditorr . window [ 1 ])
guiSetFont ( GUIEditorr . label [ 1 ], "default-bold-small" )
guiLabelSetVerticalAlign ( GUIEditorr . label [ 1 ], "center" )
GUIEditorr . label [ 2 ] = guiCreateLabel ( 214 * width , 34 * height , 120 * width , 21 * height , "Stopie? S?u?bowy:" , false , GUIEditorr . window [ 1 ])
guiSetFont ( GUIEditorr . label [ 2 ], "default-bold-small" )
guiLabelSetVerticalAlign ( GUIEditorr . label [ 2 ], "center" )
GUIEditorr . button [ 1 ] = guiCreateButton ( 24 * width , 228 * height , 150 * width , 38 * height , "Zatrudnij" , false , GUIEditorr . window [ 1 ])
guiSetProperty ( GUIEditorr . button [ 1 ], "NormalTextColour" , "FFAAAAAA" )
GUIEditorr . button [ 2 ] = guiCreateButton ( 257 * width , 228 * height , 150 * width , 38 * height , "Zwolnij" , false , GUIEditorr . window [ 1 ])
guiSetProperty ( GUIEditorr . button [ 2 ], "NormalTextColour" , "FFAAAAAA" )
GUIEditorr . button [ 3 ] = guiCreateButton ( 142 * width , 276 * height , 150 * width , 38 * height , "Dodaj Premie" , false , GUIEditorr . window [ 1 ])
guiSetProperty ( GUIEditorr . button [ 3 ], "NormalTextColour" , "FFAAAAAA" )
GUIEditorr . button [ 4 ] = guiCreateButton ( 9 * width , 295 * height , 44 * width , 39 * height , "X" , false , GUIEditorr . window [ 1 ])
guiSetProperty ( GUIEditorr . button [ 4 ], "NormalTextColour" , "FFAAAAAA" )
GUIEditorr . button [ 8 ] = guiCreateButton ( 69 * width , 295 * height , 64 * width , 39 * height , "Leg." , false , GUIEditorr . window [ 1 ])
guiSetProperty ( GUIEditorr . button [ 8 ], "NormalTextColour" , "FFAAAAAA" )
GUIEditorr . button [ 5 ] = guiCreateButton ( 141 * width , 175 * height , 150 * width , 38 * height , "Akceptuj Zmiany" , false , GUIEditorr . window [ 1 ])
guiSetProperty ( GUIEditorr . button [ 5 ], "NormalTextColour" , "FFAAAAAA" )
GUIEditorr . window [ 2 ] = guiCreateWindow ( 631 * width , 310 * height , 379 * width , 404 * height , "Panel Zatrudniania" , false )
guiWindowSetSizable ( GUIEditorr . window [ 2 ], false )
GUIEditorr . gridlist [ 1 ] = guiCreateGridList ( 29 * width , 47 * height , 243 * width , 305 * height , false , GUIEditorr . window [ 2 ])
guiGridListAddColumn ( GUIEditorr . gridlist [ 1 ], "Gracz" , 0.9 )
GUIEditorr . button [ 6 ] = guiCreateButton ( 219 * width , 363 * height , 150 * width , 31 * height , "Zatrudnij" , false , GUIEditorr . window [ 2 ])
guiSetProperty ( GUIEditorr . button [ 6 ], "NormalTextColour" , "FFAAAAAA" )
GUIEditorr . button [ 7 ] = guiCreateButton ( 323 * width , 25 * height , 46 * width , 41 * height , "X" , false , GUIEditorr . window [ 2 ])
guiSetProperty ( GUIEditorr . button [ 7 ], "NormalTextColour" , "FFAAAAAA" )
GUIEditorr . window [ 3 ] = guiCreateWindow ( 631 * width , 310 * height , 379 * width , 190 * height , "Panel Legitymacji" , false )
guiWindowSetSizable ( GUIEditorr . window [ 3 ], false )
GUIEditorr . label [ 3 ] = guiCreateLabel ( 24 * width , 50 * height , 50 * width , 36 * height , "Nr:" , false , GUIEditorr . window [ 3 ])
guiSetFont ( GUIEditorr . label [ 3 ], "default-bold-small" )
guiLabelSetVerticalAlign ( GUIEditorr . label [ 3 ], "center" )
GUIEditorr . label [ 4 ] = guiCreateLabel ( 24 * width , 90 * height , 50 * width , 36 * height , "Data:" , false , GUIEditorr . window [ 3 ])
guiSetFont ( GUIEditorr . label [ 4 ], "default-bold-small" )
guiLabelSetVerticalAlign ( GUIEditorr . label [ 4 ], "center" )
GUIEditorr . edit [ 1 ] = guiCreateEdit ( 57 * width , 50 * height , 220 * width , 36 * height , "" , false , GUIEditorr . window [ 3 ])
GUIEditorr . edit [ 2 ] = guiCreateEdit ( 57 * width , 90 * height , 220 * width , 36 * height , "" , false , GUIEditorr . window [ 3 ])
GUIEditorr . button [ 9 ] = guiCreateButton ( 219 * width , 160 * height , 150 * width , 31 * height , "Akceptuj" , false , GUIEditorr . window [ 3 ])
guiSetProperty ( GUIEditorr . button [ 9 ], "NormalTextColour" , "FFAAAAAA" )
GUIEditorr . button [ 10 ] = guiCreateButton ( 323 * width , 25 * height , 46 * width , 41 * height , "X" , false , GUIEditorr . window [ 3 ])
guiSetProperty ( GUIEditorr . button [ 10 ], "NormalTextColour" , "FFAAAAAA" )
guiSetVisible ( GUIEditorr . window [ 3 ], false )
guiSetVisible ( GUIEditorr . window [ 2 ], false )
guiSetVisible ( GUIEditorr . window [ 1 ], false )
addEvent ( "uruch1" , true )
addEventHandler ( "uruch1" , root ,
function( data )
guiSetVisible ( GUIEditorr . window [ 1 ], true )
showCursor ( true )
guiComboBoxClear ( GUIEditorr . combobox [ 1 ] )
for i , v in ipairs ( data ) do
guiComboBoxAddItem ( GUIEditorr . combobox [ 1 ], v )
end
end
)
function zatrudnij1 ()
guiSetVisible ( GUIEditorr . window [ 1 ], false )
guiSetVisible ( GUIEditorr . window [ 2 ], true )
guiGridListClear ( GUIEditorr . gridlist [ 1 ] )
for i , v in ipairs ( getElementsByType ( "player" )) do
local row = guiGridListAddRow ( GUIEditorr . gridlist [ 1 ] )
guiGridListSetItemText ( GUIEditorr . gridlist [ 1 ], row , 1 , getPlayerName ( v ), false , false )
end
end
addEventHandler ( "onClientGUIClick" , GUIEditorr . button [ 1 ], zatrudnij1 , false )
function Zamknij11 ()
guiSetVisible ( GUIEditorr . window [ 1 ], false )
showCursor ( false )
end
addEventHandler ( "onClientGUIClick" , GUIEditorr . button [ 4 ], Zamknij11 , false )
function Zamknij12 ()
guiSetVisible ( GUIEditorr . window [ 2 ], false )
showCursor ( false )
end
addEventHandler ( "onClientGUIClick" , GUIEditorr . button [ 7 ], Zamknij12 , false )
function Zamknij13 ()
guiSetVisible ( GUIEditorr . window [ 3 ], false )
showCursor ( false )
end
addEventHandler ( "onClientGUIClick" , GUIEditorr . button [ 10 ], Zamknij13 , false )
function zatrudnijPr1 ()
local row = guiGridListGetSelectedItem ( GUIEditorr . gridlist [ 1 ] )
if row ~= - 1 then
local name = guiGridListGetItemText ( GUIEditorr . gridlist [ 1 ], row , 1 )
if getPlayerFromName ( name ) then
guiSetVisible ( GUIEditorr . window [ 2 ], false )
showCursor ( false )
triggerServerEvent ( "zatrudnijPr1" , getLocalPlayer (), name )
else
outputChatBox ( "* Gracz nie istnieje." , 255 , 0 , 0 , true )
end
else
outputChatBox ( "* Wybierz gracza, ktorego chcesz zatrudnic." , 255 , 0 , 0 , true )
end
end
addEventHandler ( "onClientGUIClick" , GUIEditorr . button [ 6 ], zatrudnijPr1 , false )
function zwolnijPr1 ()
local name = guiGetText ( GUIEditorr . combobox [ 1 ] )
if name ~= "--Wybierz--" then
guiSetVisible ( GUIEditorr . window [ 1 ], false )
showCursor ( false )
triggerServerEvent ( "zwolnijPr1" , getLocalPlayer (), name )
else
outputChatBox ( "* Wybierz pracownika." , 255 , 0 , 0 )
end
end
addEventHandler ( "onClientGUIClick" , GUIEditorr . button [ 2 ], zwolnijPr1 , false )
function akceptuj1 ()
local name = guiGetText ( GUIEditorr . combobox [ 1 ] )
local name1 = guiGetText ( GUIEditorr . combobox [ 2 ] )
if name ~= "--Wybierz--" and name1 ~= "--Wybierz--" then
triggerServerEvent ( "AkceptujPr1" , getLocalPlayer (), name , name1 )
else
outputChatBox ( "* Wybierz pracownika i Stopnie?." , 255 , 0 , 0 )
end
end
addEventHandler ( "onClientGUIClick" , GUIEditorr . button [ 5 ], akceptuj1 , false )
function akceptuj11 ()
local name = guiGetText ( GUIEditorr . combobox [ 1 ] )
if name ~= "--Wybierz--" then
guiSetVisible ( GUIEditorr . window [ 1 ], false )
guiSetVisible ( GUIEditorr . window [ 3 ], true )
setElementData ( localPlayer , "Pra" , name )
else
outputChatBox ( "* Wybierz pracownika." , 255 , 0 , 0 )
end
end
addEventHandler ( "onClientGUIClick" , GUIEditorr . button [ 8 ], akceptuj11 , false )
function akceptuj12 ()
local nr = guiGetText ( GUIEditorr . edit [ 1 ] )
local data = guiGetText ( GUIEditorr . edit [ 2 ] )
local name = getElementData ( localPlayer , "Pra" )
triggerServerEvent ( "AkceptujPra" , getLocalPlayer (), name , nr , data )
end
addEventHandler ( "onClientGUIClick" , GUIEditorr . button [ 9 ], akceptuj12 , false )
SERVER
function uzupelnij1 ( player )
local accName = getAccountName ( getPlayerAccount ( player ) )
if accName == "adizygzak" then
local acl = aclGetGroup ( "zarzadPSP" )
local data = {}
for i , v in ipairs ( aclGroupListObjects ( acl )) do
if string . sub ( v , 1 , 5 ) == "user." then
local len = string . len ( v )
local name3 = string . sub ( v , 6 , len )
table . insert ( data , name3 )
end
end
triggerClientEvent ( player , "uruch1" , root , data )
end
end
addCommandHandler ( "general" , uzupelnij1 )
function zatrudnij1 ( name )
local ppl = getPlayerFromName ( name )
local ac = getPlayerAccount ( ppl )
local acname = getAccountName ( ac )
local acl12 = aclGetGroup ( "PSP" )
if acl12 then
aclGroupAddObject ( acl12 , "user." .. acname )
aclSave ()
aclReload ()
outputChatBox ( "#FF0036[#919191PSP#FF0036]#919191Gracz #FF0036" .. getPlayerName ( ppl ) .. " #919191zostal zatrudniony pod nazwa #FF0036" .. acname .. "#919191." , source , 255 , 255 , 255 , true )
outputChatBox ( "#FF0036[#919191PSP#FF0036]#919191Zostales zatrudniony do Pa?stwowej Stra?y Po?arnej!" , ppl , 255 , 255 , 255 , true )
end
end
addEvent ( "zatrudnijPr1" , true )
addEventHandler ( "zatrudnijPr1" , root , zatrudnij1 )
function za1 ( name , nr , data )
local names = getAccount ( name )
setAccountData ( names , "nrPol" , nr )
setAccountData ( names , "dataPol" , data )
outputChatBox ( "#FF0036[#919191PSP#FF0036]#919191Zmieni?e? Graczowi #FF0036" .. name .. " #919191Nr Legitymacji na: #FF0036" .. nr .. " #919191oraz date wa?no?ci legitymacji do: #FF0036" .. data .. "#919191." , source , 255 , 255 , 255 , true )
end
addEvent ( "AkceptujPra1" , true )
addEventHandler ( "AkceptujPra1" , root , za1 )
function zwolnij1 ( name )
local acl12 = aclGetGroup ( "PSP" )
if acl12 then
aclGroupRemoveObject ( acl12 , "user." .. name )
aclSave ()
aclReload ()
outputChatBox ( "#FF0036[#919191PSP#FF0036]#919191Gracz #FF0036" .. name .. " #919191zostal zwolniony." , source , 255 , 255 , 255 , true )
end
end
addEvent ( "zwolnijPr1" , true )
addEventHandler ( "zwolnijPr1" , getRootElement (), zwolnij1 )
function akceptuj1 ( name , ranga )
local acc = getAccount ( name )
if name then
setAccountData ( acc , "StopienPol" , ranga )
outputChatBox ( "#FF0036[#919191PSP#FF0036]#919191Zmieni?e? stopie? #FF0036" .. name .. "#919191 na#FF0036 " .. ranga .. "#919191." , source , 255 , 255 , 255 , true )
else
outputChatBox ( "#FF0036[#919191PSP#FF0036]#919191Gracza #FF0036" .. name .. "#919191 niema na serwerze." , source , 255 , 255 , 255 , true )
end
end
addEvent ( "AkceptujPr1" , true )
addEventHandler ( "AkceptujPr1" , getRootElement (), akceptuj1 )
DB3: https://imgur.com/a/auMNaMw