daybreakx3
Wiek: 27 Na forum: 2412 dni Posty: 11
Nick w MP: Daybreak
Piwa : 2
Witam mam prace sweepery i chcialbym ja przerobic by naliczala punkty na wodzie jako zlowione ryby za kazdym razem jak wszystko ustawiam to nie nalicza w wodzie ale na drodze juz tak... wie ktos moze jak to naprawic? bardzo bym byl wdzieczny pozdrawiam
Kod od strony serwera
local money = math . random ( 10000 , 11000 ) -- ile dostajesz za 1 kg
createBlip ( 1102.49 , - 1219.21 , 17.80 , 46 , 2 , 0 , 0 , 0 , 0 , 0 , 275 )
local code = "Sweepers" -- kod pracy
local jobOnline = true -- czy praca w ?? czona
local jobVehicles = { -- pozycj ? pojazd ? w
{ 574 , 1086.12 , - 1220.24 , 17.7 , 180.0 , 180.0 , 180.0 },
{ 574 , 1090.29 , - 1220.18 , 17.7 , 180.0 , 180.0 , 180.0 },
{ 574 , 1094.04 , - 1220.20 , 17.7 , 180.0 , 180.0 , 180.0 },
{ 574 , 1098.57 , - 1219.85 , 17.7 , 180.0 , 180.0 , 180.0 },
{ 574 , 1103.57 , - 1220.07 , 17.7 , 180.0 , 180.0 , 180.0 },
{ 574 , 1108.86 , - 1219.98 , 17.7 , 180.0 , 180.0 , 180.0 },
}
local text = createElement ( "text" )
setElementData ( text , "name" , "Punkt rozladowania" )
setElementPosition ( text , 800.52 , - 2097.87 , 1.77 )
for i , v in ipairs ( jobVehicles ) do
local veh = createVehicle ( v [ 1 ], v [ 2 ], v [ 3 ], v [ 4 ], v [ 5 ], v [ 6 ], v [ 7 ])
setVehicleRespawnPosition ( veh , v [ 2 ], v [ 3 ], v [ 4 ], v [ 5 ], v [ 6 ], v [ 7 ])
setElementData ( veh , "vehicle:desc" , "?owienie Ryb" )
setElementData ( veh , "vehicle:mileage" , math . random ( 1000 , 50000 ))
setElementData ( veh , "vehicle:fuel" , false )
setElementData ( veh , "vehicle:praca" , true )
setElementData ( veh , "vehicle:job" , code )
addVehicleSirens ( veh , 4 , 2 , false , true , true , true )
setVehicleSirens ( veh , 1 , 0.4 , 0.45 , 1.35 , 255 , 76.5 , 0 , 198.9 , 198.9 )
setVehicleSirens ( veh , 2 , - 0.4 , 0.45 , 1.35 , 255 , 76.5 , 0 , 200 , 200 )
setVehicleDamageProof ( veh , true )
toggleVehicleRespawn ( veh , true )
setVehicleIdleRespawnDelay ( veh , 30000 )
setElementFrozen ( veh , true )
end
addEventHandler ( "onVehicleStartEnter" , resourceRoot , function( plr , seat )
if seat ~= 0 then cancelEvent () return end
if getElementData ( source , "wuzyciu" ) then cancelEvent () return end
if jobOnline == false then
outputChatBox ( "* Praca jest wy??czona." , plr , 255 , 0 , 0 )
cancelEvent ()
return
end
if getElementData ( plr , "player:job" ) then
exports . rpg_noti : createNotification ( plr , "x" , "Ju? posiadasz aktywn? prac?!" )
cancelEvent ()
return
end
q = exports [ "ogrpg-db" ]: dbGet ( "select pkt,ulepszenia from PSSM_KUTRY where uid=? limit 1" , getElementData ( plr , "player:uid" ))
if( #q<1) then
exports [ "ogrpg-db" ]: dbSet ( "insert into PSSM_KUTRY (uid) values(?)" , getElementData ( plr , "player:uid" ))
cancelEvent ()
return
end
end )
addEventHandler ( "onVehicleExit" , resourceRoot , function( plr , seat )
if seat ~= 0 then return end
setElementData ( source , "vehicle:desc" , "?owienie Ryb" )
setElementData ( plr , "player:job" , false )
setElementData ( source , "wuzyciu" , false )
setElementData ( plr , "pojazdSweepery" , false )
setVehicleSirensOn ( source , false )
end )
addEventHandler ( "onVehicleEnter" , resourceRoot , function( plr , seat )
if seat ~= 0 then return end
-- q = exports [ "ogrpg-db" ]: dbGet ( "select pkt,ulepszenia from PSSM_KUTRY where uid=? limit 1" , getElementData ( plr , "player:uid" ))
--if( #q<1) then
-- exports [ "ogrpg-db" ]: dbSet ( "insert into PSSM_KUTRY (uid) values(?)" , getElementData ( plr , "player:uid" ))
-- end
--if( #q==1) then
-- triggerClientEvent ( plr , "kutrypunkty" , plr , q [ 1 ]. pkt , tostring ( q [ 1 ]. ulepszenia ))
-- end
triggerClientEvent ( plr , "kutrypunkty" , plr , q [ 1 ]. pkt , tostring ( q [ 1 ]. ulepszenia ))
setElementFrozen ( source , false )
setVehicleDamageProof ( source , false )
setVehicleSirensOn ( source , true )
setElementData ( source , "wuzyciu" , true )
setElementData ( plr , "pojazdSweepery" , source )
setElementData ( source , "vehicle:trash" , 0 )
setElementData ( plr , "player:job" , code )
exports . rpg_noti : createNotification ( plr , "x" , "Rozpoczo?e?(a?) prac?!" )
local result = exports [ "ogrpg-db" ]: dbGet ( "select * from PSSM_KUTRY where uid=? limit 1" , getElementData ( plr , "player:uid" ))
uleps = split ( tostring ( result [ 1 ]. ulepszenia ), "," )
if uleps [ 1 ] == "1" then
exports . rpg_noti : createNotification ( plr , "x" , "Tw?j limit ?mieci wynosi 70 KG!" )
else
exports . rpg_noti : createNotification ( plr , "x" , "Tw?j limit ?mieci wynosi 25 KG!" )
end
end )
addEventHandler ( "onVehicleRespawn" , resourceRoot , function()
veh = source
setElementData ( veh , "vehicle:desc" , "Czyszczenie ulic" )
setElementData ( veh , "vehicle:mileage" , math . random ( 1000 , 50000 ))
setElementData ( veh , "vehicle:fuel" , 100 )
setElementData ( source , "vehicle:trash" , 0 )
setElementData ( source , "wuzyciu" , false )
setVehicleSirensOn ( source , false )
setElementFrozen ( veh , true )
setVehicleDamageProof ( veh , true )
setVehicleOverrideLights ( veh , 1 )
end )
addEventHandler ( "onResourceStop" , resourceRoot , function()
for i , v in ipairs ( getElementsByType ( "player" )) do
if getElementData ( v , "player:job" )== code then
setElementData ( v , "player:job" , false )
end
end
end , false , "high" )
addEvent ( "rozladuj" , true )
addEventHandler ( "rozladuj" , root ,function( smiecie )
local result = exports [ "ogrpg-db" ]: dbGet ( "select * from PSSM_KUTRY where uid=? limit 1" , getElementData ( client , "player:uid" ))
ulepy = split ( tostring ( result [ 1 ]. ulepszenia ), "," )
if ulepy [ 2 ] == "1" and ulepy [ 3 ] == "1" then
cash = tonumber ( smiecie )* money * 1.15
elseif ulepy [ 2 ] == "1" then
cash = tonumber ( smiecie )* money * 1.05
elseif ulepy [ 3 ] == "1" then
cash = tonumber ( smiecie )* money * 1.10
elseif ulepy [ 2 ] == "0" or ulepy [ 3 ] == "0" then
cash = tonumber ( smiecie )* money
end
local m = cash
local pm = cash * 1.3
punkciki = tonumber ( smiecie )
local ajdi = getElementData ( client , "player:uid" )
if getElementData ( client , "player:premium" ) then
outputChatBox ( "#ffd700[Premium] #ffffffRozladowa?e? zbiornik ?mieci, za prac? otrzymujesz#66cc00 " .. string . format ( "%.2f" , pm / 100 ).. " PLN." , client , 255 , 255 , 255 , true )
givePlayerMoney ( client , pm )
exports [ 'ogrpg-db' ]: dbSet ( "UPDATE ogrpg_users SET punkty_kutry=punkty_kutry+? WHERE id=?" , punkciki , ajdi )
exports [ 'ogrpg-db' ]: dbSet ( "UPDATE PSSM_KUTRY SET pkt=pkt+? WHERE uid=?" , punkciki , ajdi )
else
outputChatBox ( "#ffffffRozladowa?e? zbiornik ?mieci, za prac? otrzymujesz#66cc00 " .. string . format ( "%.2f" , m / 100 ).. " PLN." , client , 255 , 255 , 255 , true )
givePlayerMoney ( client , m )
exports [ 'ogrpg-db' ]: dbSet ( "UPDATE ogrpg_users SET punkty_kutry=punkty_kutry+? WHERE id=?" , punkciki , ajdi )
exports [ 'ogrpg-db' ]: dbSet ( "UPDATE PSSM_KUTRY SET pkt=pkt+? WHERE uid=?" , punkciki , ajdi )
end
triggerClientEvent ( client , "zerowaniesmieci" , client )
setElementData ( getPedOccupiedVehicle ( client ), "vehicle:trash" , 0.00 )
end )
addEvent ( "kupulepszenie" , true )
addEventHandler ( "kupulepszenie" , root ,function( koszt , n )
q2 = exports [ "ogrpg-db" ]: dbGet ( "select * from PSSM_KUTRY where uid=? limit 1" , getElementData ( client , "player:uid" ))
if ( #q2<1) then cancelEvent() return end
takePlayerMoney ( client , koszt )
upgrds = split ( tostring ( q2 [ 1 ]. ulepszenia ), "," )
if n == 1 then
str = "1," .. upgrds [ 2 ].. "," .. upgrds [ 3 ].. "," .. upgrds [ 4 ]
elseif n == 2 then
str = upgrds [ 1 ].. ",1," .. upgrds [ 3 ].. "," .. upgrds [ 4 ]
elseif n == 3 then
str = upgrds [ 1 ].. "," .. upgrds [ 2 ].. ",1," .. upgrds [ 4 ]
elseif n == 4 then
str = upgrds [ 1 ].. "," .. upgrds [ 2 ].. "," .. upgrds [ 3 ].. ",1"
end
exports [ "ogrpg-db" ]: dbSet ( "update PSSM_KUTRY set pkt=pkt-100, ulepszenia=? where uid=?" , str , getElementData ( client , "player:uid" ))
outputChatBox ( "Pomy?lnie zakupi?e? ulepszenie!" , client , 0 , 255 , 0 )
end )
addEventHandler ( "onElementDestroy" , resourceRoot , function()
local type = getElementType ( source )
if type == "vehicle" then
cancelEvent ()
end
end )
addEventHandler ( "onPlayerQuit" , root , function()
local pojazd = getElementData ( source , "pojazdSweepery" )
if not pojazd then return end
setVehicleIdleRespawnDelay ( pojazd , 30000 )
setElementData ( source , "pojazdSweepery" , false )
end )
kod od strony clienta
local czas = getTickCount ()
local screenW , screenH = guiGetScreenSize ()
mojeW , mojeH = 1360 , 768
sW , sH = guiGetScreenSize ()
width , height = ( sW / mojeW ), ( sH / mojeH )
function speeed ( car )
local a1 , b1 , c1 = getElementVelocity ( car )
local fast = (( a1 ^ 2 + b1 ^ 2 + c1 ^ 2 )^( 0.5 ) * 180 )
return fast
end
local code = "Sweepers" -- kod pracy
tekstury = {
[ 0 ] = true ,
[ 1 ] = true ,
[ 2 ] = true ,
}
local smiecie = 0
function greetingHandler ( message )
smiecie = 0
end
addEvent ( "zerowaniesmieci" , true )
addEventHandler ( "zerowaniesmieci" , localPlayer , greetingHandler )
function render ( pojazd )
if pojazd and isElement ( pojazd ) then
local matrix = getElementMatrix ( pojazd )
local vx , vy , vz = getElementVelocity ( pojazd )
local maciez = ( vx * matrix [ 2 ][ 1 ]) + ( vy * matrix [ 2 ][ 2 ]) + ( vz * matrix [ 2 ][ 3 ])
if maciez <= 0 then
return false
end
local x , y , z = getElementPosition ( pojazd )
fxAddWaterSplash ( x , y , z - 1.9 )
if ( getTickCount () - czas ) < math . random ( 700 , 1200 ) then return end
czas = getTickCount ()
--if ( not isVehicleOnGround ( pojazd )) then outputDebugString ( "ground FALSE" ) return end
if speeed ( pojazd ) < 33 then return end
ziemia = getGroundPosition ( x , y , z ) - 0.001
hit , _ , _ , _ , _ , _ , _ , _ , material , _ , target = processLineOfSight ( x , y , z , x , y , ziemia , true , false , true , true , false , true )
if hit == false then
return end
if ( not tekstury [ material ]) then
return end
smiecie = getElementData ( pojazd , "vehicle:trash" )
if ulepszenia [ 4 ] == "1" then
kg = 1 / 80
elseif ulepszenia [ 4 ] == "0" then
kg = 1 / 100
end
if ulepszenia [ 1 ] == "1" then
limit = 25
elseif ulepszenia [ 1 ] == "0" then
limit = 70
end
if smiecie >= limit then return end
setElementData ( pojazd , "vehicle:trash" , smiecie + kg )
end
end
local function shit ()
local pojazd = getPedOccupiedVehicle ( localPlayer )
if not pojazd then return end
if not getVehicleEngineState ( pojazd ) then return end
render ( pojazd )
end
function gui ()
exports [ "buttons" ]: createCustomWindow ( "" , screenW / 2 - 150 , screenH / 2 + 220 , 300 , 140 , tocolor ( 255 , 255 , 255 , 255 ), false )
exports [ "buttons" ]: createCustomText ( "Zebranane zanieczyszczenia" , screenW / 2 - 91 , screenH / 2 + 265 , screenW / 2 + 91 , screenH / 2 + 265 , tocolor ( 255 , 255 , 255 , 255 ), 99 , "default" , "center" , "center" , false , false , false , false , false )
exports [ "buttons" ]: createCustomText ( "" .. string . format ( "%.2f" , smiecie ).. "KG" , screenW / 2 - 90 , screenH / 2 + 310 , screenW / 2 + 90 , screenH / 2 + 310 , tocolor ( 255 , 255 , 255 , 255 ), 99 , "default" , "center" , "center" , false , false , false , false , false )
end
function guirozladunek ()
exports [ "buttons" ]: createCustomWindow ( "Miejsce Rozladunku Zanieczyszczen" , screenW * 0.3016 , screenH * 0.2786 , screenW * 0.4092 , screenH * 0.4805 , tocolor ( 255 , 255 , 255 , 255 ), false )
exports [ "buttons" ]: createCustomText ( "Tutaj mozesz rozladowac zebrane zanieczyszczenia" , screenW / 2 - 80 , screenH / 2 - 365 , screenW / 2 + 91 , screenH / 2 + 265 , tocolor ( 255 , 255 , 255 , 255 ), 99 , "default" , "center" , "center" , false , false , false , false , false )
exports [ "buttons" ]: createCustomText ( "Aby rozladowac zanieczyszczenia" , screenW / 2 - 80 , screenH / 2 - 305 , screenW / 2 + 91 , screenH / 2 + 265 , tocolor ( 255 , 255 , 255 , 255 ), 99 , "default" , "center" , "center" , false , false , false , false , false )
exports [ "buttons" ]: createCustomText ( "kliknij przycisk 'ROZLADUJ'" , screenW / 2 - 80 , screenH / 2 - 245 , screenW / 2 + 91 , screenH / 2 + 265 , tocolor ( 255 , 255 , 255 , 255 ), 99 , "default" , "center" , "center" , false , false , false , false , false )
exports [ "buttons" ]: createCustomText ( "Zebranane zanieczyszenia" , screenW / 2 - 80 , screenH / 2 - 125 , screenW / 2 + 91 , screenH / 2 + 265 , tocolor ( 255 , 255 , 255 , 255 ), 99 , "default" , "center" , "center" , false , false , false , false , false )
exports [ "buttons" ]: createCustomText ( "" .. string . format ( "%.2f" , smiecie ).. "KG" , screenW / 2 - 80 , screenH / 2 - 110 , screenW / 2 + 90 , screenH / 2 + 310 , tocolor ( 255 , 255 , 255 , 255 ), 99 , "default" , "center" , "center" , false , false , false , false , false )
exports [ "buttons" ]: createCustomButton ( "Rozladuj" , screenW * 0.3422 , screenH * 0.6719 , screenW * 0.1094 , screenH * 0.0600 , tocolor ( 255 , 255 , 255 , 255 ), false )
exports [ "buttons" ]: createCustomButton ( "Zamknij" , screenW * 0.5632 , screenH * 0.6719 , screenW * 0.1094 , screenH * 0.0600 , tocolor ( 255 , 255 , 255 , 255 ), false )
end
function guiulepszen ()
exports [ "buttons" ]: createCustomWindow ( "Panel ulepszen" , screenW * 0.3016 , screenH * 0.2786 , screenW * 0.4092 , screenH * 0.4805 , tocolor ( 255 , 255 , 255 , 255 ), false )
dxDrawRectangle ( 532 * width , 287 * height , 271 * width , 42 * height , tocolor ( 0 , 0 , 0 , 170 ), false )
dxDrawRectangle ( 813 * width , 287 * height , 42 * width , 42 * height , tocolor ( 0 , 0 , 0 , 170 ), false )
dxDrawRectangle ( 532 * width , 339 * height , 271 * width , 42 * height , tocolor ( 0 , 0 , 0 , 170 ), false )
dxDrawRectangle ( 813 * width , 339 * height , 42 * width , 42 * height , tocolor ( 0 , 0 , 0 , 170 ), false )
dxDrawRectangle ( 532 * width , 391 * height , 271 * width , 42 * height , tocolor ( 0 , 0 , 0 , 170 ), false )
dxDrawRectangle ( 813 * width , 391 * height , 42 * width , 42 * height , tocolor ( 0 , 0 , 0 , 170 ), false )
dxDrawRectangle ( 532 * width , 443 * height , 271 * width , 42 * height , tocolor ( 0 , 0 , 0 , 170 ), false )
dxDrawRectangle ( 813 * width , 443 * height , 42 * width , 42 * height , tocolor ( 0 , 0 , 0 , 170 ), false )
dxDrawText ( "Twoje punkty: #ff0000" .. pkt .. "" , screenW / 2 + 180 , screenH / 2 - 545 , screenW / 2 + 191 , screenH / 2 + 265 , tocolor ( 255 , 255 , 255 , 255 ), 1.50 , "default-bold" , "center" , "center" , false , true , false , true , false )
dxDrawText ( "Zwi?kszenie limitu ?mieci do 70 kg\nKoszt: 4000 PLN + 100 punkt?w" , 530 * width , 287 * height , 803 * width , 287 + 42 * height , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "default-bold" , "center" , "center" , false , true , false , false , false )
dxDrawText ( "Zwi?kszenie zarobk?w o 5%\nKoszt: 6000 PLN + 150 punkt?w" , 530 * width , 339 * height , 803 * width , 339 + 42 * height , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "default-bold" , "center" , "center" , false , true , false , false , false )
dxDrawText ( "Zwi?kszenie zarobk?w o 10%\nKoszt: 8000 PLN + 200 punkt?w" , 530 * width , 391 * height , 803 * width , 391 + 42 * height , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "default-bold" , "center" , "center" , false , true , false , false , false )
dxDrawText ( "Zwi?kszenie pr?dko?ci zbierania ?mieci o 20%\nKoszt: 10000 PLN + 300 punkt?w" , 530 * width , 443 * height , 803 * width , 443 + 42 * height , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "default-bold" , "center" , "center" , false , true , false , false , false )
if ulepszenia [ 1 ] == "1" then
dxDrawText ( "✓" , 811 * width , 287 * height , 855 * width , 287 + 42 * height , tocolor ( 255 , 255 , 255 , 255 ), 1.5 , "default-bold" , "center" , "center" , false , true , false , false , false )
else
dxDrawText ( "KUP" , 811 * width , 287 * height , 855 * width , 287 + 42 * height , tocolor ( 255 , 255 , 255 , 255 ), 1.5 , "default-bold" , "center" , "center" , false , true , false , false , false )
end
if ulepszenia [ 2 ] == "1" then
dxDrawText ( "✓" , 811 * width , 339 * height , 855 * width , 339 + 42 * height , tocolor ( 255 , 255 , 255 , 255 ), 1.5 , "default-bold" , "center" , "center" , false , true , false , false , false )
else
dxDrawText ( "KUP" , 811 * width , 339 * height , 855 * width , 339 + 42 * height , tocolor ( 255 , 255 , 255 , 255 ), 1.5 , "default-bold" , "center" , "center" , false , true , false , false , false )
end
if ulepszenia [ 3 ] == "1" then
dxDrawText ( "✓" , 811 * width , 391 * height , 855 * width , 391 + 42 * height , tocolor ( 255 , 255 , 255 , 255 ), 1.5 , "default-bold" , "center" , "center" , false , true , false , false , false )
else
dxDrawText ( "KUP" , 811 * width , 391 * height , 855 * width , 391 + 42 * height , tocolor ( 255 , 255 , 255 , 255 ), 1.5 , "default-bold" , "center" , "center" , false , true , false , false , false )
end
if ulepszenia [ 4 ] == "1" then
dxDrawText ( "✓" , 811 * width , 443 * height , 855 * width , 443 + 42 * height , tocolor ( 255 , 255 , 255 , 255 ), 1.5 , "default-bold" , "center" , "center" , false , true , false , false , false )
else
dxDrawText ( "KUP" , 811 * width , 443 * height , 855 * width , 443 + 42 * height , tocolor ( 255 , 255 , 255 , 255 ), 1.5 , "default-bold" , "center" , "center" , false , true , false , false , false )
end
exports [ "buttons" ]: createCustomButton ( "Zamknij" , screenW * 0.4532 , screenH * 0.6719 , screenW * 0.1094 , screenH * 0.0600 , tocolor ( 255 , 255 , 255 , 255 ), false )
end
oknorozladunku = false
oknoulepszen = false
local marker = createMarker ( 800.52 , - 2097.87 , 1.77 , "corona" , 1.0 , 153 , 50 , 204 )
addEventHandler ( "onClientMarkerHit" , marker , function( el )
if el ~= localPlayer then return end
if getElementData ( el , "player:job" ) == "Sweepers" then
addEventHandler ( "onClientRender" , root , guirozladunek )
oknorozladunku = true
showCursor ( true )
end
end )
function Przechowyjmij ( button , state )
if button == "left" and state == "down" and oknorozladunku then
if cursorPosition ( screenW * 0.3422 , screenH * 0.6719 , screenW * 0.1094 , screenH * 0.0600 ) then
local smiecie = getElementData ( getPedOccupiedVehicle ( localPlayer ), "vehicle:trash" )
if smiecie == 0.00 then
outputChatBox ( "Tw?j zbiornik jest pusty" ) return end
triggerServerEvent ( "rozladuj" , localPlayer , smiecie )
showCursor ( false )
oknorozladunku = false
removeEventHandler ( "onClientRender" , root , guirozladunek )
end
end
end
addEventHandler ( "onClientClick" , getRootElement (), Przechowyjmij )
function ulepszenie ( button , state )
if button == "left" and state == "down" and oknoulepszen then
if cursorPosition ( 813 * width , 287 * height , 42 * width , 42 * height ) then
if ulepszenia [ 1 ] == "1" then
outputChatBox ( "Posiadasz ju? to ulepszenie!" )
return
end
if pkt < 100 then
outputChatBox ( "Nie posiadasz tyle punkt?w!" )
return
end
local koszt = 400000
if getPlayerMoney ( localPlayer ) < koszt then
outputChatBox ( "Nie posiadasz tyle pieni?dzy!" )
return
end
triggerServerEvent ( "kupulepszenie" , localPlayer , koszt , 1 )
if ( not wasEventCancelled () ) then
ulepszenia [ 1 ] = "1"
pkt = pkt - 100
end
elseif cursorPosition ( 813 * width , 339 * height , 42 * width , 42 * height ) then
if ulepszenia [ 2 ] == "1" then
outputChatBox ( "Posiadasz ju? to ulepszenie!" )
return
end
if pkt < 150 then
outputChatBox ( "Nie posiadasz tyle punkt?w!" )
return
end
local koszt2 = 600000
if getPlayerMoney ( localPlayer ) < koszt2 then
outputChatBox ( "Nie posiadasz tyle pieni?dzy!" )
return
end
triggerServerEvent ( "kupulepszenie" , localPlayer , koszt2 , 2 )
if ( not wasEventCancelled () ) then
ulepszenia [ 2 ] = "1"
pkt = pkt - 150
end
elseif cursorPosition ( 813 * width , 391 * height , 42 * width , 42 * height ) then
if ulepszenia [ 3 ] == "1" then
outputChatBox ( "Posiadasz ju? to ulepszenie!" )
return
end
if pkt < 200 then
outputChatBox ( "Nie posiadasz tyle punkt?w!" )
return
end
local koszt3 = 800000
if getPlayerMoney ( localPlayer ) < koszt3 then
outputChatBox ( "Nie posiadasz tyle pieni?dzy!" )
return
end
triggerServerEvent ( "kupulepszenie" , localPlayer , koszt3 , 3 )
if ( not wasEventCancelled () ) then
ulepszenia [ 3 ] = "1"
pkt = pkt - 200
end
elseif cursorPosition ( 813 * width , 443 * height , 42 * width , 42 * height ) then
if ulepszenia [ 4 ] == "1" then
outputChatBox ( "Posiadasz ju? to ulepszenie!" )
return
end
if pkt < 300 then
outputChatBox ( "Nie posiadasz tyle punkt?w!" )
return
end
local koszt4 = 1000000
if getPlayerMoney ( localPlayer ) < koszt4 then
outputChatBox ( "Nie posiadasz tyle pieni?dzy!" )
return
end
triggerServerEvent ( "kupulepszenie" , localPlayer , koszt4 , 4 )
if ( not wasEventCancelled () ) then
ulepszenia [ 4 ] = "1"
pkt = pkt - 300
end
end
end
end
addEventHandler ( "onClientClick" , getRootElement (), ulepszenie )
function Zamknij ( button , state )
if button == "left" and state == "down" and oknorozladunku then
if cursorPosition ( screenW * 0.5632 , screenH * 0.6719 , screenW * 0.1094 , screenH * 0.0600 ) then
removeEventHandler ( "onClientRender" , root , guirozladunek )
showCursor ( false )
oknorozladunku = false
end
end
end
addEventHandler ( "onClientClick" , getRootElement (), Zamknij )
function Zamknij2 ( button , state )
if button == "left" and state == "down" and oknoulepszen then
if cursorPosition ( screenW * 0.4532 , screenH * 0.6719 , screenW * 0.1094 , screenH * 0.0600 ) then
removeEventHandler ( "onClientRender" , root , guiulepszen )
showCursor ( false )
oknoulepszen = false
end
end
end
addEventHandler ( "onClientClick" , getRootElement (), Zamknij2 )
function cursorPosition ( x , y , w , h )
if ( not isCursorShowing ()) then
return false
end
local mx , my = getCursorPosition ()
local fullx , fully = guiGetScreenSize ()
cursorx , cursory = mx * fullx , my * fully
if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then
return true
else
return false
end
end
addEventHandler ( "onClientVehicleEnter" , resourceRoot ,
function( thePlayer , seat )
if thePlayer == getLocalPlayer () then
if getElementData ( source , "vehicle:job" ) == code then
addEventHandler ( "onClientRender" , root , shit )
addEventHandler ( "onClientRender" , root , gui )
end
end
end )
addEventHandler ( "onClientVehicleExit" , resourceRoot ,
function( thePlayer , seat )
if thePlayer == getLocalPlayer () then
if getElementData ( source , "vehicle:job" ) == code then
removeEventHandler ( "onClientRender" , root , shit )
removeEventHandler ( "onClientRender" , root , gui )
oknoulepszen = false
showCursor ( false , true )
end
end
end )
function pobierz ( pkt2 , ulepszeniaa )
addEventHandler ( "onClientRender" , root , guiulepszen )
oknoulepszen = true
showCursor ( true , true )
ulepszenia = split ( tostring ( ulepszeniaa ), "," )
pkt = pkt2
end
addEvent ( "kutrypunkty" , true )
addEventHandler ( "kutrypunkty" , getLocalPlayer (), pobierz )