Wysłany: 2012-10-20, 10:05
pidbulxd
Wiek: 28 Na forum: 5230 dni Posty: 135
Nick w MP: Word
Piwa : 540
Witajcie, dzisiaj proboje zrobic panel policji. Wszystko w panelu dziala, procz dania mandatu. A po wpisaniu /debugscript 3 wyskakuje bad argument @ takePlayerMoney
Oto serwer mojego panelu :
Kod: addEvent("mandat", true)
addEventHandler("mandat", getRootElement(), function(mandat, player)
local kasa = getPlayerFromName ( player )
takePlayerMoney (player,kasa, mandat)
end)
Prosz? o pomoc
Wysłany: 2012-10-20, 12:04
luki123luki123
Place Game
Wiek: 28 Na forum: 5275 dni Posty: 1948
Nick w MP: LuKiO
Piwa : 6101
addEvent ( "mandat" , true )
addEventHandler ( "mandat" , getRootElement (),
function ( mandat , player )
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 ( "Wystawi?e? " .. 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 ( "mandat" , getRootElement ())
end
end
end )
Wysłany: 2012-10-20, 13:58
Piorun
Wiek: 32 Na forum: 6712 dni Posty: 1837
Nick w MP: Piorun
Piwa : 516
luki123luki123 , jak masz pomaga? to lepiej tego nie r?b .
Poza tym wszystkie b??dy (pr?cz 2 ostatnich) pochodz? ze strony klienta, wi?c prosi?bym o udost?pnienie kodu ?r?d?owego.
Wysłany: 2012-10-20, 14:02
pidbulxd
Wiek: 28 Na forum: 5230 dni Posty: 135
Nick w MP: Word
Piwa : 540
Dam calego klienta, prosze Kod: GUIEditor_Window = {}
GUIEditor_Button = {}
GUIEditor_Edit = {}
GUIEditor_Grid = {}
GUIEditor_Window[1] = guiCreateWindow(7,207,270,372,"Panel Policji",false)
guiSetAlpha(GUIEditor_Window[1],1)
guiWindowSetMovable(GUIEditor_Window[1],false)
guiWindowSetSizable(GUIEditor_Window[1],false)
GUIEditor_Grid[1] = guiCreateGridList(33,56,133,242,false,GUIEditor_Window[1])
guiGridListSetSelectionMode(GUIEditor_Grid[1],2)
kolumna = guiGridListAddColumn(GUIEditor_Grid[1],"Gracze",0.2)
guiSetAlpha(GUIEditor_Grid[1],1)
GUIEditor_Button[1] = guiCreateButton(159,326,96,37,"Wyjdz",false,GUIEditor_Window[1])
GUIEditor_Button[2] = guiCreateButton(191,58,59,51,"Score",false,GUIEditor_Window[1])
GUIEditor_Button[3] = guiCreateButton(191,118,59,54,"Mandat",false,GUIEditor_Window[1])
GUIEditor_Edit[1] = guiCreateEdit(30,325,116,36,"",false,GUIEditor_Window[1])
guiEditSetMaxLength(GUIEditor_Edit[1],10)
guiSetVisible(GUIEditor_Window[1], false)
showCursor(false)
function show()
if getPlayerTeam(getLocalPlayer()) == getTeamFromName("Policja") then
guiGridListClear(GUIEditor_Grid[1])
for id, playeritem in ipairs(getElementsByType("player")) do
local row = guiGridListAddRow ( GUIEditor_Grid[1] )
guiGridListSetItemText ( GUIEditor_Grid[1], row, kolumna, getPlayerName ( playeritem ), false, false )
end
guiSetVisible(GUIEditor_Window[1], true)
showCursor(true)
end
end
function down ()
if (source == GUIEditor_Button[1]) then
guiSetVisible(GUIEditor_Window[1], false)
showCursor(false)
guiGridListClear(GUIEditor_Grid[1])
end
end
addEventHandler("onClientGUIClick", GUIEditor_Button[1], down)
function mandat()
local mandat = guiGetText(GUIEditor_Edit[1])
local player = guiGridListGetItemText (GUIEditor_Grid[1], guiGridListGetSelectedItem (GUIEditor_Grid[1]), 1)
triggerServerEvent("mandat", getRootElement(), mandat,player)
end
addEventHandler( "onClientGUIClick", GUIEditor_Button[3], mandat )
addCommandHandler("polip", show)
addCommandHandler("polipx", close)
Wysłany: 2012-10-20, 22:33
Riot
3X
Wiek: 29 Na forum: 5729 dni Posty: 1123
Nick w MP: Riot/3X
Piwa : 286
addEvent ( "mandat" , true )
addEventHandler ( "mandat" , getRootElement (), function( mandat , player )
local kasa = getPlayerFromName ( player )
takePlayerMoney ( kasa , tonumber ( mandat ))
end )
Wysłany: 2012-10-21, 00:28
pidbulxd
Wiek: 28 Na forum: 5230 dni Posty: 135
Nick w MP: Word
Piwa : 540
Ziomek11 , dzi?ki, wszystko dziala . Mo?ecie da? funkcje na score ?
Edit.Zrobi?em na score tak:
addEvent ( "score" , true )
addEventHandler ( "score" , getRootElement (), function( mandat , player )
local dajscore = getPlayerFromName ( player )
getElementData ( dajscore , tonumber ( score ))
end ) Lecz nie dzia?a ;/
Wysłany: 2012-10-21, 12:18
Riot
3X
Wiek: 29 Na forum: 5729 dni Posty: 1123
Nick w MP: Riot/3X
Piwa : 286
Wysłany: 2012-10-21, 12:32
pidbulxd
Wiek: 28 Na forum: 5230 dni Posty: 135
Nick w MP: Word
Piwa : 540
Ziomek11 , score na serwerze mam dodane, dzia?a normalnie. A co do tego panelu to m?g? by? mnie naprowadzi? na droge do zrobienia ? Jestem nowy w Lua, staram sie troche poduczyc, ale nie wiem jak zrobic to co mi wyslales
Wysłany: 2012-10-21, 13:05
Riot
3X
Wiek: 29 Na forum: 5729 dni Posty: 1123
Nick w MP: Riot/3X
Piwa : 286
Musisz podes?a? kod co ustawia score, bym wiedzia? jak Ci pom?c. Je?li boisz si? ?e kto? si? potem "po?yczy" twojego kodu - wy?lij na PW.
[ Dodano : 2012-10-21, 13:51 ]
Kod z marmata mog?e? tu da?
addEvent ( "score" , true )
addEventHandler ( "score" , getRootElement (), function( mandat , player )
local dajscore = getPlayerFromName ( player )
local score = tonumber ( getElementData ( dajscore , "Score" )
setElementData ( dajscore , "Score" , score - tonumber ( mandat ))
end )
Wysłany: 2012-10-21, 15:13
pidbulxd
Wiek: 28 Na forum: 5230 dni Posty: 135
Nick w MP: Word
Piwa : 540
Ziomek11 ,
addEvent ( "mandat" , true )
addEventHandler ( "mandat" , getRootElement (), function( mandat , player )
local kasa = getPlayerFromName ( player )
takePlayerMoney ( kasa , tonumber ( mandat ))
end
end
addEvent ( "score" , true )
addEventHandler ( "score" , getRootElement (), function( mandat , player )
local dajscore = getPlayerFromName ( player )
local score = tonumber ( getElementData ( dajscore , "Score" )
setElementData ( dajscore , "Score" , score - tonumber ( mandat ))
end ) Zrobilem tak i nie dziala teraz wog?le ;/
Wysłany: 2012-10-21, 15:19
Jacob
Głupiomądry
Wiek: 28 Na forum: 5502 dni Posty: 967
Nick w MP: Jacob
Piwa : 786
pidbulxd , a client, gdzie wywo?uje event "score"?
Wysłany: 2012-10-21, 15:19
Riot
3X
Wiek: 29 Na forum: 5729 dni Posty: 1123
Nick w MP: Riot/3X
Piwa : 286
Co? debugscript pokazuje?
Wysłany: 2012-10-21, 16:15
pidbulxd
Wiek: 28 Na forum: 5230 dni Posty: 135
Nick w MP: Word
Piwa : 540
Ziomek11 ,
Jacob , GUIEditor_Window = {}
GUIEditor_Button = {}
GUIEditor_Edit = {}
GUIEditor_Grid = {}
GUIEditor_Window [ 1 ] = guiCreateWindow ( 7 , 207 , 270 , 372 , "Panel Policji" , false )
guiSetAlpha ( GUIEditor_Window [ 1 ], 1 )
guiWindowSetMovable ( GUIEditor_Window [ 1 ], false )
guiWindowSetSizable ( GUIEditor_Window [ 1 ], false )
GUIEditor_Grid [ 1 ] = guiCreateGridList ( 33 , 56 , 133 , 242 , false , GUIEditor_Window [ 1 ])
guiGridListSetSelectionMode ( GUIEditor_Grid [ 1 ], 2 )
kolumna = guiGridListAddColumn ( GUIEditor_Grid [ 1 ], "Gracze" , 0.2 )
guiSetAlpha ( GUIEditor_Grid [ 1 ], 1 )
GUIEditor_Button [ 1 ] = guiCreateButton ( 159 , 326 , 96 , 37 , "Wyjdz" , false , GUIEditor_Window [ 1 ])
GUIEditor_Button [ 2 ] = guiCreateButton ( 191 , 58 , 59 , 51 , "Score" , false , GUIEditor_Window [ 1 ])
GUIEditor_Button [ 3 ] = guiCreateButton ( 191 , 118 , 59 , 54 , "Mandat" , false , GUIEditor_Window [ 1 ])
GUIEditor_Edit [ 1 ] = guiCreateEdit ( 30 , 325 , 116 , 36 , "" , false , GUIEditor_Window [ 1 ])
guiEditSetMaxLength ( GUIEditor_Edit [ 1 ], 10 )
guiSetVisible ( GUIEditor_Window [ 1 ], false )
showCursor ( false )
function show ()
if getPlayerTeam ( getLocalPlayer ()) == getTeamFromName ( "Policja" ) then
guiGridListClear ( GUIEditor_Grid [ 1 ])
for id , playeritem in ipairs ( getElementsByType ( "player" )) do
local row = guiGridListAddRow ( GUIEditor_Grid [ 1 ] )
guiGridListSetItemText ( GUIEditor_Grid [ 1 ], row , kolumna , getPlayerName ( playeritem ), false , false )
end
guiSetVisible ( GUIEditor_Window [ 1 ], true )
showCursor ( true )
end
end
function down ()
if ( source == GUIEditor_Button [ 1 ]) then
guiSetVisible ( GUIEditor_Window [ 1 ], false )
showCursor ( false )
guiGridListClear ( GUIEditor_Grid [ 1 ])
end
end
addEventHandler ( "onClientGUIClick" , GUIEditor_Button [ 1 ], down )
function mandat ()
local mandat = guiGetText ( GUIEditor_Edit [ 1 ])
local player = guiGridListGetItemText ( GUIEditor_Grid [ 1 ], guiGridListGetSelectedItem ( GUIEditor_Grid [ 1 ]), 1 )
triggerServerEvent ( "mandat" , getRootElement (), mandat , player )
end
addEventHandler ( "onClientGUIClick" , GUIEditor_Button [ 3 ], mandat )
function score ()
local score = guiGetText ( GUIEditor_Edit [ 1 ])
local player = guiGridListGetItemText ( GUIEditor_Grid [ 1 ], guiGridListGetSelectedItem ( GUIEditor_Grid [ 1 ]), 1 )
triggerServerEvent ( "score" , getRootElement (), score , player )
end
addEventHandler ( "onClientGUIClick" , GUIEditor_Button [ 3 ], score )
addCommandHandler ( "polip" , show )
addCommandHandler ( "polipx" , close )
M?j client
[ Dodano : 2012-10-24, 16:46 ]
To jak, pomo?ecie ?
[ Dodano : 2012-10-25, 18:02 ]
Dopomo?ecie ?
Tagi: panel :: policji
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: