Wysłany: 2016-03-06, 10:01
FaydenFX.
Wiek: 27 Na forum: 4056 dni Posty: 246
Nick w MP: faydn
Piwa : 11
Witam , nie wy?wietla mi nicku , przebiegu oraz ceny pojazdu.
Kod:
Kod: guiku[2] = guiCreateLabel(10, 25, 280, 60, "Gracz <nick> zaproponowa? Ci kupno pojazdu prywatnego <nazwa> o przebiegu <przebieg> km za <cena> z?.", false, guiku[1])
Wysłany: 2016-03-06, 10:21
Emm
***** ***
Wiek: 32 Na forum: 3880 dni Posty: 3191
Nick w MP: Emm
Piwa : 6162
Administrator: Admin ma zawsze rację | REGULAMIN FORUM | REKLAMA/VIP | .
Nie masz tam dodanych zmiennych, np.
local przebieg = getElementData ( zmienna_auta , '"przebieg")
--reszta element dat na wz?r tej wy?ej (typu paliwo czy co tam chcesz)
guiku[2] = guiCreateLabel(10, 25, 280, 60, "Gracz".. getPlayerName(source).." zaproponowa? Ci kupno pojazdu prywatnego "..zmienna_auta.." o przebiegu ".. Zmienna_przebiegu.." km za "..Zmienna_ceny.." z?.", false, guiku[1])
Podpis
Użytkownik : 20.10.2015r
GTAO Member : 06.03.2016r
Support-Team : 20.01.2016r
Moderator : 30.03.2016r
Mod-Team : 08.10.2016r
Vice Admin : 04.05.2018r
Administrator : 03.05.2022r
[you]
! Koniecznie zapoznaj się z
regulaminem forum .
Pamiętaj, aby zawsze go przestrzegać, nie mniej ważne są również
regulaminy działów , w których się wypowiadasz!
Zamiast zakładać temat po kilka razy, bo jest usuwany przez
Administrację , przejrzyj regulamin i napisz poprawnie temat!
Sprawy z administracją możesz załatwiać anonimowo w
tym dziale .
Najważniejsze informacje od
Administracji możesz przeczytać
tutaj oraz
tutaj .
Wysłany: 2016-03-06, 10:25
FaydenFX.
Wiek: 27 Na forum: 4056 dni Posty: 246
Nick w MP: faydn
Piwa : 11
Zmienna auta? Czyli np. vehiclename?
Wysłany: 2016-03-06, 10:27
Emm
***** ***
Wiek: 32 Na forum: 3880 dni Posty: 3191
Nick w MP: Emm
Piwa : 6162
Administrator: Admin ma zawsze rację | REGULAMIN FORUM | REKLAMA/VIP | .
Podaj ca?y kod
Podpis
Użytkownik : 20.10.2015r
GTAO Member : 06.03.2016r
Support-Team : 20.01.2016r
Moderator : 30.03.2016r
Mod-Team : 08.10.2016r
Vice Admin : 04.05.2018r
Administrator : 03.05.2022r
[you]
! Koniecznie zapoznaj się z
regulaminem forum .
Pamiętaj, aby zawsze go przestrzegać, nie mniej ważne są również
regulaminy działów , w których się wypowiadasz!
Zamiast zakładać temat po kilka razy, bo jest usuwany przez
Administrację , przejrzyj regulamin i napisz poprawnie temat!
Sprawy z administracją możesz załatwiać anonimowo w
tym dziale .
Najważniejsze informacje od
Administracji możesz przeczytać
tutaj oraz
tutaj .
Wysłany: 2016-03-06, 10:31
FaydenFX.
Wiek: 27 Na forum: 4056 dni Posty: 246
Nick w MP: faydn
Piwa : 11
Kod: local sX, sY = guiGetScreenSize()
function createGUIGielda()
if not guig then
guig = {}
guig[1] = guiCreateWindow((sX - 350)/2, (sY - 360)/2, 350, 360, "Sprzeda? pojazdu", false)
guig[2] = guiCreateLabel(10, 23, 330, 40, "Wybierz z listy graczy, kt?rzy znajduj? si? w makerze tego, komu chcesz sprzeda? pojazd.", false, guig[1])
guiLabelSetHorizontalAlign(guig[2], "center", true)
guig[3] = guiCreateGridList(10, 60, 330, 250, false, guig[1])
guig[4] = guiGridListAddColumn(guig[3], "Gracze", 0.9)
guig[5] = guiCreateButton(10, 320, 80, 30, "Zamknij", false, guig[1])
guig[6] = guiCreateButton(260, 320, 80, 30, "Dalej", false, guig[1])
addEventHandler("onClientGUIClick", guig[5], onSprzedazClickZamknij, false)
addEventHandler("onClientGUIClick", guig[6], onSprzedazClickGraczeDalej, false)
--wybieranie pojazdu
guig[7] = guiCreateWindow((sX - 350)/2, (sY - 360)/2, 350, 360, "Sprzeda? pojazdu", false)
guig[8] = guiCreateLabel(10, 23, 330, 40, "Z listy pojazd?w wybierz pojazd, kt?ry chcesz sprzeda?", false, guig[7])
guiLabelSetHorizontalAlign(guig[8], "center", true)
guig[9] = guiCreateGridList(10, 60, 330, 250, false, guig[7])
guig[10] = guiGridListAddColumn(guig[9], "Twoje pojazdy", 0.9)
guig[11] = guiCreateButton(10, 320, 80, 30, "Zamknij", false, guig[7])
guig[12] = guiCreateButton(260, 320, 80, 30, "Dalej", false, guig[7])
addEventHandler("onClientGUIClick", guig[11], onSprzedazClickZamknij, false)
addEventHandler("onClientGUIClick", guig[12], onSprzedazClickPojazdyDalej, false)
--cena
guig[13] = guiCreateWindow((sX - 280)/2, (sY - 190)/2, 280, 190, "Sprzeda? pojazdu", false)
guig[14] = guiCreateLabel(10, 23, 260, 40, "Wpisz cen? pojazdu, za kt?r? chcesz sprzeda? Tw?j pojazd.", false, guig[13])
guiLabelSetHorizontalAlign(guig[14], "center", true)
guig[15] = guiCreateLabel(15, 75, 30, 20, "Cena:", false, guig[13])
guig[16] = guiCreateEdit(52, 71, 120, 30, "", false, guig[13])
guig[17] = guiCreateButton(10, 150, 80, 30, "Zamknij", false, guig[13])
guig[18] = guiCreateButton(190, 150, 80, 30, "Sprzedaj", false, guig[13])
addEventHandler("onClientGUIClick", guig[17], onSprzedazClickZamknij, false)
addEventHandler("onClientGUIClick", guig[18], onSprzedazClickSprzedaj, false)
end
guiSetVisible(guig[1], false)
guiSetVisible(guig[7], false)
guiSetVisible(guig[13], false)
guiGridListClear(guig[3])
guiGridListClear(guig[9])
guiSetText(guig[16], "")
showCursor(true)
end
addEvent("pokazGUISprzedazy", true)
addEventHandler("pokazGUISprzedazy", getRootElement(),
function(players)
createGUIGielda()
guiSetVisible(guig[1], true)
for i,v in pairs(players) do
--if v ~= localPlayer then
local row = guiGridListAddRow(guig[3])
guiGridListSetItemText(guig[3], row, guig[4], getPlayerName(v), false, false)
guiGridListSetItemData(guig[3], row, guig[4], v)
--end
end
end)
function onSprzedazClickZamknij()
savePLAYER = nil
saveVEHICLE = nil
guiSetVisible(guig[1], false)
guiSetVisible(guig[7], false)
guiSetVisible(guig[13], false)
showCursor(false)
end
function onSprzedazClickGraczeDalej()
local row, column = guiGridListGetSelectedItem(guig[3])
if row ~= -1 then
local player = guiGridListGetItemData(guig[3], row, guig[4])
if player then
savePLAYER = player
triggerServerEvent("pobierzListePojazdow", localPlayer, id)
end
end
end
--<< pojazdy >>--
addEvent("pokazListePojazdow", true)
addEventHandler("pokazListePojazdow", getRootElement(),
function(pojazdy)
guiSetVisible(guig[1], false)
guiSetVisible(guig[7], true)
for i,v in pairs(pojazdy) do
local row = guiGridListAddRow(guig[9])
guiGridListSetItemText(guig[9], row, guig[10], getVehicleNameFromModel(v["model"]), false, false)
guiGridListSetItemData(guig[9], row, guig[10], v["id"])
end
end)
function onSprzedazClickPojazdyDalej()
local row, column = guiGridListGetSelectedItem(guig[9])
if row ~= -1 then
local id = guiGridListGetItemData(guig[9], row, guig[10])
if id then
saveVEHICLE = id
guiSetVisible(guig[7], false)
guiSetVisible(guig[13], true)
guiSetText(guig[16], "")
end
end
end
--<< cena
function onSprzedazClickSprzedaj()
local cena = guiGetText(guig[16])
if #cena >= 1 then
local cena = tonumber(cena)
if type(cena) == "number" then
showCursor(false)
guiSetVisible(guig[13], false)
--
triggerServerEvent("zaproponujKupnoPojazdu", localPlayer, savePLAYER, saveVEHICLE, cena)
else
outputChatBox("Wpisz cen? za jak? chcesz sprzeda? sw?j pojazd.", 255, 255, 255, true)
end
end
end
--######## OFERTA KUPNA #########
function createGUIKupnoUzywanego()
if not guiku then
guiku = {}
guiku[1] = guiCreateWindow((sX - 300)/2, (sY - 150)/2, 300, 150, "Oferta kupna pojazdu", false)
guiku[2] = guiCreateLabel(10, 25, 280, 60, "Gracz <nick> zaproponowa? Ci kupno pojazdu prywatnego <nazwa> o przebiegu <przebieg> km za <cena> z?.", false, guiku[1])
guiLabelSetHorizontalAlign(guiku[2], "center", true)
guiku[3] = guiCreateButton(10, 110, 80, 30, "Odrzu?", false, guiku[1])
guiku[4] = guiCreateButton(210, 110, 80, 30, "Kup", false, guiku[1])
addEventHandler("onClientGUIClick", guiku[3], onOfertaKupnaOdrzuc, false)
addEventHandler("onClientGUIClick", guiku[4], onOfertaKupnaKup, false)
end
guiSetVisible(guiku[1], true)
showCursor(true)
end
addEvent("pokazOferteKupnaPojazdu", true)
addEventHandler("pokazOferteKupnaPojazdu", getRootElement(),
function(gracz, nazwa, cena, przebieg)
createGUIKupnoUzywanego()
guiSetText(guiku[2], "Gracz "..getPlayerName(gracz).." zaproponowa? Ci kupno pojazdu prywatnego "..nazwa.." o przebiegu "..przebieg.." km za "..cena.." z?.")
end)
function onOfertaKupnaZamknij()
guiSetVisible(guiku[1], false)
showCursor(false)
end
[code]function onOfertaKupnaOdrzuc()
onOfertaKupnaZamknij()
triggerServerEvent("odrzucOferteKupna", localPlayer)
end
function onOfertaKupnaKup()
onOfertaKupnaZamknij()
triggerServerEvent("przyjmijOferteKupna", localPlayer)
end[/code[/code]
Wysłany: 2016-03-06, 10:43
Dexnes_
Tiger
Wiek: 26 Na forum: 4401 dni Posty: 620
Nick w MP: Dexnes
Piwa : 1394
Pewien u?ytkownik poprawia? ju? ten kod :
Podmien ca?y plik sprzedaz_s.lua ,ustaw swoje kordy markeru)
local sprzedaz = createMarker ( 117.50697 , 1109.32739 , 13.60938 , "cylinder" , 2 , 255 , 0 , 0 , 100 )
function onSprzedazHit ( hitElement , dim )
if getElementType ( hitElement ) == "player" then
local players = getElementsInMarker ( sprzedaz )
triggerClientEvent ( hitElement , "pokazGUISprzedazy" , root , players )
end
end
addEventHandler ( "onMarkerHit" , sprzedaz , onSprzedazHit )
function getElementsInMarker ( marker )
elements = {}
for i , v in pairs ( getElementsByType ( "player" )) do
if isElementWithinMarker ( v , marker ) then
table . insert ( elements , v )
end
end
return elements
end
addEvent ( "pobierzListePojazdow" , true )
addEventHandler ( "pobierzListePojazdow" , getRootElement (),
function()
local account = getPlayerAccount ( source )
if account then
local wlasciciel = getAccountName ( account )
local query = dbQuery ( handler , "SELECT * FROM pojazdy WHERE wlasciciel='" .. wlasciciel .. "'" )
local result , num_rows , errormsg = dbPoll ( query , - 1 )
triggerClientEvent ( source , "pokazListePojazdow" , root , result )
end
end )
ofertyKupna = {}
addEvent ( "zaproponujKupnoPojazdu" , true )
addEventHandler ( "zaproponujKupnoPojazdu" , getRootElement (),
function( gracz , id , cena )
if not ofertyKupna [ gracz ] then
ofertyKupna [ gracz ] = {}
ofertyKupna [ gracz ] = { gracz , source , id , cena }
local query = dbQuery ( handler , "SELECT model,przebieg FROM pojazdy WHERE id='" .. id .. "'" )
local result , num_rows , errormsg = dbPoll ( query , - 1 )
local pojazd = result [ 1 ]. model
local pojazd = getVehicleNameFromModel ( pojazd )
local przebieg = result [ 1 ]. przebieg
triggerClientEvent ( gracz , "pokazOferteKupnaPojazdu" , root , source , pojazd , cena , przebieg )
else
outputChatBox ( "Ten gracz w tym momencie ma otwart? inn? ofert? kupna pojazdu..." , source , 255 , 255 , 255 , true )
end
end )
addEvent ( "odrzucOferteKupna" , true )
addEventHandler ( "odrzucOferteKupna" , getRootElement (),
function()
if ofertyKupna [ source ] then
local od_kogo_oferta = ofertyKupna [ source ][ 2 ]
if isElement ( od_kogo_oferta ) then
outputChatBox ( "Gracz " .. getPlayerName ( source ).. " odrzuci? Twoj? ofert? kupna pojazdu." , od_kogo_oferta , 255 , 255 , 255 , true )
end
ofertyKupna [ source ] = nil
end
end )
addEvent ( "przyjmijOferteKupna" , true )
addEventHandler ( "przyjmijOferteKupna" , getRootElement (),
function()
if ofertyKupna [ source ] then
local account = getPlayerAccount ( source )
if account then
local login = getAccountName ( account )
if 5 >= getYourVehicleCount ( login ) then
local od_kogo_oferta = ofertyKupna [ source ][ 2 ]
local veh = ofertyKupna [ source ][ 3 ] -- id pojazdu
local cena = ofertyKupna [ source ][ 4 ]
if isElement ( od_kogo_oferta ) then
local cena = tonumber ( cena )
if getPlayerMoney ( source ) >= cena then
takePlayerMoney ( source , cena )
givePlayerMoney ( od_kogo_oferta , cena )
-- nadpisanie danych
local vehicle = getVehicleByID ( veh )
ustawDanePojazdu ( vehicle , veh , login )
dbExec ( handler , "UPDATE pojazdy SET wlasciciel='" .. login .. "' WHERE id=" .. veh .. "" )
-- chat
local pojazd = getVehicleName ( vehicle )
outputChatBox ( "Gracz " .. getPlayerName ( source ).. " przyja? Twoj? ofert? i kupi? Tw?j pojazd " .. pojazd .. " za " .. cena .. "$." , od_kogo_oferta , 255 , 255 , 255 , true )
outputChatBox ( "Kupi?e? pojazd " .. pojazd .. " za " .. cena .. "$ od gracza " .. getPlayerName ( od_kogo_oferta ).. "." , source , 255 , 255 , 255 , true )
else
outputChatBox ( "Gracz " .. getPlayerName ( source ).. " nie ma wystarczaj?co pieni?dzy by kupi? Tw?j pojazd." , od_kogo_oferta , 255 , 255 , 255 , true )
outputChatBox ( "Nie masz wystarczaj?co pieni?dzy by kupi? ten pojazd." , source , 255 , 255 , 255 , true )
end
else
outputChatBox ( "Gracz kt?ry sk?ada? Ci ofert? nie jest ju? online na serwerze." , source , 255 , 255 , 255 , true )
end
else
outputChatBox ( "Mo?esz posiada? maksymalnie 5 pojazd?w." , source , 255 , 255 , 255 , true )
end
else
outputChatBox ( "Nie jeste? zalogowany." , source , 255 , 255 , 255 , true )
end
else
outputChatBox ( "Wyst?pi? b??d, nie mo?esz teraz kupi? pojazdu :|" , source , 255 , 255 , 255 , true )
end
ofertyKupna [ source ] = nil
end )
Wysłany: 2016-03-06, 10:48
FaydenFX.
Wiek: 27 Na forum: 4056 dni Posty: 246
Nick w MP: faydn
Piwa : 11
"BlackGamePL" napisał/a :Pewien u?ytkownik poprawia? ju? ten kod :
Podmien ca?y plik sprzedaz_s.lua ,ustaw swoje kordy markeru)
local sprzedaz = createMarker ( 117.50697 , 1109.32739 , 13.60938 , "cylinder" , 2 , 255 , 0 , 0 , 100 )
function onSprzedazHit ( hitElement , dim )
if getElementType ( hitElement ) == "player" then
local players = getElementsInMarker ( sprzedaz )
triggerClientEvent ( hitElement , "pokazGUISprzedazy" , root , players )
end
end
addEventHandler ( "onMarkerHit" , sprzedaz , onSprzedazHit )
function getElementsInMarker ( marker )
elements = {}
for i , v in pairs ( getElementsByType ( "player" )) do
if isElementWithinMarker ( v , marker ) then
table . insert ( elements , v )
end
end
return elements
end
addEvent ( "pobierzListePojazdow" , true )
addEventHandler ( "pobierzListePojazdow" , getRootElement (),
function()
local account = getPlayerAccount ( source )
if account then
local wlasciciel = getAccountName ( account )
local query = dbQuery ( handler , "SELECT * FROM pojazdy WHERE wlasciciel='" .. wlasciciel .. "'" )
local result , num_rows , errormsg = dbPoll ( query , - 1 )
triggerClientEvent ( source , "pokazListePojazdow" , root , result )
end
end )
ofertyKupna = {}
addEvent ( "zaproponujKupnoPojazdu" , true )
addEventHandler ( "zaproponujKupnoPojazdu" , getRootElement (),
function( gracz , id , cena )
if not ofertyKupna [ gracz ] then
ofertyKupna [ gracz ] = {}
ofertyKupna [ gracz ] = { gracz , source , id , cena }
local query = dbQuery ( handler , "SELECT model,przebieg FROM pojazdy WHERE id='" .. id .. "'" )
local result , num_rows , errormsg = dbPoll ( query , - 1 )
local pojazd = result [ 1 ]. model
local pojazd = getVehicleNameFromModel ( pojazd )
local przebieg = result [ 1 ]. przebieg
triggerClientEvent ( gracz , "pokazOferteKupnaPojazdu" , root , source , pojazd , cena , przebieg )
else
outputChatBox ( "Ten gracz w tym momencie ma otwart? inn? ofert? kupna pojazdu..." , source , 255 , 255 , 255 , true )
end
end )
addEvent ( "odrzucOferteKupna" , true )
addEventHandler ( "odrzucOferteKupna" , getRootElement (),
function()
if ofertyKupna [ source ] then
local od_kogo_oferta = ofertyKupna [ source ][ 2 ]
if isElement ( od_kogo_oferta ) then
outputChatBox ( "Gracz " .. getPlayerName ( source ).. " odrzuci? Twoj? ofert? kupna pojazdu." , od_kogo_oferta , 255 , 255 , 255 , true )
end
ofertyKupna [ source ] = nil
end
end )
addEvent ( "przyjmijOferteKupna" , true )
addEventHandler ( "przyjmijOferteKupna" , getRootElement (),
function()
if ofertyKupna [ source ] then
local account = getPlayerAccount ( source )
if account then
local login = getAccountName ( account )
if 5 >= getYourVehicleCount ( login ) then
local od_kogo_oferta = ofertyKupna [ source ][ 2 ]
local veh = ofertyKupna [ source ][ 3 ] -- id pojazdu
local cena = ofertyKupna [ source ][ 4 ]
if isElement ( od_kogo_oferta ) then
local cena = tonumber ( cena )
if getPlayerMoney ( source ) >= cena then
takePlayerMoney ( source , cena )
givePlayerMoney ( od_kogo_oferta , cena )
-- nadpisanie danych
local vehicle = getVehicleByID ( veh )
ustawDanePojazdu ( vehicle , veh , login )
dbExec ( handler , "UPDATE pojazdy SET wlasciciel='" .. login .. "' WHERE id=" .. veh .. "" )
-- chat
local pojazd = getVehicleName ( vehicle )
outputChatBox ( "Gracz " .. getPlayerName ( source ).. " przyja? Twoj? ofert? i kupi? Tw?j pojazd " .. pojazd .. " za " .. cena .. "$." , od_kogo_oferta , 255 , 255 , 255 , true )
outputChatBox ( "Kupi?e? pojazd " .. pojazd .. " za " .. cena .. "$ od gracza " .. getPlayerName ( od_kogo_oferta ).. "." , source , 255 , 255 , 255 , true )
else
outputChatBox ( "Gracz " .. getPlayerName ( source ).. " nie ma wystarczaj?co pieni?dzy by kupi? Tw?j pojazd." , od_kogo_oferta , 255 , 255 , 255 , true )
outputChatBox ( "Nie masz wystarczaj?co pieni?dzy by kupi? ten pojazd." , source , 255 , 255 , 255 , true )
end
else
outputChatBox ( "Gracz kt?ry sk?ada? Ci ofert? nie jest ju? online na serwerze." , source , 255 , 255 , 255 , true )
end
else
outputChatBox ( "Mo?esz posiada? maksymalnie 5 pojazd?w." , source , 255 , 255 , 255 , true )
end
else
outputChatBox ( "Nie jeste? zalogowany." , source , 255 , 255 , 255 , true )
end
else
outputChatBox ( "Wyst?pi? b??d, nie mo?esz teraz kupi? pojazdu :|" , source , 255 , 255 , 255 , true )
end
ofertyKupna [ source ] = nil
end )
Chodzi mi o inny plik z ofert? sprzeda?y..
Tagi: bug :: przy :: sprzedaży :: auta :: system :: aut :: pana :: prezesa.
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: