Jump to content

[HELP] TeamGui


Michcio

Recommended Posts

Hi! I have a guiteam script but it doesnt work! That are my files:

Client side:

team={}
---
team["Cywile"]="Cywile"
 
team["Policja"]="Policja"
 
team["Pogotowie"]="Pogotowie"
 
team["BP Ultimate"]="BP Ultimate" 
 
team["MZK"]="MZK"
 
team["Pomoc drogowa"]="Pomoc Drogowa"
 
team["SpeedTrans"]="SpeedTrans"
 
team["TransFender"]="TransFender"
 
team["Bud Logistic"]="Bud Logistic"
 
team["Rico Trans"]="Rico Trans"
 
team["TFC News"]="TFC News"  
---
----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,"Prace mozesz dostac piszac podanie na stronie serwera pod adresem:\n [url=http://www.tfcklan.feen.pl]http://www.tfcklan.feen.pl[/url] w dziale SERWER.\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]--
 
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,true) -- 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 side:

addEvent("setTeam",true)
acl={}
---
acl["Cywile"]="Cywile"
acl["Policja"]="Policja"
acl["Pogotowie"]="Pogotowie"
acl["BP Ultimate"]="BP"
acl["MZK"]="MZK"
acl["Pomoc Drogowa"]="PD"
acl["SpeedTrans"]="SpeedTrans"
acl["TransFender"]="TransFender"
acl["Bud Logistic"]="Bud"
acl["Rico Trans"]="Rico"
acl["TFC News"]="News"
---
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)

Please help me!

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...