Wysłany: 2015-10-03, 01:19
INVWHIL3
*Padawan Lua*
Wiek: 27 Na forum: 3968 dni Posty: 41
Nick w MP: LEURCEDICIUS
Piwa : 472
Mam lekko zmodyfikowany system prywatnych pojazd?w od PanaPrezesa .. gdy wystawiam ofert? sprzeda?y pojazdu nie wy?wietlaj? si? jego dane ani dane sprzedaj?cego.
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>$." , 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 .. "$." )
end )
Z g?ry dzi?kuje za pomoc
Wysłany: 2015-10-03, 14:30
jg2aviva1
Rusek :D
Wiek: 25 Na forum: 4134 dni Posty: 445
Nick w MP: _Wolfenstei[N]^.^
Piwa : 1033
Czyta?e? w og?le posty z tamtego tematu? Przecie? tam kto? podawa? ju? rozwi?zanie:
"piotr172" napisał/a :Podmien ca?y plik sprzedaz_s.lua na to.(ustaw sobie tylko 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 )
I to tyle
Podpis
GTAO Member: 2015-08-23, 14:26
Wysłany: 2015-10-03, 20:37
INVWHIL3
*Padawan Lua*
Wiek: 27 Na forum: 3968 dni Posty: 41
Nick w MP: LEURCEDICIUS
Piwa : 472
Dzi?ki,uhm g?upio mi ?e to przeoczy?em..
Tagi: nie :: pokazuje :: tablic :: bazy :: gui
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: