Pyrek24
Wiek: 25 Na forum: 3438 dni Posty: 546
Nick w MP: Pyrek
Piwa : 10
Witam ot?? mam prac? g?rnika kt?ra nie daj? pieni?dzy error w db3 to jest ot?? taki;
Client ( nick ) triggered serverside event monetygornik , but event is not added serverside
Kod
c.lua
x , y = guiGetScreenSize ()
px , py = ( x / 1024 ), ( y / 768 )
function isMouseIn ( x , y , width , height )
if ( not isCursorShowing ( ) ) then
return false
end
local sx , sy = guiGetScreenSize ( )
local cx , cy = getCursorPosition ( )
local cx , cy = ( cx * sx ), ( cy * sy )
if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then
return true
else
return false
end
end
drzewa = {
{- 92.53 , 1989.35 , - 12.74 },
{- 98.49 , 1989.58 , - 12.58 },
{- 87.17 , 1970.10 , - 12.71 },
{- 91.85 , 1960.08 , - 12.58 },
{- 112.62 , 1982.88 , - 12.77 },
{- 105.88 , 1988.86 , - 12.76 },
{- 103.74 , 1962.63 , - 12.63 },
}
pracagornik = createMarker (- 109.08 , 1987.36 , 3.46 - 0.9 , "cylinder" , 1.5 )
createBlipAttachedTo ( pracagornik , 46 )
addEventHandler ( "onClientMarkerHit" , pracagornik , function( h )
if h ~= localPlayer then return end
setElementData ( localPlayer , "gui:gornik" , true )
showCursor ( true )
end )
addEventHandler ( "onClientRender" , root , function()
if not getElementData ( localPlayer , "gui:gornik" ) then return end
dxDrawImage ( 312 * px , 184 * py , 400 * px , 400 * py , "job.png" )
end )
function markergornik ()
rnd = math . random ( 1 , #drzewa)
markerRandom = createMarker ( drzewa [ rnd ][ 1 ], drzewa [ rnd ][ 2 ], drzewa [ rnd ][ 3 ]- 0.9 , 'cylinder' , 0.5 )
blipRandom = createBlipAttachedTo ( markerRandom , 41 )
drzewo = createObject ( 16692 , drzewa [ rnd ][ 1 ], drzewa [ rnd ][ 2 ], drzewa [ rnd ][ 3 ]- 2 )
end
kliki = 0
function gui ()
setElementData ( localPlayer , "mozna:klikac:gornik" , true )
if kliki > 24 then return end
addEventHandler ( "onClientRender" , root , function()
if not getElementData ( localPlayer , "mozna:klikac:gornik" ) then return end
dxDrawText ( "Klikaj, aby kopa? surowiec\n" .. kliki .. "/25" , ( 288 - 1 )* px , ( 253 - 1 )* py , ( 766 - 1 )* px , ( 435 - 1 )* py , tocolor ( 0 , 0 , 0 , 255 ), 3.00 * px , "default-bold" , "center" , "top" , false , false , false , false , false )
dxDrawText ( "Klikaj, aby kopa? surowiec\n" .. kliki .. "/25" , ( 288 + 1 )* px , ( 253 - 1 )* py , ( 766 + 1 )* px , ( 435 - 1 )* py , tocolor ( 0 , 0 , 0 , 255 ), 3.00 * px , "default-bold" , "center" , "top" , false , false , false , false , false )
dxDrawText ( "Klikaj, aby kopa? surowiec\n" .. kliki .. "/25" , ( 288 - 1 )* px , ( 253 + 1 )* py , ( 766 - 1 )* px , ( 435 + 1 )* py , tocolor ( 0 , 0 , 0 , 255 ), 3.00 * px , "default-bold" , "center" , "top" , false , false , false , false , false )
dxDrawText ( "Klikaj, aby kopa? surowiec\n" .. kliki .. "/25" , ( 288 + 1 )* px , ( 253 + 1 )* py , ( 766 + 1 )* px , ( 435 + 1 )* py , tocolor ( 0 , 0 , 0 , 255 ), 3.00 * px , "default-bold" , "center" , "top" , false , false , false , false , false )
dxDrawText ( "Klikaj, aby kopa? surowiec\n" .. kliki .. "/25" , 288 * px , 253 * py , 766 * px , 435 * py , tocolor ( 255 , 255 , 255 , 255 ), 3.00 * px , "default-bold" , "center" , "top" , false , false , false , false , false )
end )
end
function elo ( h )
if h ~= localPlayer then return end
gui ()
destroyElement ( source )
destroyElement ( blipRandom )
setElementFrozen ( localPlayer , true )
end
bindKey ( "mouse1" , "down" , function()
if not getElementData ( localPlayer , "gui:gornik" ) then return end
if isMouseIn ( 538 * px , 527 * py , 161 * px , 39 * py ) then
setElementData ( localPlayer , "gui:gornik" , false )
showCursor ( false )
end
if isMouseIn ( 324 * px , 527 * py , 161 * px , 39 * py ) then
if getElementData ( localPlayer , "player:reputation" ) < 800 then triggerEvent ( "onClientAddNotification" , localPlayer , "Nie posiadasz 150 RP" , "error" ) return end
if getElementData ( localPlayer , "praca" ) then triggerEvent ( "onClientAddNotification" , localPlayer , "Posiadasz aktywn? prac?" , "error" ) return end
triggerEvent ( "onClientAddNotification" , localPlayer , "Rozpoczynasz prac? gornika" , "success" )
outputChatBox ( "Rozpoczynasz prac? gornika. Aby zako?czy? wpisz /zakoncz.gornik" , 100 , 100 , 250 )
triggerServerEvent ( "siekiera" , localPlayer )
setPedWeaponSlot ( localPlayer , 1 )
setElementData ( localPlayer , "praca" , "gornik" )
setElementData ( localPlayer , "gui:gornik" , false )
showCursor ( false )
markergornik ()
addEventHandler ( "onClientMarkerHit" , markerRandom , elo )
addEventHandler ( "onClientRender" , root , function()
toggleControl ( "fire" , false )
toggleControl ( "aim_weapon" , false )
end )
end
end )
bindKey ( "mouse1" , "down" , function()
if not getElementData ( localPlayer , "praca" ) == "gornik" then return end
if not getElementData ( localPlayer , "mozna:klikac:gornik" ) then return end
if kliki > 24 then
setElementData ( localPlayer , "mozna:klikac:gornik" , false )
kliki = 0
destroyElement ( drzewo )
markergornik ()
addEventHandler ( "onClientMarkerHit" , markerRandom , elo )
setElementFrozen ( localPlayer , false )
if not getElementData ( localPlayer , "player:premium" ) then
triggerServerEvent ( "monetygornik" , localPlayer , math . random ( 2000000 , 3000000 ), math . random ( 5 , 9 ))
else
triggerServerEvent ( "monetygornik" , localPlayer , math . random ( 2000000 * 1.2 , 3000000 * 1.2 ), math . random ( 5 , 12 ))
end
return
end
kliki = kliki + 1
toggleControl ( "fire" , true )
toggleControl ( "aim_weapon" , true )
return
end )
addCommandHandler ( "zakoncz.gornik" , function()
if getElementData ( localPlayer , "praca" ) ~= "gornik" then
triggerEvent ( "onClientAddNotification" , localPlayer , "Nie posiadasz aktywnej pracy gornika" , "error" )
return
end
setElementData ( localPlayer , "praca" , nil )
destroyElement ( markerRandom )
destroyElement ( blipRandom )
destroyElement ( drzewo )
triggerEvent ( "onClientAddNotification" , localPlayer , "Ko?czysz prac? jako gornik" , "success" )
end )
s.lua
addEvent ( "monetygornik" , true )
addEventHandler ( "monetygornik" , root , function( ilosc , repa )
local kasa = ilosc
givePlayerMoney ( client , kasa )
triggerClientEvent ( client , "onClientAddNotification" , client , "Za wykopany surowiec otrzymujesz " .. kasa .. " $" , "success" )
local reputacja = getElementData ( client , "player:reputation" )
setElementData ( client , "player:reputation" , reputacja + repa )
end )
addEvent ( "siekiera" , true )
addEventHandler ( "siekiera" , root , function()
-- giveWeapon ( client , 8 )
end )
addEvent ( "takeWeapon" , true )
addEventHandler ( "takeWeapon" , root , function()
takeWeapon ( client , 8 )
end )
Za dobr? odpowied? stawiam zimne