Wysłany: 2015-06-29, 12:28
Given
Wiek: 31 Na forum: 4158 dni Posty: 31
Nick w MP: Given
Piwa : 1
Witam mam problem z tym skryptem na mandaty :
SERVER:
Kod: team = createTeam("Policja", 0, 0, 255)
addEvent("wystawM", true)
addEventHandler("wystawM", getRootElement(),
function (mandat, gracz)
local daj = getPlayerFromName(gracz)
if (daj) then
local money = getPlayerMoney(daj)
if (tonumber(money) < tonumber(mandat)) then
outputChatBox("Dany gracz posiada tylko #FF0000"..money.."$#FFFFFF. Nie starczy mu na mandat!", getRootElement(), 255, 255, 255, true)
else
takePlayerMoney(daj, mandat)
outputChatBox("Policjant wystawi? graczowi "..gracz.." mandat w wysoko?ci #00FF00"..mandat.."$#FFFFFF.", getRootElement(), 255, 255, 255, true)
outputChatBox("Otrzyma?e? mandat w wysoko?ci #00FF00"..mandat.."$#FFFFFF.", daj, 255, 255, 255, true)
triggerClientEvent("closeM", getRootElement())
end
end
end)
CLIENT
Kod:
mand_Window = {}
mand_Button = {}
mand_Label = {}
mand_Edit = {}
mand_Grid = {}
local x,y = guiGetScreenSize()
mand_Window[1] = guiCreateWindow((x-295)/2,(y-138)/2,295,138,"Wystaw mandat",false)
guiSetVisible(mand_Window[1], false)
mand_Label[3] = guiCreateLabel(9,23,274,42,"Wpisz ile ma mandat wynosi? dla gracza,\nkt?rego wybra?e?.",false,mand_Window[1])
guiLabelSetVerticalAlign(mand_Label[3],"center")
guiLabelSetHorizontalAlign(mand_Label[3],"center",false)
guiSetFont(mand_Label[3],"default-bold-small")
mand_Edit[1] = guiCreateEdit(10,73,271,27,"",false,mand_Window[1])
mand_Button[3] = guiCreateButton(77,107,60,20,"Wystaw",false,mand_Window[1])
mand_Button[4] = guiCreateButton(153,107,60,20,"Anuluj",false,mand_Window[1])
mand_Window[2] = guiCreateWindow((x-472)/2,(y-438)/2,472,438,"Panel Policji",false)
guiSetVisible(mand_Window[2], false)
mand_Grid[1] = guiCreateGridList(10,21,280,408,false,mand_Window[2])
guiGridListSetSelectionMode(mand_Grid[1],2)
local kolumna = guiGridListAddColumn(mand_Grid[1],"Gracze",0.9)
mand_Button[1] = guiCreateButton(298,162,163,43,"Mandat",false,mand_Window[2])
mand_Button[2] = guiCreateButton(298,214,163,43,"Wyjd?",false,mand_Window[2])
mand_Label[1] = guiCreateLabel(296,90,166,59,"Wybierz gracza, a nast?pnie\nwci?nij przycisk \"Mandat\",\naby go wystawi?.",false,mand_Window[2])
mand_Label[2] = guiCreateLabel(298,402,162,25,"",false,mand_Window[2])
guiLabelSetHorizontalAlign(mand_Label[2],"center",false)
guiSetFont(mand_Label[2],"default-bold-small")
guiLabelSetVerticalAlign(mand_Label[2],"center")
guiLabelSetHorizontalAlign(mand_Label[2],"center",false)
guiSetFont(mand_Label[2],"default-small")
bindKey("k", "down",
function ()
if (getPlayerTeam(getLocalPlayer()) == getTeamFromName("Policja")) then
if (guiGetVisible(mand_Window[2]) == false) then
showCursor(true)
guiSetVisible(mand_Window[2], true)
if (kolumna) then
for id, player in ipairs(getElementsByType("player")) do
local row = guiGridListAddRow(mand_Grid[1])
guiGridListSetItemText(mand_Grid[1], row, kolumna, getPlayerName(player), false, false)
end
end
else
guiSetVisible(mand_Window[2], false)
showCursor(false)
guiGridListClear(mand_Grid[1])
end
end
end)
function uwiez ()
if (source == mand_Button[1]) then
if (guiGridListGetItemText(mand_Grid[1], guiGridListGetSelectedItem(mand_Grid[1]), kolumna) ~= "") then
guiSetAlpha(mand_Window[2], 0.4)
guiMoveToBack(mand_Window[2])
guiSetVisible(mand_Window[1], true)
else
outputChatBox("Najpierw wybierz gracza, kt?remu chcesz wystawi? mandat!", 255, 0, 0, true)
end
end
end
addEventHandler("onClientGUIClick", mand_Button[1], uwiez)
function wyjdz ()
if (source == mand_Button[2]) then
guiSetVisible(mand_Window[2], false)
showCursor(false)
guiGridListClear(mand_Grid[1])
end
end
addEventHandler("onClientGUIClick", mand_Button[2], wyjdz)
function anuluj ()
if (source == mand_Button[4]) then
guiSetVisible(mand_Window[1], false)
guiSetAlpha(mand_Window[2], 0.8)
end
end
addEventHandler("onClientGUIClick", mand_Button[4], anuluj)
function wystaw ()
if (source == mand_Button[3]) then
local mandat = guiGetText(mand_Edit[1])
local gracz = guiGridListGetItemText(mand_Grid[1], guiGridListGetSelectedItem(mand_Grid[1]), kolumna)
if (mandat ~= "") then
if (tonumber(mandat)) then
triggerServerEvent("wystawM", getRootElement(), mandat, gracz)
else
outputChatBox("To co wpisa?e? musi by? liczb?!", 255, 0, 0, true)
end
else
outputChatBox("Musisz wpisa? warto?? mandatu!", 255, 0, 0, true)
end
end
end
addEventHandler("onClientGUIClick", mand_Button[3], wystaw)
addEvent("closeM", true)
addEventHandler("closeM", getRootElement(),
function ()
guiSetVisible(mand_Window[1], false)
guiSetAlpha(mand_Window[2], 0.8)
end)
Za pomoc daje
Wysłany: 2015-06-29, 12:29
Micles258
Uczeń lua
Wiek: 25 Na forum: 4008 dni Posty: 48
Piwa : 437
Wysłany: 2015-06-29, 12:34
Loop
Inspektor
Wiek: 27 Na forum: 4289 dni Posty: 311
Nick w MP: Inspektor
Piwa : 201
Wysłany: 2015-06-29, 12:45
Given
Wiek: 31 Na forum: 4158 dni Posty: 31
Nick w MP: Given
Piwa : 1
Oj bardzo przepraszam nie my?la?em co pisze chcia?em zrobi? ?eby to by?o na acl a nie na team ktos by mi mugl to przerobi? bo ja niestety troch? nie umiem prubowa?em to skrypt nawet si? nie w?ancza?.
Wysłany: 2015-06-29, 16:22
maciek3286
LUA Developer
Wiek: 26 Na forum: 5201 dni Posty: 230
Nick w MP: maciek00
Piwa : 3207
Musisz przenie?? poajwianie sie okna Triggerem na strone serwera poniewa? w clienicie nie dzia?aj? funkcje odpowiedzialne za sprawdzanie ACL.
Podpis
"Ludzie będą zawsze dla ciebie źli, jeżeli konieczność nie zmusi ich do tego, by byli dobrzy" ~~ Niccolò Machiavelli
Wysłany: 2015-06-30, 08:17
Given
Wiek: 31 Na forum: 4158 dni Posty: 31
Nick w MP: Given
Piwa : 1
Latwo mowic tylko ze niestety ja tego nie umiem zrobi?
Kto? by mi pom?g? to zrobi? ?
Wysłany: 2015-06-30, 08:23
MeeShuffle
Programista/Grafik
Wiek: 32 Na forum: 4395 dni Posty: 2758
Nick w MP: Shuffle
Piwa : 8575
Popracuj nad tymi funkcjami, nawet w osobnym kodzie, ?eby sobie po?wiczy?, ka?dy tak zaczyna? a do czego? dojdziesz, a nie prosi? na forum 40 razy
Tagi: skrypt :: acl
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: