sylver
Wiek: 34 Na forum: 5807 dni Posty: 17
Witam znalaz?em skrypt na wyb?r team?w lecz po w??czeniu skryptu nie pokazuj? si? ?aden team
Client:
Kod: team={}
---
team["Cywile"]="Cywile"
team["Policja"]="Policja"
team["Pogotowie"]="Pogotowie"
team["Taxi"]="taxi "
team["Pomoc drogowa"]="Pomoc Drogowa "
team["AirTrans"]="AirTrans "
team["RicoTrans"]=" RicoTrans"
team["Speed Trans"]=" Speed Trans"
team["BPUltimate"]="BPUltimate"
---
----GUI----
win = guiCreateWindow(240,220,347,334,"Wybierz swoja prace!",false)
list = guiCreateGridList(11,22,125,300,false,win)
guiGridListSetSelectionMode(list,2)
column=guiGridListAddColumn(list,"Prace:",0.2)
pomoc = guiCreateButton(307,303,30,21,"?",false,win)
opis = guiCreateLabel(157,75,157,157,"Praca.",false,win)
guiLabelSetColor(opis,255,255,255)
guiLabelSetVerticalAlign(opis,"top")
guiLabelSetHorizontalAlign(opis,"left",false)
enter = guiCreateButton(155,35,166,25,"Wejdz do pracy",false,win)
--Help GUI--
help = guiCreateWindow(105,147,289,139,"Information",false)
exit = guiCreateButton(263,28,16,96,"E\nX\nI\nT",false,help)
tekst = guiCreateLabel(12,28,235,94,".\n Cywile to team dla tych ktorzy nie pracuja nigdzie",false,help)
guiLabelSetColor(tekst,255,255,255)
guiLabelSetVerticalAlign(tekst,"top")
guiLabelSetHorizontalAlign(tekst,"left",false)
--[GUI END]--
showCursor(true)
addEvent("open",true)
function openTeamWindow()
guiSetVisible(win,true)
showCursor(true)
guiGridListClear(list)
for k,v in pairs(getElementsByType("team")) do
local row=guiGridListAddRow ( list )
guiGridListSetItemText ( list, row, column, getTeamName(v) , false, false )
end
end
addEventHandler("open",getRootElement(),openTeamWindow)
function onClick()
---
if source == pomoc then
guiSetVisible(help,false) -- tu pokazuje sie okienko z informacj? gdzie sk?ada? podania
end
if source == exit then
guiSetVisible(help,false) -- tu wy??cza
end
---
if source == enter then
local id,col=guiGridListGetSelectedItem(list) --kolumna i numerek pozycji na liscie
local TeamName = guiGridListGetItemText ( list, row, col ) --tekst z pozycji w kolumnie
if getTeamFromName(TeamName) then -- jezeli istnieje taki team to..
triggerServerEvent("setTeam",getLocalPlayer(),TeamName)
guiSetVisible(win,false)
else
outputChatBox("SCRIPT ERROR: NO TEAM FOR LIST\nPLS REPORT THIS ERROR FOR ADMIN")--a je?eli nie to zg?asza widomo?? do gracza
end
end
---
if source == list then
local id,col=guiGridListGetSelectedItem(list)
local TeamName = guiGridListGetItemText ( list, row, col )
guiSetText(opis,TeamName .. " Policja " .. team[TeamName]) --example: Policja - ?apie przest?pc?w itp.
end
---
end
addEventHandler("onClientGUIClick",getRootElement(),onClick)
Server:
Kod: addEvent("setTeam",true)
acl={}
---
acl["Cywile"]="Cywile"
acl["Policja"]="Policja"
acl["Pogotowie"]="Pogotowie"
acl["Taxi"]="MZK"
acl["Pomoc Drogowa"]="Pomoc Drogowa"
acl["AirTrans"]="Bud"
acl["RicoTrans"]="Rico"
acl["Speed Trans"]="SpeedTrans"
acl["BPUltimate"]="BP"
---
function onSet(name)
if getTeamFromName(name) then
--
if name == "Cywile" then
setPlayerTeam(source, getTeamFromName(name) )
else
local acc=getPlayerAccount(source)
local nick=getAccountName(acc)
if isObjectInAclGrupe("user." .. nick ,aclGetGroup ( acl[name] ) ) then
setPlayerTeam(source,getTeamFromName(name) )
else
triggerClientEvent(source,"open",source)
outputChatBox("Nie nalezysz do tej pracy! Wybierz inna",source)
end
end
--
else
outputChatBox("Blad Skryptu zglos to Adminowi na FORUM!")
end
---
end
addEventHandler("setTeam",getRootElement(),onSet)
Mam jeszcze pytanie jak zrobi? aby okienko gui otwiera?o si? dopiero po wjechaniu w marker?