Wysłany: 2017-06-10, 14:23
sasik12
Wiek: 26 Na forum: 3763 dni Posty: 182
Piwa : 7
Siemka . Przerobi?em pod wzgl?dem graficznym hud z lifeline i po zrobieniu prac dorywczych oraz zarabianiu nie pokazuje zarobionych $$ . Jakie? pomys?y ?
Podpis
Uczeń LUA . Mapper MTA.
Wysłany: 2017-06-10, 15:57
Cholewka
Zakorzeniony w LUA
Wiek: 22 Na forum: 3583 dni Posty: 190
Piwa : 707
Mo?e po prostu nie zarobi?e? tych pieni?dzy? Podaj db3 i po jakiej stronie mety zrobi?e? skrypt na Twoj? prace dorywcz?.
Wysłany: 2017-06-10, 19:03
sasik12
Wiek: 26 Na forum: 3763 dni Posty: 182
Piwa : 7
Trzymaj kod .
client
createObject ( 700 ,- 2020.48 , - 2396.44 , 30.63 - 1 )
createObject ( 700 ,- 2008.33 , - 2401.00 , 30.63 - 1 )
createObject ( 700 ,- 1995.99 , - 2404.73 , 30.63 - 1 )
createObject ( 700 ,- 1994.43 , - 2398.88 , 30.63 - 1 )
createObject ( 700 ,- 1992.11 , - 2389.35 , 30.63 - 1 )
createObject ( 700 ,- 2001.81 , - 2388.76 , 30.63 - 1 )
createObject ( 700 ,- 2012.06 , - 2383.29 , 30.63 - 1 )
createObject ( 700 ,- 2018.79 , - 2387.88 , 30.63 - 1 )
local pracaM = createMarker (- 2032.57 , - 2392.40 , 30.63 - 0.9 , "cylinder" , 2.0 , 0 , 50 , 255 , 75 )
local blip = createBlip (- 2032.57 , - 2392.40 , 30.63 , 46 , 0 , 0 , 0 , 0 , 0 , 0 , 600 )
local miejscaelektryk = {
{- 2020.48 , - 2396.44 , 30.63 },
{- 2008.33 , - 2401.00 , 30.63 },
{- 1995.99 , - 2404.73 , 30.63 },
{- 1994.43 , - 2398.88 , 30.63 },
{- 1992.11 , - 2389.35 , 30.63 },
{- 2001.81 , - 2388.76 , 30.63 },
{- 2012.06 , - 2383.29 , 30.63 },
{- 2018.79 , - 2387.88 , 30.63 },
}
addEventHandler ( "onClientMarkerHit" , pracaM , function( el , md )
if not md or getElementType ( el ) ~= "player" then return end
if el ~= localPlayer then return end
outputChatBox ( "* Praca Dorywcza - Drwal." , 255 , 255 , 255 , true )
outputChatBox ( "* Aby rozpocz?? prac? kliknij E." , 255 , 255 , 255 , true )
end )
bindKey ( "e" , "down" , function()
if not isElementWithinMarker ( localPlayer , pracaM ) then return end
if not getElementData ( localPlayer , "player:job" ) then
local losuj = math . random ( 2 , #miejscaelektryk)
setElementData ( localPlayer , "player:job" , true )
triggerServerEvent ( "bron" , localPlayer )
outputChatBox ( "* Wzio?e? pi?e, udaj si? do drzewa aby go ?ci??!" , 255 , 255 , 255 , true )
local skrzynia = createObject ( 335 , 0 , 0 , 0 )
obiekt = createObject ( 700 , miejscaelektryk [ losuj ][ 1 ], miejscaelektryk [ losuj ][ 2 ], miejscaelektryk [ losuj ][ 3 ]- 1 )
cel = createMarker ( miejscaelektryk [ losuj ][ 1 ], miejscaelektryk [ losuj ][ 2 ], miejscaelektryk [ losuj ][ 3 ]- 1.0 , "cylinder" , 1.5 , 255 , 0 , 0 , 0 )
blip = createBlipAttachedTo ( cel , 12 )
napis = createElement ( "text" )
setElementData ( napis , "name" , "Drzewo do ?ci?cia" )
setElementPosition ( napis , miejscaelektryk [ losuj ][ 1 ], miejscaelektryk [ losuj ][ 2 ], miejscaelektryk [ losuj ][ 3 ])
addEventHandler ( "onClientMarkerHit" , cel , function( el , md )
if not md or getElementType ( el ) ~= "player" then return end
if el ~= localPlayer then return end
if getPedOccupiedVehicle ( el ) then
outputChatBox ( "* Nie mo?esz pracowa? b?d?c w poje?dzie!" , 255 , 255 , 255 , true )
return
end
destroyElement ( blip )
setElementFrozen ( el , true )
outputChatBox ( "* W?a?nie scinasz drzewo, pamietaj by uwazac na palce" , 255 , 255 , 255 , true )
triggerServerEvent ( "animka" , localPlayer )
setTimer (function()
setElementFrozen ( el , false )
setElementData ( localPlayer , "gracz:praca" , false )
setPedAnimation ( ped , "bat_4" )
destroyElement ( cel )
destroyElement ( napis )
destroyElement ( skrzynia )
destroyElement ( obiekt )
triggerServerEvent ( "zb" , localPlayer )
triggerServerEvent ( "zanimka" , localPlayer )
setElementData ( el , "player:job" , false )
local kasa = math . random ( 100 , 150 )
local kasapremium = math . random ( 200 , 400 )
if getElementData ( localPlayer , "player:premium" ) then
givePlayerMoney ( kasapremium , localPlayer )
outputChatBox ( "* [PREMIUM] Za sci?cie drzewa dostajesz " .. kasapremium .. " PLN!" , 6 , 147 , 9 , true )
else
givePlayerMoney ( kasa , localPlayer )
outputChatBox ( "* Za sci?cie drzewa dostajesz " .. kasa .. " PLN!" , 6 , 147 , 9 , true )
end
toggleControl ( "sprint" , true )
toggleControl ( "jump" , true )
toggleControl ( "crouch" , true )
end , 5000 , 1 )
end )
else
outputChatBox ( "* Posiadasz aktywn? prac?." , 255 , 255 , 255 , true )
end
end )
addEventHandler ( "onClientResourceStop" , resourceRoot , function()
setElementData ( localPlayer , "player:job" , false )
toggleControl ( "sprint" , true )
toggleControl ( "jump" , true )
toggleControl ( "crouch" , true )
destroyElement ( cel )
destroyElement ( napis )
destroyElement ( blip )
destroyElement ( obiekt )
destroyElement ( skrzynia )
end )
addEvent ( "StopPracaDrwal" , true )
addEventHandler ( "StopPracaDrwal" , resourceRoot , function()
destroyElement ( cel )
destroyElement ( blip )
setElementData ( localPlayer , "player:job" , false )
toggleControl ( "sprint" , true )
toggleControl ( "jump" , true )
toggleControl ( "crouch" , true )
outputChatBox ( "* Praca zosta?a zako?czona. Wyszed?e? z okre?lonego pola do sci?cia!" , 255 , 0 , 0 )
end )
serwer
local missionText = createElement ( "text" )
setElementData ( missionText , "name" , "Poland Life\nPraca Drwal" )
setElementPosition ( missionText , 122.62 , 914.84 , 20.06 )
addEvent ( "bron" , true )
addEventHandler ( "bron" , getRootElement (), function()
giveWeapon ( source , 9 , 1 )
setPedWeaponSlot ( source , 1 )
end )
addEvent ( "zb" , true )
addEventHandler ( "zb" , getRootElement (), function()
takeWeapon ( source , 9 )
end )
addEvent ( "animka" , true )
addEventHandler ( "animka" , getRootElement (), function()
setPedAnimation ( source , "CHAINSAW" , "WEAPON_csaw" )
end )
addEvent ( "zanimka" , true )
addEventHandler ( "zanimka" , getRootElement (), function()
setPedAnimation ( source , false )
end )
addEvent ( "zacznijPraceM" , true )
addEventHandler ( "zacznijPraceM" , getRootElement (),
function()
end )
-- zabieramy pi ? e
local cuboid = createColCuboid ( 100.51391601563 , 909.70031738281 , 18.280652999878 , 40 , 44 , 15 )
addEventHandler ( "onColShapeLeave" , cuboid , function( el , md )
if getElementData ( el , "player:job" ) then
takeWeapon ( el , 9 )
triggerClientEvent ( el , "StopPracaDrwal" , resourceRoot )
end
end )
[ Dodano : 2017-06-10, 19:04 ]
Tutaj HUD .
client
local screenW , screenH = guiGetScreenSize ()
foNte3 = dxCreateFont ( "font.ttf" , 20 ) or "defaul-bold"
foNte2 = dxCreateFont ( "font.ttf" , 16 ) or "defaul-bold"
foNte1 = dxCreateFont ( "font.ttf" , 17 ) or "defaul-bold"
function HUD ()
if getElementData ( localPlayer , "hud:enabled" ) then
kasa = getElementData ( localPlayer , "user:money" ) or 0
money = string . format ( "%01.02f" , kasa )
dxDrawImage ( screenW * 0.8094 , screenH * 0.1367 , screenW * 0.1719 , screenH * 0.0633 , ":guieditor/images/money.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
dxDrawImage ( screenW * 0.8094 , screenH * 0.0483 , screenW * 0.1719 , screenH * 0.0633 , ":guieditor/images/time.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
dxDrawBorderedText ( formatClock (), screenW * 0.8367 , screenH * 0.0500 , screenW * 0.9812 , screenH * 0.1117 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , foNte2 , "center" , "center" , false , false , false , false , false )
dxDrawBorderedText ( "PLN " .. money .. "" , screenW * 0.8350 , screenH * 0.1383 , screenW * 0.9711 , screenH * 0.2000 , tocolor ( 0 , 255 , 0 , 255 ), 1.00 , foNte1 , "right" , "center" , false , false , false , false , false )
end
end
addEventHandler ( "onClientRender" , getRootElement (), HUD )
function formatClock ()
local hour , minute = getTime ()
hour = string . format ( "%02d" , hour )
minute = string . format ( "%02d" , minute )
return hour .. ":" .. minute
end
setTimer ( formatClock , 60000 , 0 )
function OnStop ()
setPlayerHudComponentVisible ( "armour" , true )
setPlayerHudComponentVisible ( "wanted" , true )
setPlayerHudComponentVisible ( "weapon" , true )
setPlayerHudComponentVisible ( "money" , true )
setPlayerHudComponentVisible ( "health" , true )
setPlayerHudComponentVisible ( "clock" , true )
setPlayerHudComponentVisible ( "breath" , true )
setPlayerHudComponentVisible ( "ammo" , true )
setPlayerHudComponentVisible ( "area_name" , true )
setPlayerHudComponentVisible ( "radio" , true )
end
addEventHandler ( "onClientResourceStop" , getResourceRootElement ( getThisResource ()), OnStop )
function RealnyCzas ()
local realtime = getRealTime ()
setTime ( realtime . hour , realtime . minute )
end
setTimer ( RealnyCzas , 60000 , 0 )
function OnStart ()
setPlayerHudComponentVisible ( "armour" , false )
setPlayerHudComponentVisible ( "wanted" , false )
setPlayerHudComponentVisible ( "weapon" , false )
setPlayerHudComponentVisible ( "money" , false )
setPlayerHudComponentVisible ( "health" , false )
setPlayerHudComponentVisible ( "clock" , false )
setPlayerHudComponentVisible ( "breath" , false )
setPlayerHudComponentVisible ( "ammo" , false )
setPlayerHudComponentVisible ( "area_name" , false )
setPlayerHudComponentVisible ( "radio" , false )
RealnyCzas ()
end
addEventHandler ( "onClientResourceStart" , getResourceRootElement ( getThisResource ()), OnStart )
local hudTable =
{
"ammo" ,
"armour" ,
"clock" ,
"health" ,
"money" ,
"weapon" ,
"wanted" ,
"area_name" ,
"vehicle_name" ,
"breath" ,
"clock"
}
addEventHandler ( "onClientResourceStart" , resourceRoot ,
function()
for id , hudComponents in ipairs ( hudTable ) do
showPlayerHudComponent ( hudComponents , false )
end
end
)
addEventHandler ( "onClientResourceStop" , resourceRoot ,
function()
for id , hudComponents in ipairs ( hudTable ) do
showPlayerHudComponent ( hudComponents , true )
end
end
)
function dxDrawBorderedText ( text , x , y , w , h , color , scale , font , alignX , alignY , clip , wordBreak , postGUI )
dxDrawText ( text : gsub ( '#%x%x%x%x%x%x' , '' ), x - 1 , y - 1 , w - 1 , h - 1 , tocolor ( 0 , 0 , 0 , 255 ), scale , font , alignX , alignY , clip , wordBreak , false )
dxDrawText ( text : gsub ( '#%x%x%x%x%x%x' , '' ), x + 1 , y - 1 , w + 1 , h - 1 , tocolor ( 0 , 0 , 0 , 255 ), scale , font , alignX , alignY , clip , wordBreak , false )
dxDrawText ( text : gsub ( '#%x%x%x%x%x%x' , '' ), x - 1 , y + 1 , w - 1 , h + 1 , tocolor ( 0 , 0 , 0 , 255 ), scale , font , alignX , alignY , clip , wordBreak , false )
dxDrawText ( text : gsub ( '#%x%x%x%x%x%x' , '' ), x + 1 , y + 1 , w + 1 , h + 1 , tocolor ( 0 , 0 , 0 , 255 ), scale , font , alignX , alignY , clip , wordBreak , false )
dxDrawText ( text : gsub ( '#%x%x%x%x%x%x' , '' ), x - 1 , y , w - 1 , h , tocolor ( 0 , 0 , 0 , 255 ), scale , font , alignX , alignY , clip , wordBreak , false )
dxDrawText ( text : gsub ( '#%x%x%x%x%x%x' , '' ), x + 1 , y , w + 1 , h , tocolor ( 0 , 0 , 0 , 255 ), scale , font , alignX , alignY , clip , wordBreak , false )
dxDrawText ( text : gsub ( '#%x%x%x%x%x%x' , '' ), x , y - 1 , w , h - 1 , tocolor ( 0 , 0 , 0 , 255 ), scale , font , alignX , alignY , clip , wordBreak , false )
dxDrawText ( text : gsub ( '#%x%x%x%x%x%x' , '' ), x , y + 1 , w , h + 1 , tocolor ( 0 , 0 , 0 , 255 ), scale , font , alignX , alignY , clip , wordBreak , false )
dxDrawText ( text , x , y , w , h , color , scale , font , alignX , alignY , clip , wordBreak , postGUI , true )
end
function apagarScript ()
if fileExists ( "Hud_c.lua" ) then
fileDelete ( "Hud_c.lua" )
end
end
addEventHandler ( "onClientResourceStart" , getResourceRootElement ( getThisResource ()), apagarScript )
addEventHandler ( "onClientPlayerQuit" , getRootElement (), apagarScript )
addEventHandler ( "onClientPlayerJoin" , getRootElement (), apagarScript )
Podpis
Uczeń LUA . Mapper MTA.
Wysłany: 2017-06-10, 19:04
Cholewka
Zakorzeniony w LUA
Wiek: 22 Na forum: 3583 dni Posty: 190
Piwa : 707
givePlayerMoney ( kasapremium , localPlayer )
No w?a?nie.
Funkcja givePlayerMoney dzia?a tylko po stronie serwera, striggeruj to jako?. ^^
Wysłany: 2017-06-10, 19:20
amited
Wiek: 26 Na forum: 3714 dni Posty: 1233
Nick w MP: Amited
Piwa : 512
Cholewka , Nie, to funkcja obustronna. Tylko ?e ta funkcji clienta wygl?da tak:
Bez podania gracza.
Wysłany: 2017-06-10, 19:29
ExtreM
Profesjonalny Mapper
Wiek: 33 Na forum: 3478 dni Posty: 104
Nick w MP: ExtreM
Piwa : 462
setElementData ( plr , "user:money" ) je?eli u?ywasz owna lub lifeline.
Po za tym hud z lifeline jest pod element dat?
Podpis
Discord : ExtreM#7905
Wykonuję profesjonalne mapy/interiory/exteriory na zamówienie!
Wysłany: 2017-06-11, 00:11
nanKy
Wiek: 22 Na forum: 3865 dni Posty: 498
Nick w MP: nanky
Piwa : 1773
Masz tu gotowca.
local screenW , screenH = guiGetScreenSize ()
foNte3 = dxCreateFont ( "font.ttf" , 20 ) or "defaul-bold"
foNte2 = dxCreateFont ( "font.ttf" , 16 ) or "defaul-bold"
foNte1 = dxCreateFont ( "font.ttf" , 17 ) or "defaul-bold"
function HUD ()
if getElementData ( localPlayer , "hud:enabled" ) then
kasa = getPlayerMoney ( localPlayer )
money = string . format ( "%01.02f" , kasa )
dxDrawImage ( screenW * 0.8094 , screenH * 0.1367 , screenW * 0.1719 , screenH * 0.0633 , ":guieditor/images/money.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
dxDrawImage ( screenW * 0.8094 , screenH * 0.0483 , screenW * 0.1719 , screenH * 0.0633 , ":guieditor/images/time.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
dxDrawBorderedText ( formatClock (), screenW * 0.8367 , screenH * 0.0500 , screenW * 0.9812 , screenH * 0.1117 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , foNte2 , "center" , "center" , false , false , false , false , false )
dxDrawBorderedText ( "PLN " .. money .. "" , screenW * 0.8350 , screenH * 0.1383 , screenW * 0.9711 , screenH * 0.2000 , tocolor ( 0 , 255 , 0 , 255 ), 1.00 , foNte1 , "right" , "center" , false , false , false , false , false )
end
end
addEventHandler ( "onClientRender" , getRootElement (), HUD )
function formatClock ()
local hour , minute = getTime ()
hour = string . format ( "%02d" , hour )
minute = string . format ( "%02d" , minute )
return hour .. ":" .. minute
end
setTimer ( formatClock , 60000 , 0 )
function OnStop ()
setPlayerHudComponentVisible ( "armour" , true )
setPlayerHudComponentVisible ( "wanted" , true )
setPlayerHudComponentVisible ( "weapon" , true )
setPlayerHudComponentVisible ( "money" , true )
setPlayerHudComponentVisible ( "health" , true )
setPlayerHudComponentVisible ( "clock" , true )
setPlayerHudComponentVisible ( "breath" , true )
setPlayerHudComponentVisible ( "ammo" , true )
setPlayerHudComponentVisible ( "area_name" , true )
setPlayerHudComponentVisible ( "radio" , true )
end
addEventHandler ( "onClientResourceStop" , getResourceRootElement ( getThisResource ()), OnStop )
function RealnyCzas ()
local realtime = getRealTime ()
setTime ( realtime . hour , realtime . minute )
end
setTimer ( RealnyCzas , 60000 , 0 )
function OnStart ()
setPlayerHudComponentVisible ( "armour" , false )
setPlayerHudComponentVisible ( "wanted" , false )
setPlayerHudComponentVisible ( "weapon" , false )
setPlayerHudComponentVisible ( "money" , false )
setPlayerHudComponentVisible ( "health" , false )
setPlayerHudComponentVisible ( "clock" , false )
setPlayerHudComponentVisible ( "breath" , false )
setPlayerHudComponentVisible ( "ammo" , false )
setPlayerHudComponentVisible ( "area_name" , false )
setPlayerHudComponentVisible ( "radio" , false )
RealnyCzas ()
end
addEventHandler ( "onClientResourceStart" , getResourceRootElement ( getThisResource ()), OnStart )
local hudTable =
{
"ammo" ,
"armour" ,
"clock" ,
"health" ,
"money" ,
"weapon" ,
"wanted" ,
"area_name" ,
"vehicle_name" ,
"breath" ,
"clock"
}
addEventHandler ( "onClientResourceStart" , resourceRoot ,
function()
for id , hudComponents in ipairs ( hudTable ) do
showPlayerHudComponent ( hudComponents , false )
end
end
)
addEventHandler ( "onClientResourceStop" , resourceRoot ,
function()
for id , hudComponents in ipairs ( hudTable ) do
showPlayerHudComponent ( hudComponents , true )
end
end
)
function dxDrawBorderedText ( text , x , y , w , h , color , scale , font , alignX , alignY , clip , wordBreak , postGUI )
dxDrawText ( text : gsub ( '#%x%x%x%x%x%x' , '' ), x - 1 , y - 1 , w - 1 , h - 1 , tocolor ( 0 , 0 , 0 , 255 ), scale , font , alignX , alignY , clip , wordBreak , false )
dxDrawText ( text : gsub ( '#%x%x%x%x%x%x' , '' ), x + 1 , y - 1 , w + 1 , h - 1 , tocolor ( 0 , 0 , 0 , 255 ), scale , font , alignX , alignY , clip , wordBreak , false )
dxDrawText ( text : gsub ( '#%x%x%x%x%x%x' , '' ), x - 1 , y + 1 , w - 1 , h + 1 , tocolor ( 0 , 0 , 0 , 255 ), scale , font , alignX , alignY , clip , wordBreak , false )
dxDrawText ( text : gsub ( '#%x%x%x%x%x%x' , '' ), x + 1 , y + 1 , w + 1 , h + 1 , tocolor ( 0 , 0 , 0 , 255 ), scale , font , alignX , alignY , clip , wordBreak , false )
dxDrawText ( text : gsub ( '#%x%x%x%x%x%x' , '' ), x - 1 , y , w - 1 , h , tocolor ( 0 , 0 , 0 , 255 ), scale , font , alignX , alignY , clip , wordBreak , false )
dxDrawText ( text : gsub ( '#%x%x%x%x%x%x' , '' ), x + 1 , y , w + 1 , h , tocolor ( 0 , 0 , 0 , 255 ), scale , font , alignX , alignY , clip , wordBreak , false )
dxDrawText ( text : gsub ( '#%x%x%x%x%x%x' , '' ), x , y - 1 , w , h - 1 , tocolor ( 0 , 0 , 0 , 255 ), scale , font , alignX , alignY , clip , wordBreak , false )
dxDrawText ( text : gsub ( '#%x%x%x%x%x%x' , '' ), x , y + 1 , w , h + 1 , tocolor ( 0 , 0 , 0 , 255 ), scale , font , alignX , alignY , clip , wordBreak , false )
dxDrawText ( text , x , y , w , h , color , scale , font , alignX , alignY , clip , wordBreak , postGUI , true )
end
function apagarScript ()
if fileExists ( "Hud_c.lua" ) then
fileDelete ( "Hud_c.lua" )
end
end
addEventHandler ( "onClientResourceStart" , getResourceRootElement ( getThisResource ()), apagarScript )
addEventHandler ( "onClientPlayerQuit" , getRootElement (), apagarScript )
addEventHandler ( "onClientPlayerJoin" , getRootElement (), apagarScript )
Powinno dzia?a?, nie wiem jak? masz elementdate or co?.
Wysłany: 2017-06-11, 00:14
_Haze
Peace Yo!
Wiek: 24 Na forum: 4184 dni Posty: 1648
Nick w MP: Haze
Piwa : 2628
amited , ahhhh Cytat: Note: Using this function client side (not recommended) will not change a players money server side.
U?ywajcie only server side tej funkcji...
Tagi: hud :: ktorym :: nie :: pokazuje :: kasy
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: