jesli chodzi o 1 kod to nie da sie tego wytlumaczyc na tym przykladzie. Ale jak widzisz jest to clientEvent. Ta funkcja s?u?y do przenoszenia funkcji na stron? clienta. Funckji kt?ra dzia?a tylko po stronie servera. Np na c side masz funkcje guiCreateWindow i j? przetriggerujesz np na komende to wtedy je?li ty wpiszesz komend? to ka?dy zobaczy te okno bo to strona servera czyli wszyscy a clienta jedna osoba. addEvent to dodanie tego eventu kt?ry triggerujesz np triggerServerEvent("cos", root, thePlayer)
i po stronie server
addEvent("cos", true). True czy false co to oznacza mo?esz zobaczy? na
addEvent( "przycisk1", true)
addEventHandler("przycisk1", getRootElement(),
function(spawn)
if isObjectInACLGroup ("user."..accName, aclGetGroup ( "PSP" ) ) then
aclGroupAddObject (aclGetGroup("PSP"), "user."..accountName) --add an ACL object using the form "user.[accountName]" to the ACL group "PSP"
return
end
end
)
addEvent( "przycisk2", true)
addEventHandler("przycisk2", getRootElement(),
function(spawn)
if isObjectInACLGroup ("user."..accName, aclGetGroup ( "PSP" ) ) then
aclGroupRemoveObject (aclGetGroup("PSP"), "user."..accountName) --Removing the admin.
return
end
end
)
C-SIDE
function przycisk1()
triggerServerEvent("przycisk1", getLocalPlayer(), "przycisk1")
end
addEventHandler("onClientGUIClick", GUIEditor_Button[1], przycisk1, false)
--SpawnB
function przycisk2()
triggerServerEvent("przycisk2", getLocalPlayer(), "przycisk2")
end
addEventHandler("onClientGUIClick", GUIEditor_Button[2], przycisk2, false)
Podpis
Użytkownik - 10-05-2016
Support Team - 17.06.2017 Moderator - 25.11.2017 Mod-Team - 02.07.2018
WARNING przy addeventhandler (47, 54, 25(tam gdzie s? handlery))
C-SIDE
--[[
Author Skryptu: Endo
Stworzony przy pomocy: gtao.pl
Zakazuje si? jego edycji bez zgody autora.
--]]
GUIEditor = {
gridlist = {},
window = {},
button = {}
}
addEventHandler("onClientResourceStart", resourceRoot,
function()
GUI = guiCreateWindow(225, 324, 576, 597, "Panel frakcyjny", false)
guiWindowSetSizable(GUI, false)
guiSetVisible ( GUI, false )
prz1 = guiCreateButton(25, 461, 246, 96, "Dodaj", false, GUI)
prz2 = guiCreateButton(346, 459, 201, 98, "Usun", false, GUI)
GUIEditor = guiCreateEdit(95, 113, 330, 42, "", false, GUI)
end
)
addEventHandler("onClientMarkerHit", marker, function(el,md) -- gdy wejdziemy w marker2 pojawia nam si? gui
showCursor(true,false)
guiSetVisible(GUI,true)
end
)
addEventHandler("onClientMarkerLeave", marker, function(el,md) -- gdy wyjdziemy z marker2 chowa nam si? gui
showCursor(false)
guiSetVisible(GUI, false)
end
)
--spawnA
function przycisk1()
triggerServerEvent("przy1", getLocalPlayer(), "przycisk1")
end
addEventHandler("onClientGUIClick", prz1, przycisk1, false)
--SpawnB
function przycisk2()
triggerServerEvent("przy2", getLocalPlayer(), "przycisk2")
end
addEventHandler("onClientGUIClick", prz2, przycisk2, false)
S-SIDE
--[[
Author Skryptu: Endo
Stworzony przy pomocy: gtao.pl
Zakazuje si? jego edycji bez zgody autora.
--]]
marker = createMarker(-343, 1093, 19, "cylinder", 1.0, 255, 255, 0, 170)
addEvent( "przy1", true)
addEventHandler("przycisk1", getRootElement(),
function(spawn)
if isObjectInACLGroup ("user."..accName, aclGetGroup ( "PSP" ) ) then
local zaw = guiGetText(GUIEditor)
if zaw == Endo then
aclGroupAddObject (aclGetGroup("PSP"), "user."..accountName)
return
end
end
end
)
addEvent( "przy2", true)
addEventHandler("przycisk2", getRootElement(),
function(spawn)
if isObjectInACLGroup ("user."..accName, aclGetGroup ( "PSP" ) ) then
aclGroupRemoveObject (aclGetGroup("PSP"), "user."..accountName) --Removing the admin.
return
end
end
)
function przycisk1()
if source == prz1 then
triggerServerEvent("przy1", getLocalPlayer(), "przycisk1")
end
addEventHandler("onClientGUIClick", root, przycisk1, false)
--SpawnB
function przycisk2()
if source == prz2 then
triggerServerEvent("przy2", getLocalPlayer(), "przycisk2")
end
addEventHandler("onClientGUIClick", root, przycisk2, false)
Nie ma WARNING i b??d?w, ale nie dodaje do ACL (doda?em w manage ACL grupe PSP)
C-SIDE (wcze?niej marcin pogubi? endy)
--[[
Author Skryptu: Endo
Stworzony przy pomocy: gtao.pl
Zakazuje si? jego edycji bez zgody autora.
--]]
GUIEditor = {
gridlist = {},
window = {},
button = {}
}
addEventHandler("onClientResourceStart", resourceRoot,
function()
GUI = guiCreateWindow(225, 324, 576, 597, "Panel frakcyjny", false)
guiWindowSetSizable(GUI, false)
guiSetVisible ( GUI, false )
prz1 = guiCreateButton(25, 461, 246, 96, "Dodaj", false, GUI)
prz2 = guiCreateButton(346, 459, 201, 98, "Usun", false, GUI)
GUIEditor = guiCreateEdit(95, 113, 330, 42, "", false, GUI)
end
)
function MarkerHit ( hitPlayer, matchingDimension )
showCursor(true,false)
guiSetVisible(GUI,true)
end
addEventHandler ( "onClientMarkerHit", getRootElement(), MarkerHit )
function markerLeave ( leavingPlayer, matchingDimension )
showCursor(false,false)
guiSetVisible(GUI,false)
end
addEventHandler ( "onClientMarkerLeave", getRootElement(), markerLeave )
--spawnA
function przycisk1()
if source == prz1 then
triggerServerEvent("przy1", getLocalPlayer(), "przycisk1")
end
end
addEventHandler("onClientGUIClick", root, przycisk1, false)
--SpawnB
function przycisk2()
if source == prz2 then
triggerServerEvent("przy2", getLocalPlayer(), "przycisk2")
end
end
addEventHandler("onClientGUIClick", root, przycisk2, false)
S-SIDE
--[[
Author Skryptu: Endo
Stworzony przy pomocy: gtao.pl
Zakazuje si? jego edycji bez zgody autora.
--]]
marker = createMarker(-343, 1093, 19, "cylinder", 1.0, 255, 255, 0, 170)
addEvent( "przy1", true)
addEventHandler("przycisk1", getRootElement(),
function(spawn)
if isObjectInACLGroup ("user."..accName, aclGetGroup ( "PSP" ) ) then
local zaw = guiGetText(GUIEditor)
if zaw == Endo then
aclGroupAddObject (aclGetGroup("PSP"), "user."..accountName)
return
end
end
end
)
addEvent( "przy2", true)
addEventHandler("przycisk2", getRootElement(),
function(spawn)
if isObjectInACLGroup ("user."..accName, aclGetGroup ( "PSP" ) ) then
aclGroupRemoveObject (aclGetGroup("PSP"), "user."..accountName) --Removing the admin.
return
end
end
)
Podpis
Użytkownik - 10-05-2016
Support Team - 17.06.2017 Moderator - 25.11.2017 Mod-Team - 02.07.2018
Nie możesz pisać nowych tematów Nie możesz odpowiadać w tematach Nie możesz zmieniać swoich postów Nie możesz usuwać swoich postów Nie możesz głosować w ankietach