Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2012-10-20, 10:05


pidbulxd







Wiek: 28
Na forum: 5230 dni
Posty: 135
Nick w MP: Word

Piwa: 540

Respekt: 60

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 :)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-10-20, 12:04


luki123luki123

Place Game






Wiek: 28
Na forum: 5275 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611


addEvent("mandat"true)
addEventHandler("mandat"getRootElement(),
function (mandatplayer) 
    local daj getPlayerFromName(gracz)
    if (dajthen
        local money getPlayerMoney(daj)
        if (tonumber(money) < tonumber(mandat)) then
            outputChatBox("Dany gracz posiada tylko #FF0000"..money.."$#FFFFFF. Nie starczy mu na mandat!"getRootElement(), 255255255true)
        else
            takePlayerMoney(dajmandat)
            outputChatBox("Wystawi?e? "..gracz.." mandat w wysoko?ci #00FF00"..mandat.."$#FFFFFF."getRootElement(), 255255255true)
            outputChatBox("Otrzyma?e? mandat w wysoko?ci #00FF00"..mandat.."$#FFFFFF."daj255255255true)
            triggerClientEvent("mandat"getRootElement())
        end
    end
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-10-20, 13:58


Piorun







Wiek: 32
Na forum: 6712 dni
Posty: 1837
Nick w MP: Piorun

Piwa: 516

Respekt: 480,7
Respekt: 480,7

luki123luki123, jak masz pomaga? to lepiej tego nie r?b :x .

Poza tym wszystkie b??dy (pr?cz 2 ostatnich) pochodz? ze strony klienta, wi?c prosi?bym o udost?pnienie kodu ?r?d?owego.

Podpis
Możesz mnie znaleźć na: Facebook
Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-10-20, 14:02


pidbulxd







Wiek: 28
Na forum: 5230 dni
Posty: 135
Nick w MP: Word

Piwa: 540

Respekt: 60

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)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-10-20, 22:33


Riot

3X






Wiek: 29
Na forum: 5729 dni
Posty: 1123
Nick w MP: Riot/3X

Piwa: 286

Respekt: 123
Respekt: 123

addEvent("mandat"trueaddEventHandler("mandat"getRootElement(), function(mandatplayerlocal kasa getPlayerFromName player takePlayerMoney (kasatonumber(mandat))
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-10-21, 00:28


pidbulxd







Wiek: 28
Na forum: 5230 dni
Posty: 135
Nick w MP: Word

Piwa: 540

Respekt: 60

Ziomek11, dzi?ki, wszystko dziala :) . Mo?ecie da? funkcje na score ?


Edit.Zrobi?em na score tak:

addEvent("score"trueaddEventHandler("score"getRootElement(), function(mandatplayerlocal dajscore getPlayerFromName player getElementData (dajscoretonumber(score))
end)
Lecz nie dzia?a ;/

Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-10-21, 12:18


Riot

3X






Wiek: 29
Na forum: 5729 dni
Posty: 1123
Nick w MP: Riot/3X

Piwa: 286

Respekt: 123
Respekt: 123

Dziwne by dzia?a?o :)

Score? Nie ma takich funkcji jak na pieni?dze na przyk?ad. Musisz zrobi? wszystko samemu. Zapisywanie gdy gracz wyjdzie z serwera, ustawianie jak wejdzie.


http://wiki.multitheftauto.com/wiki/SetAccountData - tutaj masz przyk?ad taki, na przypisywanie czego? do konta, dzi?ki czemu to si? zapisuje nam na sta?e - do lokalnej bazy danych serwera.
Poczytaj te?: http://wiki.multitheftauto.com/wiki/SetElementData oraz http://wiki.multitheftauto.com/wiki/GetElementData bo ?le to zrobi?e? :P

Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-10-21, 12:32


pidbulxd







Wiek: 28
Na forum: 5230 dni
Posty: 135
Nick w MP: Word

Piwa: 540

Respekt: 60

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 :)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-10-21, 13:05


Riot

3X






Wiek: 29
Na forum: 5729 dni
Posty: 1123
Nick w MP: Riot/3X

Piwa: 286

Respekt: 123
Respekt: 123

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? :D

addEvent("score"trueaddEventHandler("score"getRootElement(), function(mandatplayerlocal dajscore getPlayerFromName player local score tonumber(getElementData(dajscore"Score")
setElementData(dajscore"Score"score-tonumber(mandat))
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-10-21, 15:13


pidbulxd







Wiek: 28
Na forum: 5230 dni
Posty: 135
Nick w MP: Word

Piwa: 540

Respekt: 60

Ziomek11,

addEvent("mandat"trueaddEventHandler("mandat"getRootElement(), function(mandatplayerlocal kasa getPlayerFromName player takePlayerMoney (kasatonumber(mandat))
end
end

addEvent("score"trueaddEventHandler("score"getRootElement(), function(mandatplayerlocal dajscore getPlayerFromName player local score tonumber(getElementData(dajscore"Score")
setElementData(dajscore"Score"score-tonumber(mandat))
end)
Zrobilem tak i nie dziala teraz wog?le ;/

Postaw piwo autorowi tego posta
 

 
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

Respekt: 212,3
Respekt: 212,3Respekt: 212,3

pidbulxd, a client, gdzie wywo?uje event "score"?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-10-21, 15:19


Riot

3X






Wiek: 29
Na forum: 5729 dni
Posty: 1123
Nick w MP: Riot/3X

Piwa: 286

Respekt: 123
Respekt: 123

Co? debugscript pokazuje?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-10-21, 16:15


pidbulxd







Wiek: 28
Na forum: 5230 dni
Posty: 135
Nick w MP: Word

Piwa: 540

Respekt: 60

Ziomek11,

Jacob,
GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Edit = {} 
GUIEditor_Grid = {} 

GUIEditor_Window[1] = guiCreateWindow(7,207,270,372,"Panel Policji",falseguiSetAlpha(GUIEditor_Window[1],1guiWindowSetMovable(GUIEditor_Window[1],falseguiWindowSetSizable(GUIEditor_Window[1],falseGUIEditor_Grid[1] = guiCreateGridList(33,56,133,242,false,GUIEditor_Window[1]) 
guiGridListSetSelectionMode(GUIEditor_Grid[1],2kolumna guiGridListAddColumn(GUIEditor_Grid[1],"Gracze",0.2guiSetAlpha(GUIEditor_Grid[1],1GUIEditor_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],10guiSetVisible(GUIEditor_Window[1], falseshowCursor(false) 



function show() 
if getPlayerTeam(getLocalPlayer()) == getTeamFromName("Policja"then 
guiGridListClear(GUIEditor_Grid[1]) 
for idplayeritem in ipairs(getElementsByType("player")) do 
local row guiGridListAddRow GUIEditor_Grid[1] ) 
guiGridListSetItemText GUIEditor_Grid[1], rowkolumnagetPlayerName playeritem ), falsefalse end 
guiSetVisible(GUIEditor_Window[1], trueshowCursor(true)    
end 
end 

function down () 
if (source == GUIEditor_Button[1]) then 
guiSetVisible(GUIEditor_Window[1], falseshowCursor(falseguiGridListClear(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]), 1triggerServerEvent("mandat"getRootElement(), mandat,playerend 
addEventHandler"onClientGUIClick"GUIEditor_Button[3], mandat ) 

function score() 
local score guiGetText(GUIEditor_Edit[1]) 
local player guiGridListGetItemText (GUIEditor_Grid[1], guiGridListGetSelectedItem (GUIEditor_Grid[1]), 1triggerServerEvent("score"getRootElement(), score,playerend 
addEventHandler"onClientGUIClick"GUIEditor_Button[3], score addCommandHandler("polip"showaddCommandHandler("polipx"close)
M?j client

[ Dodano: 2012-10-24, 16:46 ]
To jak, pomo?ecie ? ;p

[ Dodano: 2012-10-25, 18:02 ]
Dopomo?ecie ?

Postaw piwo autorowi tego posta
 

 
Tagi: panel :: policji
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Panel Policji Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

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
Dodaj temat do Ulubionych
Wersja do druku