Wysłany: 2016-01-26, 21:21
PingwinekPlus
Uczeń Lua
Wiek: 35 Na forum: 3864 dni Posty: 79
Nick w MP: Offensywny.
Piwa : 396
Trzecim moim problemem jest Suszarka.
Rzecz jest w tym, ?e wysiadaj?c z auta ona przestaje dzia?a? i nie sprawdza kogo to pojazd tak jak powinna to robi?.
local sw , sh = guiGetScreenSize ()
function onSuszarka ( target )
if target then
if getElementType ( target ) == "vehicle" then
vehicle = target
end
end
end
addEventHandler ( "onClientPlayerTarget" , getRootElement (), onSuszarka )
function wlaczLPM ()
render = true
end
bindKey ( "mouse1" , "down" , wlaczLPM )
function wylaczLPM ()
render = false
end
bindKey ( "mouse1" , "up" , wylaczLPM )
function dxDrawSuszarkaInfo ()
if render then
if vehicle then
if isElement ( vehicle ) then
--if getPlayerTeam ( localPlayer ) == getTeamFromName ( "Policja" ) then -- zamiast Policja dowolna nazwa teamu , wazne by w cudzyslowiu ( i taki team faktycznie istnial : P )
if getPedWeapon ( localPlayer ) == 22 then
local x , y , z = getElementPosition ( localPlayer )
local tx , ty , tz = getElementPosition ( vehicle )
local dis = getDistanceBetweenPoints3D ( x , y , z , tx , ty , tz )
local id = getElementData ( vehicle , "car_id" ) or "Brak ID pojazdu"
local wl = getElementData ( vehicle , "car_owner" ) or "Brak W?a?cicela"
if 80 >= dis then -- jestesmy dosyc blisko gracza
local kmh = getVehicleSpeed ( vehicle )
dxDrawRectangle ( 1115 / 1440 * sw , 401 / 900 * sh , 290 / 1440 * sw , 219 / 900 * sh , tocolor ( 0 , 45 , 110 , 206 ), false )
dxDrawRectangle ( 1106 / 1440 * sw , 382 / 900 * sh , 309 / 1440 * sw , 19 / 900 * sh , tocolor ( 8 , 37 , 103 , 217 ), false )
dxDrawText ( "Suszarka Policji" , 1104 / 1438 * sw , 370 / 898 * sh , 1413 / 1438 * sw , 388 / 898 * sh , tocolor ( 255 , 255 , 255 , 255 ), 2.00 , "default-bold" , "center" , "center" , false , false , false , false , false )
dxDrawText ( "Pr?dko?? pojazdu: " .. kmh .. " km/h" , 1122 / 1440 * sw , 411 / 900 * sh , 1420 / 1440 * sw , 429 / 900 * sh , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "default-bold" , "left" , "center" , false , false , false , false , false )
dxDrawText ( "Nick w?a?ciciela: " .. wl .. "" , 1122 / 1440 * sw , 443 / 900 * sh , 1420 / 1440 * sw , 461 / 900 * sh , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "default-bold" , "left" , "center" , false , false , false , false , false )
dxDrawText ( "Nazwa pojazdu: " .. getVehicleName ( vehicle ).. "" , 1122 / 1440 * sw , 483 / 900 * sh , 1420 / 1440 * sw , 501 / 900 * sh , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "default-bold" , "left" , "center" , false , false , false , false , false )
local controller = getVehicleController ( vehicle )
if controller then
dxDrawText ( "ID gracza:" .. getElementData ( controller , "id" ).. " Nazwa Gracza:" .. getPlayerName ( controller ).. "" , 1122 / 1440 * sw , 528 / 900 * sh , 1420 / 1440 * sw , 547 / 900 * sh , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "default-bold" , "left" , "top" , false , false , false , false , false )
end
dxDrawText ( "ID pojazdu:" .. id .. "" , 1122 / 1440 * sw , 557 / 900 * sh , 1420 / 1440 * sw , 576 / 900 * sh , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "default-bold" , "left" , "top" , false , false , false , false , false )
-- dxDrawText ( "Co?............" , 1122 / 1440 * sw , 591 / 900 * sh , 1421 / 1440 * sw , 610 / 900 * sh , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "default-bold" , "left" , "top" , false , false , false , false , false )
end
end
-- end
end
end
end
if ( getKeyState ( "mouse1" ) == false ) then -- dodatkowa blokada
wylaczLPM ()
end
end
addEventHandler ( "onClientRender" , getRootElement (), dxDrawSuszarkaInfo )
function getVehicleSpeed ( element )
local vx , vy , vz = getElementVelocity ( element )
local speed = math . sqrt ( vx ^ 2 + vy ^ 2 + vz ^ 2 ) * 161
return math . floor ( speed )
end
Ta suszarka robiona jest pod System Pojazd?w PanaPrezes
[ Dodano : 2016-01-26, 21:33 ]
(chodzi o to by nie mo?na dawa? ofert na - minusie inaczej np: -1000
i graczowi kt?ry kupuje daje 1000 kasy xd jak temu zapobiec ?)
i w kt?rym momencie doda?
if getPlayerMoney ( cena ) > 0 and getPlayerMoney ( cena ) >= cena then
w tym kodzie:
local sprzedaz = createMarker ( 2132.64 , - 2091.34 , 13.55 , "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 199 >= 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 )
Podpis
@
[you]
Pomogłem? || Daj >>
Piweczko
i Respekta
Unikatowy serwer: OneLife! Gotowy w: # 62%
Serwer wam oddany! serwer został stworzony od graczy dla gracz
Wysłany: 2016-01-27, 10:12
TRIN
Młodzieniec
Wiek: 23 Na forum: 4205 dni Posty: 29
Nick w MP: GreeN
Piwa : 831
Suszarka nie dzia?a gdy? system PanaPrezesa nie jest pod MySQL Temu ci nie dzia?a.
Wysłany: 2016-01-27, 10:29
_Haze
Peace Yo!
Wiek: 24 Na forum: 4184 dni Posty: 1648
Nick w MP: Haze
Piwa : 2628
Trin jak czyta?em tw?j komentarz to dosta?em raka. Co do tematu system pana prezesa jest na sqlite. Ta linijk? z getPlayerMoney daj za getPlayerMoney w evencie przyjmij ofert? kupna. Co do 1 kodu nwm jak mo?na to zrobic ale odsy?am cie do zobaczenia skrypt?w na suszark? z gtao sam je pobiera? i wiem ze one s? naprawd? fajnie napisane mo?esz si? na nich wzorowa?.
Wysłany: 2016-01-27, 18:14
mlodasnygo
Wiek: 16 Na forum: 3973 dni Posty: 205
Piwa : 518
Odno?nie systemu pojazd?w
Znajd? to w sprzedaz_c.lua:
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
i zamie? na to:
function onSprzedazClickSprzedaj ()
local cena = guiGetText ( guig [ 16 ])
if #cena >= 1 then
local cena = tonumber ( cena )
if type ( cena ) == "number" then
if cena >= 1 then
showCursor ( false )
guiSetVisible ( guig [ 13 ], false )
--
triggerServerEvent ( "zaproponujKupnoPojazdu" , localPlayer , savePLAYER , saveVEHICLE , cena )
else
outputChatBox ( "Podana cena jest nie prawid?owa." , 255 , 255 , 255 , true )
end
else
outputChatBox ( "Wpisz cen? za jak? chcesz sprzeda? sw?j pojazd." , 255 , 255 , 255 , true )
end
end
end
ps mia?em ten sam problem, AteX mi pom?g?
Podpis
600 dni -
10 marca 2017
500 piw -
10 marca 2017
Tagi: nie :: odpowiednie :: działanie
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: