Tak w skr?cie zrobi?em gui w kt?rym b?dzie si? pokazywa? czy gracz ma prawo jazdy (i inne) czy nie (element data). Ale nie mog? tego sprawdzi?, bo podczas ?adowania skryptu wyskakuje b??d:= expected near ' (2 linijka)
Nie mam poj?cia o co z tym chodzi.I prosz? sprawd?cie te? czy dobrze zbudowa?em t? funkcje, bo nie jestem pewien. Ma ona dzia?a? tak.
Ja wpisuj? /dowod X i graczowi o nicku "X" pokazuje si? gui.
Przepraszam ?e dopiero teraz, ale by?em strasznie zaj?ty. Troch? poprzestawia?em i pokombinowa?em i pozby?em si? poprzedniego b??du, ale przeni?s? si? on gdzie indziej, mam jeszcze UTF-8 Ale to nie on blokuje skrypt.
Dopisz? jeszcze co? czego wcze?niej nie napisa?em. Po wpisaniu komedy otwiera si? 1-sze okno w kt?rym jest kr?tka informacja, i po klikni?ciu Buttonu[1] zamyka si? windows[1], a otwiera si? windows[2].
U?ywasz Notepad++? Zakladka Format > Koduj w UTF-8 (Bez BOOM). Ten b??d wyskakuje gdy u?yjesz polskich znak?w, b?dziesz je musia? sobie poprawi? bo wyskocz? Ci "krzaczki" (chyba ?e skopiujesz tre?? ca?ego pliku, zmienisz kodowanie i nadpiszesz, mniej roboty).
Mo?liwe ?e jak zmienisz kodowanie to i b??d zniknie.
Nie no b??d wyskakuje tu gdzie pokaza?em, mam stron? serewera i clienta = "Dowod.lua"
Pokarz? wszystko...
Client = Dowod.lua
GUIEditor_Window = {}
GUIEditor_Button = {}
GUIEditor_Label = {}
GUIEditor_Image = {}
GUIEditor_Label = {}
GUIEditor_Window[1] = guiCreateWindow(414,173,472,426,"",false)
guiSetVisible(GUIEditor_Window[1], false)
GUIEditor_Button[1] = guiCreateButton(0.7394,0.9108,0.2267,0.0681,"Otw??rz",true,GUIEditor_Window[1])
guiSetFont(GUIEditor_Button[1],"default-bold-small")
GUIEditor_Button[2] = guiCreateButton(0.0339,0.9108,0.2267,0.0681,"Wyjd??",true,GUIEditor_Window[1])
guiSetFont(GUIEditor_Button[2],"default-bold-small")
GUIEditor_Image[2] = guiCreateStaticImage(0.5127,0.0634,0.4534,0.8286,"dowod.png",true,GUIEditor_Window[1])
GUIEditor_Window[2] = guiCreateWindow(414,173,472,426,"",false)
guiSetVisible(GUIEditor_Window[2], false)
GUIEditor_Image[2] = guiCreateStaticImage(0.036,0.061,0.9301,0.8357,"dowodopen.png",true,GUIEditor_Window[2])
GUIEditor_Label[1] = guiCreateLabel(478,104,5,5,"",false,GUIEditor_Window[2])
guiSetVisible(GUIEditor_Label[1], false)
GUIEditor_Button[3] = guiCreateButton(0.7394,0.9108,0.2267,0.0681,"Wyjd??",true,GUIEditor_Window[2])
guiSetFont(GUIEditor_Button[1],"default-bold-small")
GUIEditor_Label[2] = guiCreateLabel(0.1441,0.1056,0.322,0.0352,"PRAWDZIWY",true,GUIEditor_Window[2])
guiLabelSetColor(GUIEditor_Label[2],0,0,0)
guiSetFont(GUIEditor_Label[2],"default-bold-small")
guiSetVisible(GUIEditor_Label[2], false)
GUIEditor_Label[20] = guiCreateLabel(0.1441,0.1056,0.322,0.0352,"FA??ÂSZYWY",true,GUIEditor_Window[2])
guiLabelSetColor(GUIEditor_Label[20],0,0,0)
guiSetFont(GUIEditor_Label[20],"default-bold-small")
GUIEditor_Label[3] = guiCreateLabel(0.2225,0.1831,0.322,0.0352,"POSIADA",true,GUIEditor_Window[2])
guiLabelSetColor(GUIEditor_Label[3],0,0,0)
guiSetVisible(GUIEditor_Label[20], false)
guiSetFont(GUIEditor_Label[3],"default-bold-small")
GUIEditor_Label[30] = guiCreateLabel(0.2225,0.1831,0.322,0.0352,"NIEPOSIADA",true,GUIEditor_Window[2])
guiLabelSetColor(GUIEditor_Label[30],0,0,0)
guiSetVisible(GUIEditor_Label[3], false)
guiSetFont(GUIEditor_Label[30],"default-bold-small")
guiSetVisible(GUIEditor_Label[30], false)
GUIEditor_Label[4] = guiCreateLabel(0.2225,0.27,0.322,0.0352,"POSIADA",true,GUIEditor_Window[2])
guiLabelSetColor(GUIEditor_Label[4],0,0,0)
guiSetFont(GUIEditor_Label[4],"default-bold-small")
guiSetVisible(GUIEditor_Label[4], false)
GUIEditor_Label[40] = guiCreateLabel(0.2225,0.27,0.322,0.0352,"NIEPOSIADA",true,GUIEditor_Window[2])
guiLabelSetColor(GUIEditor_Label[40],0,0,0)
guiSetFont(GUIEditor_Label[40],"default-bold-small")
guiSetVisible(GUIEditor_Label[40], false)
GUIEditor_Label[5] = guiCreateLabel(0.2225,0.3521,0.322,0.0352,"POSIADA",true,GUIEditor_Window[2])
guiLabelSetColor(GUIEditor_Label[5],0,0,0)
guiSetFont(GUIEditor_Label[5],"default-bold-small")
guiSetVisible(GUIEditor_Label[5], false)
GUIEditor_Label[50] = guiCreateLabel(0.2225,0.3521,0.322,0.0352,"NIEPOSIADA",true,GUIEditor_Window[2])
guiLabelSetColor(GUIEditor_Label[50],0,0,0)
guiSetFont(GUIEditor_Label[50],"default-bold-small")
guiSetVisible(GUIEditor_Label[50], false)
GUIEditor_Label[6] = guiCreateLabel(0.25,0.4366,0.322,0.0352,"POSIADA",true,GUIEditor_Window[2])
guiLabelSetColor(GUIEditor_Label[6],0,0,0)
guiSetFont(GUIEditor_Label[6],"default-bold-small")
guiSetVisible(GUIEditor_Label[6], false)
GUIEditor_Label[60] = guiCreateLabel(0.25,0.4366,0.322,0.0352,"NIEPOSIADA",true,GUIEditor_Window[2])
guiLabelSetColor(GUIEditor_Label[60],0,0,0)
guiSetFont(GUIEditor_Label[60],"default-bold-small")
guiSetVisible(GUIEditor_Label[60], false)
GUIEditor_Label[7] = guiCreateLabel(0.25,0.5047,0.322,0.0352,"POSIADA",true,GUIEditor_Window[2])
guiLabelSetColor(GUIEditor_Label[7],0,0,0)
guiSetFont(GUIEditor_Label[7],"default-bold-small")
guiSetVisible(GUIEditor_Label[7], false)
GUIEditor_Label[70] = guiCreateLabel(0.25,0.5047,0.322,0.0352,"NIEPOSIADA",true,GUIEditor_Window[2])
guiLabelSetColor(GUIEditor_Label[70],0,0,0)
guiSetFont(GUIEditor_Label[70],"default-bold-small")
guiSetVisible(GUIEditor_Label[70], false)
GUIEditor_Label[8] = guiCreateLabel(0.25,0.5822,0.322,0.0352,"POSIADA",true,GUIEditor_Window[2])
guiLabelSetColor(GUIEditor_Label[8],0,0,0)
guiSetFont(GUIEditor_Label[8],"default-bold-small")
guiSetVisible(GUIEditor_Label[8], false)
GUIEditor_Label[80] = guiCreateLabel(0.25,0.5822,0.322,0.0352,"NIEPOSIADA",true,GUIEditor_Window[2])
guiLabelSetColor(GUIEditor_Label[80],0,0,0)
guiSetFont(GUIEditor_Label[80],"default-bold-small")
guiSetVisible(GUIEditor_Label[80], false)
GUIEditor_Label[9] = guiCreateLabel(0.25,0.6573,0.322,0.0352,"POSIADA",true,GUIEditor_Window[2])
guiLabelSetColor(GUIEditor_Label[9],0,0,0)
guiSetFont(GUIEditor_Label[9],"default-bold-small")
guiSetVisible(GUIEditor_Label[9], false)
GUIEditor_Label[90] = guiCreateLabel(0.25,0.6573,0.322,0.0352,"NIEPOSIADA",true,GUIEditor_Window[2])
guiLabelSetColor(GUIEditor_Label[90],0,0,0)
guiSetFont(GUIEditor_Label[90],"default-bold-small")
guiSetVisible(GUIEditor_Label[90], false)
function Poka2 ()
  guiSetVisible(GUIEditor_Window[1], false)
  guiSetVisible(GUIEditor_Window[2], true)
 end
addEventHandler("onClientGUIClick", GUIEditor_Button[1], Poka2, false)
function pokaz()
guiSetVisible(GUIEditor_Window[1], true)
showCursor(true)
end
addEvent("pokazKomus", true)
addEventHandler("pokazKomus", getRootElement(), pokaz)
function wyjdz1 ()
  guiSetVisible(GUIEditor_Window[1], false)
  showCursor(false)
 end
addEventHandler("onClientGUIClick", GUIEditor_Button[2], wyjdz1, false)
function wyjdz2 ()
  guiSetVisible(GUIEditor_Window[2], false)
  showCursor(false)
 end
addEventHandler("onClientGUIClick", GUIEditor_Button[3], wyjdz2, false)
function s1 (player, cmd, sprawdz)
if sprawdz then
local data = getElementData(getPlayerFromName(sprawdz), "Prawo jazdy Kategorii A")
if data == true then
  guiSetVisible(GUIEditor_Label[3], true)Â
else
  guiSetVisible(GUIEditor_Label[30], true)
end
end
end
addEventHandler("onClientGUIClick", GUIEditor_Button[1], s1, false)
Server = "Serwer.lua"
function test(player, cmd, nick)
local gracz = getPlayerFromName(nick)
if gracz then
triggerClientEvent(gracz, "pokazKomus", getRootElement())
end
end
addCommandHandler("dowod", test)
Mam ju? gui, wy?wietla si? wszystko tak jak trzeba (To nie by? b??d z tymi znaczkami), ale ?le sprawdza element data. Wydaj? dobie prawo jazdy (bez b??d?w w debugu)
No i jak pr?buj? to sprawdzi? to zawsze wychodzi mi ?e nie mam prawa jazdy.
Pokarz? kody.
Cient, Wydawanie prawa:
function KatB()
local player = guiGridListGetItemText (GUIEditor_Grid[2], guiGridListGetSelectedItem (GUIEditor_Grid[2]), 1)
setElementData(getPlayerFromName(player), "Prawo jazdy Kategorii B", true)
outputChatBox("Wydales? Prawo Jazdy Kategorii B",player, 255, 200, 0, true )
end
addEventHandler( "onClientGUIClick", GUIEditor_Button[7], KatB, false)
Dow?d, Client:
function s2 (player, cmd, sprawdz)
if sprawdz then
local data = getElementData(getPlayerFromName(nick), "Prawo jazdy Kategorii B") -----B??d
if data == true then
guiSetVisible(GUIEditor_Label[4], true) -----posiada
else
guiSetVisible(GUIEditor_Label[40], true) -----Nie posiada
end
end
end
addEventHandler("onClientGUIClick", GUIEditor_Button[1], s2, false)
Dow?d, Server:
function test(player, cmd, nick)
local gracz = getPlayerFromName(nick)
if gracz then
triggerClientEvent(gracz, "pokazKomus", getRootElement())
end
end
addCommandHandler("dowod", test)
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