sasik12
Wiek: 26 Na forum: 3763 dni Posty: 182
Piwa : 7
Siemka . Jak zrobi? resp w wybranym miejscu po kupnie pojazdu gm ogrpg.
Salon
salon_s
local positionVehicles = {
--{ 'NAZWA' , ID , math . random ( 0 , 10 ), CENA , 2886.20 , 2257.11 , 10.75 , 359.36 , 359.93 , 43.58 },
-- CYGAN
{ 'Moonbeam' , 418 , math . random ( 51718 , 82719 ), math . random ( 3800 , 4000 ), 2235.03 , 2050.32 , 10.91 , 0.1 , 0.0 , 89.5 },
{ 'Walton' , 478 , math . random ( 51718 , 82719 ), math . random ( 3800 , 4000 ), 2235.07 , 2042.38 , 10.81 , 359.2 , 360.0 , 89.9 },
{ 'Sadler' , 543 , math . random ( 51718 , 82719 ), math . random ( 8800 , 9000 ), 2246.52 , 2042.51 , 10.64 , 359.0 , 0.0 , 269.8 },
{ 'Perennial' , 404 , math . random ( 51718 , 82719 ), math . random ( 3800 , 4000 ), 2235.24 , 2034.73 , 10.56 , 359.7 , 0.0 , 90.1 },
{ 'Manana' , 410 , math . random ( 51718 , 82719 ), math . random ( 4800 , 5000 ), 2246.01 , 2050.19 , 10.47 , 359.4 , 0.0 , 269.5 },
{ 'Nebula' , 516 , math . random ( 51718 , 82719 ), math . random ( 10000 , 10200 ), 2246.58 , 2034.83 , 10.65 , 360.0 , 0.0 , 269.9 },
{ 'Oceanic' , 467 , math . random ( 51718 , 82719 ), math . random ( 14800 , 15000 ), 2233.08 , 2063.76 , 10.56 , 0.0 , 0.0 , 179.9 },
{ 'Glendale' , 466 , math . random ( 51718 , 82719 ), math . random ( 11800 , 12000 ), 2241.49 , 2063.93 , 10.56 , 0.0 , 360.0 , 180.1 },
{ 'Bobcat' , 422 , math . random ( 51718 , 82719 ), math . random ( 13800 , 14000 ), 2249.84 , 2063.91 , 10.80 , 359.1 , 360.0 , 179.5 },
{ 'Picador' , 600 , math . random ( 31718 , 52719 ), math . random ( 19800 , 20000 ), 2258.31 , 2063.99 , 10.53 , 359.1 , 360.0 , 180.7 },
{ 'Vincent' , 540 , math . random ( 31718 , 52719 ), math . random ( 23000 , 23200 ), 2217.24 , 2059.46 , 10.68 , 359.72 , 360.00 , 270.37 },
{ 'Clover' , 542 , math . random ( 31718 , 52719 ), math . random ( 15000 , 15200 ), 2217.64 , 2052.34 , 10.56 , 0.04 , 360.00 , 269.17 },
{ 'Tampa' , 549 , math . random ( 31718 , 52719 ), math . random ( 16000 , 16200 ), 2217.35 , 2045.34 , 10.52 , 359.97 , 359.96 , 270.44 },
-- SALON TERENOWY
{ 'Huntley' , 579 , math . random ( 0 , 10 ), 250000 , 1999.33 , 2469.13 , 10.90 , 0.0 , 0.0 , 301.8 },
{ 'Mesa' , 500 , math . random ( 0 , 10 ), 60000 , 1999.33 , 2469.13 - 5 , 10.90 , 0.0 , 0.0 , 301.8 },
{ 'Journey' , 508 , math . random ( 0 , 10 ), 500000 , 1999.33 , 2469.13 - 10 , 10.90 , 0.0 , 0.0 , 301.8 },
{ 'Sandking' , 495 , math . random ( 0 , 10 ), 400000 , 1999.33 , 2469.13 - 15 , 10.90 , 0.0 , 0.0 , 301.8 },
{ 'Rancher' , 505 , math . random ( 0 , 10 ), 200000 , 1999.33 , 2469.13 - 20 , 10.90 , 0.0 , 0.0 , 301.8 },
{ 'Yosemite' , 554 , math . random ( 0 , 10 ), 150000 , 1999.33 , 2469.13 - 25 , 10.90 , 0.0 , 0.0 , 301.8 },
{ 'BF Injection' , 424 , math . random ( 0 , 10 ), 300000 , 2004.65 , 2442.80 , 10.49 , 360.0 , 0.0 , 5.4 , 0.0 , 0.0 , 301.8 },
{ 'Landstalker' , 400 , math . random ( 0 , 10 ), 50000 , 2008.88 , 2490.68 , 10.49 , 360.0 , 0.0 , 153.8 },
-- SALON LOWRIDER ? W
{ 'Savanna' , 567 , math . random ( 0 , 10 ), 320000 , 1990.48 , 2492.58 - 5 , 10.50 , 359.9 , 0.1 , 260.0 },
{ 'Voodoo' , 412 , math . random ( 0 , 10 ), 180000 , 1990.48 , 2487.58 - 8 , 10.49 , 359.9 , 0.1 , 260.0 },
{ 'Blade' , 536 , math . random ( 0 , 10 ), 350000 , 1990.48 , 2487.58 + 5 , 10.49 , 359.9 , 0.1 , 260.0 },
{ 'Tornado' , 576 , math . random ( 0 , 10 ), 100000 , 1990.48 , 2487.58 + 10 , 10.49 , 359.9 , 0.1 , 260.0 },
{ 'Broadway' , 575 , math . random ( 0 , 10 ), 200000 , 1990.48 , 2487.58 + 15 , 10.49 , 359.9 , 0.1 , 260.0 },
{ 'Remington' , 534 , math . random ( 0 , 10 ), 400000 , 1990.48 , 2487.58 + 20 , 10.49 , 359.9 , 0.1 , 260.0 },
{ 'Esperanto' , 419 , math . random ( 0 , 10 ), 150000 , 1996.03 , 2472.80 , 10.47 , 360.0 , 0.0 , 337.4 },
-- SALON NORMALNY
{ 'Premier' , 426 , math . random ( 0 , 10 ), 55000 , 1986.40 , 2473.71 , 10.55 , 360.0 , 0.1 , 299.0 },
{ 'Blista Compact' , 496 , math . random ( 0 , 10 ), 80000 , 1985.97 , 2478.03 , 10.56 , 360.0 , 0.1 , 299.4 },
{ 'Sunrise' , 550 , math . random ( 0 , 10 ), 30000 , 1985.97 , 2478.03 + 5 , 10.56 , 360.0 , 0.1 , 299.4 },
{ 'Buffalo' , 402 , math . random ( 0 , 10 ), 150000 , 1985.97 , 2478.03 + 10 , 10.56 , 360.0 , 0.1 , 299.4 },
{ 'Sabre' , 475 , math . random ( 0 , 10 ), 60000 , 1985.97 , 2478.03 + 15 , 10.56 , 360.0 , 0.1 , 299.4 },
{ 'Admiral' , 445 , math . random ( 0 , 10 ), 50000 , 2008.07 , 2460.70 , 10.52 , 360.0 , 0.0 , 100.0 },
{ 'Sentinel' , 405 , math . random ( 0 , 10 ), 50000 , 2008.18 , 2464.38 , 10.51 , 360.0 , 0.0 , 100.0 },
{ 'Phoenix' , 603 , math . random ( 0 , 10 ), 120000 , 2008.30 , 2468.46 , 10.48 , 360.0 , 0.0 , 100.0 },
{ 'Tahoma' , 566 , math . random ( 0 , 10 ), 45000 , 2008.90 , 2473.50 , 10.47 , 360.0 , 0.0 , 100.0 },
{ 'Majestic' , 517 , math . random ( 0 , 10 ), 25000 , 2009.17 , 2478.59 , 10.48 , 360.0 , 0.0 , 100.0 },
--{ 'Cadrona' , 527 , math . random ( 0 , 10 ), 40000 , },
-- SALON MOTOCYKLI
{ 'Freeway' , 463 , math . random ( 0 , 10 ), 90000 , 1847.03 , 2156.65 , 10.41 , 359.3 , 0.0 , 200.0 },
{ 'Wayfarer' , 586 , math . random ( 0 , 10 ), 120000 , 1849.42 , 2156.96 , 10.42 , 359.4 , 0.0 , 200.0 },
{ 'Sanchez' , 468 , math . random ( 0 , 10 ), 60000 , 1852.05 , 2157.05 , 10.41 , 359.3 , 0.0 , 200.0 },
{ 'BF-400' , 581 , math . random ( 0 , 10 ), 80000 , 1854.67 , 2157.06 , 10.41 , 359.3 , 0.0 , 200.0 },
{ 'PCJ-600' , 461 , math . random ( 0 , 10 ), 80000 , 1858.12 , 2157.06 , 10.41 , 359.3 , 0.0 , 200.0 },
{ 'Faggio' , 462 , math . random ( 0 , 10 ), 20000 , 1860.78 , 2157.03 , 10.41 , 359.3 , 0.0 , 200.0 },
{ 'Quad' , 471 , math . random ( 0 , 10 ), 35000 , 1863.46 , 2156.87 , 10.42 , 359.4 , 0.0 , 200.0 },
{ 'FCR-900' , 521 , math . random ( 0 , 10 ), 110000 , 1866.14 , 2157.00 , 10.41 , 359.3 , 0.0 , 200.0 },
-- SALON DOWNTOWN
{ 'Cheetah' , 415 , math . random ( 0 , 10 ), 450000 , 1896.49 , 2145.48 , 10.50 , 360.0 , 0.0 , 359.3 },
{ 'Elegy' , 562 , math . random ( 0 , 10 ), 350000 , 1891.87 , 2145.48 , 10.48 , 360.0 , 0.0 , 2.5 },
{ 'Sultan' , 560 , math . random ( 0 , 10 ), 400000 , 1887.88 , 2145.48 , 10.49 , 360.0 , 0.0 , 358.1 },
{ 'Bullet' , 541 , math . random ( 0 , 10 ), 650000 , 1882.65 , 2145.48 , 10.49 , 360.0 , 0.0 , 1.5 },
{ 'Infernus' , 411 , math . random ( 0 , 10 ), 1000000 , 1877.98 , 2145.48 , 10.52 , 360.0 , 0.0 , 5.9 },
{ 'Comet' , 480 , math . random ( 0 , 10 ), 300000 , 1873.31 , 2145.48 , 10.52 , 360.0 , 0.0 , 359.7 },
{ 'Jester' , 559 , math . random ( 0 , 10 ), 220000 , 1868.88 , 2145.48 , 10.49 , 0.0 , 0.0 , 356.4 },
{ 'Turismo' , 451 , math . random ( 0 , 10 ), 850000 , 1866.73 , 2135.75 , 10.47 , 360.0 , 0.0 , 5.3 },
{ 'Super GT' , 506 , math . random ( 0 , 10 ), 400000 , 1863.10 , 2135.76 , 10.49 , 360.0 , 0.0 , 4.6 },
{ 'ZR-350' , 477 , math . random ( 0 , 10 ), 200000 , 1852.47 , 2135.75 , 10.48 , 360.0 , 0.0 , 1.8 },
{ 'Banshee' , 429 , math . random ( 0 , 10 ), 450000 , 1846.67 , 2135.81 , 10.49 , 360.0 , 0.0 , 356.8 },
}
for i , v in pairs ( positionVehicles ) do
local veh = createVehicle ( v [ 2 ], v [ 5 ], v [ 6 ], v [ 7 ], v [ 8 ], v [ 9 ], v [ 10 ], v [ 11 ])
setElementData ( veh , 'vehicle:desc' , 'Pojazd: ' .. v [ 1 ].. '\nCena: ' .. v [ 4 ].. ' PLN\nPrzebieg: ' .. v [ 3 ].. ' km' )
setVehicleOverrideLights ( veh , 1 )
setElementFrozen ( veh , true )
setVehicleColor ( veh , 255 , 255 , 255 )
setVehicleDamageProof ( veh , true )
setElementData ( veh , 'vehicle.selling' , true )
veh : setData ( 'vehsell:info' , {
[ 'cost' ]=( v [ 4 ]),
[ 'model' ]= v [ 2 ],
[ 'mileage' ]= v [ 3 ],
[ 'selling' ]= v [ 12 ]
}, false )
end
addEventHandler ( 'onVehicleEnter' , resourceRoot , function( plr , seat , jacked )
if seat ~= 0 then return end
if source : getData ( 'vehsell:info' ) and source : getData ( 'vehsell:info' ). selling == 1 then
triggerClientEvent ( plr , "addNotification" , root , "#cc0000Pojazd nie jest dost?pny w sprzeda?y!" , "error" )
return
end
local data = source : getData ( 'vehsell:info' )
if not data then return end
plr : setData ( 'vehsell:info' , {
[ 'cost' ]= data . cost ,
[ 'model' ]= data . model ,
[ 'mileage' ]= data . mileage ,
}, false )
triggerClientEvent ( plr , "addNotification" , root , "#00cc00Aby zakupi? ten pojazd wpisz #00cccc/zakup" , "error" )
end )
addEventHandler ( 'onVehicleExit' , resourceRoot , function( plr , seat , jacked )
if seat ~= 0 then return end
local data = plr : getData ( 'vehsell:info' )
if not data then return end
plr : removeData ( 'vehsell:info' )
end )
addCommandHandler ( 'zakup' , function( plr , cmd )
local data = plr : getData ( 'vehsell:info' )
if not data then return end
if getPlayerMoney ( plr ) < data . cost then
triggerClientEvent ( plr , "addNotification" , root , "#cc0000Nie posiadasz wystarczajacej kwoty pieni?dzy!" , "error" )
return
end
local vehicle = plr : getOccupiedVehicle ()
if vehicle then
removePedFromVehicle ( vehicle )
end
local cost = data . cost
local model = data . model
local mileage = data . mileage
local uid = getElementData ( plr , 'player:uid' ) or 0
takePlayerMoney ( plr , cost )
if mileage <= 100 then
exports [ "ogrpg-db" ]: dbSet ( "INSERT INTO ogrpg_vehicles (model,ownedPlayer,mileage,registered,parking) VALUES (?,?,?,?,1)" , model , getElementData ( plr , "player:uid" ), mileage , "false" )
else
exports [ "ogrpg-db" ]: dbSet ( "INSERT INTO ogrpg_vehicles (model,ownedPlayer,mileage,registered,parking) VALUES (?,?,?,?,1)" , model , getElementData ( plr , "player:uid" ), mileage , "true" )
end
triggerClientEvent ( plr , "addNotification" , root , string . format ( "#00cc00Zakupi?e? sw?j pojazd " .. getVehicleNameFromModel ( model ).. ", znajdziesz go w przechowywalni." ), "info" )
end )
Przecho
local markerek = createMarker ( 1961.44 , 2195.36 , 10.82 - 0.9 , "cylinder" , 6 , 200 , 25 , 25 , 75 )
local zoone = createColSphere ( 1961.44 , 2195.36 , 10.82 , 5 )
createBlipAttachedTo ( markerek , 35 )
local t = createElement ( "text" )
setElementData ( t , "scale" , 1 )
setElementData ( t , "name" , "Pozostawianie pojazd?w" )
setElementPosition ( t , 1961.44 , 2195.36 , 10.82 )
addEvent ( "onParkingGetRekords" , true )
addEventHandler ( "onParkingGetRekords" , root , function()
local uid = getElementData ( source , "player:uid" )
if not uid then return end
local org = getElementData ( source , "player:organization" )
local result = exports [ "ogrpg-db" ]: dbGet ( "SELECT * FROM ogrpg_vehicles WHERE (ownedPlayer=? OR ownedGroup=?) AND parking=1" , uid , org or "Brak" )
if #result > 0 then
triggerClientEvent ( source , "onParkingGetVehicles" , source , result )
end
end )
addEventHandler ( "onMarkerHit" , markerek , function( el , md )
if getElementType ( el ) == "player" then
local veh = getPedOccupiedVehicle ( el )
if not veh then return end
if getVehicleController ( veh ) ~= el then return end
local id = getElementData ( veh , "vehicle:id" )
if not id then return end
if isTimer ( timeroddania ) then return end
setElementFrozen ( veh , true )
exports [ "1" ]: outputNotificationBox ( el , " Pojazd wje?dza do przechowywalni..." )
toggleControl ( el , "enter_exit" , false )
timeroddania = setTimer (function()
exports [ "ogrpg-vehicles" ]: onSaveVehicle ( veh )
destroyElement ( veh )
exports [ "ogrpg-db" ]: dbSet ( "UPDATE ogrpg_vehicles SET parking=1 WHERE id=?" , id )
toggleControl ( el , "enter_exit" , true )
exports [ "1" ]: outputNotificationBox ( el , " Pojazd zosta? zapisany w przechowywalni." )
end , 3000 , 1 )
end
end )
addEvent ( "onParkingVehicleSpawn" , true )
addEventHandler ( "onParkingVehicleSpawn" , root , function( id )
if not id then return end
if #getElementsWithinColShape(zoone,"vehicle") >= 1 then
exports [ "1" ]: outputNotificationBox ( el , " Respawn zastaniony!!" )
return
end
local spawn = exports [ "ogrpg-vehicles" ]: onRespawnVehicles ( _ , id ,{ 1953.33 , 2196.43 , 10.51 , 360.0 , 360.0 , 182.3 })
if spawn then
end
end )
Za pomoc i
Podpis
Uczeń LUA . Mapper MTA.