Akcja Buttony
Akcja 'Stop ServerProject'
Liberty Unleashed
GTA Multiplayer
Forum graficzne | Tutoriale GIMP Photoshop
Serwery Counter Strike 1.6
Forum serwera sa-mp PolishRPG
GTAModing.pl | Modyfikacje do GTA
exe24
psi247
TruckSerwer
Umieść swój button
Pawno i Lua dla SA-MP i MTA
07 Wrzesień 2010, 20:11:30 pm *
Witamy, Gość. Zaloguj się lub zarejestruj.
Czy dotarł do Ciebie email aktywacyjny?

Zaloguj się podając nazwę użytkownika, hasło i długość sesji
 
   Strona główna   Pomoc Szukaj Kalendarz Zaloguj się Rejestracja Wiki Dodatki  
Strony: [1]   Do dołu
  Drukuj  
Autor Wątek: Paliwo :(  (Przeczytany 385 razy)
0 użytkowników i 1 Gość przegląda ten wątek.
Mister*Łukasz
Członek
*

Piw: +0/-0
Offline Offline

Wiadomości: 6


Zobacz profil
« : 15 Czerwiec 2010, 08:05:16 am »

Witam otóż mam pewien problem jestem całkowicie nowy w LUA i jest taka sprawa otóż potrzebował bym skrypt na PALIWO nie zbugowany bo jak sami wiemy wiele ich jest U?miech Oczywiście żeby była możliwość tankowania poprzez wpisanie ilości litrów paliwa . Oraz wskaźnik poziomu paliwa w aucie . Myślę ze ktoś mi pomoże U?miech
Zapisane
I.K.
Egzekutor
****

Piw: +58/-8
Offline Offline

Wiadomości: 313


Mam burdel w głowie


Zobacz profil
« Odpowiedz #1 : 20 Czerwiec 2010, 14:17:11 pm »

To nie jest łatwy skrypt do napisania. Powinieneś poszukać na community, może ktoś taki wrzucił, bo raczej nikt specjalnie dla ciebie go nie zrobi.
Zapisane

WYPIERDALAJ
formel
Bywalec
*

Piw: +0/-0
Offline Offline

Wiadomości: 22


Zobacz profil
« Odpowiedz #2 : 20 Czerwiec 2010, 15:20:12 pm »

Na mta comunitty, są ale zbugowane, nie działają, próbowalismy pparu już i nic...
Zapisane
Mister*Łukasz
Członek
*

Piw: +0/-0
Offline Offline

Wiadomości: 6


Zobacz profil
« Odpowiedz #3 : 22 Czerwiec 2010, 07:04:33 am »

no racja a podpowiedział by mi ktoś jak zrobić żeby przy wejściu na serwer nie iść na spawna tylko ekran gry zwrócony w odpowiednie miejsce?
Zapisane
I.K.
Egzekutor
****

Piw: +58/-8
Offline Offline

Wiadomości: 313


Mam burdel w głowie


Zobacz profil
« Odpowiedz #4 : 29 Czerwiec 2010, 13:48:52 pm »

Musisz ustawić pozycje kamery. Polecam lekture wiki mta.
Zapisane

WYPIERDALAJ
Mister*Łukasz
Członek
*

Piw: +0/-0
Offline Offline

Wiadomości: 6


Zobacz profil
« Odpowiedz #5 : 02 Lipiec 2010, 23:19:41 pm »

ok a mogę chociażby prosić o kod LUA i podpowiedzi co gdzie i jak , był bym wdzięczny.
Zapisane
Mister*Łukasz
Członek
*

Piw: +0/-0
Offline Offline

Wiadomości: 6


Zobacz profil
« Odpowiedz #6 : 07 Lipiec 2010, 11:22:32 am »

umiał by ktoś zrobić taki:
http://community.mtasa.com/index.php?p=resources&s=details&id=190&vote=2

system paliw lecz sprawny...?
Zapisane
DaKill
Ostrzeżony
Egzekutor
****

Piw: +15/-0
Online Online

Płeć: Mężczyzna
Wiadomości: 403


LopeZ


Zobacz profil WWW
« Odpowiedz #7 : 07 Lipiec 2010, 16:45:06 pm »

Idź z tym na giełdę ofert.
Zapisane


I'll be your commander.
Mister*Łukasz
Członek
*

Piw: +0/-0
Offline Offline

Wiadomości: 6


Zobacz profil
« Odpowiedz #8 : 07 Lipiec 2010, 22:55:10 pm »

mi chodzi o to żeby w przypadku tego bo mam ten skrypt i chodzi mi o to że jak skończy sie paliwo to żeby auto sie automatycznie wyłączyło i nie dało by sie włączyć rozumie ktoś? Tutaj daje kod LUA i czy moze mi ktoś mi podpowiedzieć jak zrobić by po skończeniu się paliwa auto zgasło.
Kod Lua:
function showPlayerFuel()
if guiGetVisible(fuelFrame) == true or guiGetVisible(fuelFrame2) == true then
guiSetVisible( fuelBar1, false )
guiSetVisible ( fuelFrame, false )
guiSetVisible (warningdot1, false )
guiSetVisible( fuelBar2, false )
guiSetVisible ( fuelFrame2, false )
guiSetVisible (warningdot2, false )
end
fuelFrame = guiCreateStaticImage( 0.93, 0.68, 0.05, 0.20, "Petrol/Image/Fuel_Gage.png", true)
fuelBar1 = guiCreateStaticImage( 0.952, 0.701, 0.021, 0.17, "Petrol/Image/Fuel_Dot.png", true)
guiSetVisible( fuelBar1, true )
guiBringToFront ( fuelFrame )
    setTimer ( decFuel1, 30000, 0, getLocalPlayer())
end
addEvent("FullTank", true )
addEventHandler("FullTank", getLocalPlayer(), showPlayerFuel)
addEvent("fullRefill", true)
addEventHandler("fullRefill",refillName, showPlayerFuel)
addEvent("fuelGageShow", true)
addEventHandler("fuelGageShow", getLocalPlayer(), showPlayerFuel)
  
function CurrentFuelIn ( currentFuel )
local sizex = currentFuel["sizex"]
local sizey = currentFuel["sizey"]
local posx = currentFuel["posx"]
local posy = currentFuel["posy"]
fuelFrame2 = guiCreateStaticImage( 0.93, 0.68, 0.05, 0.20, "Petrol/Image/Fuel_Gage.png", true)
fuelBar2 = guiCreateStaticImage( tonumber(posx), tonumber(posy), tonumber(sizex), tonumber(sizey), "Petrol/Image/Fuel_Dot.png", true)
guiSetVisible( fuelBar2, true )
guiBringToFront ( fuelFrame2 )
    setTimer ( decFuel2, 30000, 0, getLocalPlayer())
end
addEvent("CurrentFuel", true)
addEventHandler("CurrentFuel", getLocalPlayer(), CurrentFuelIn)

function startExit ( thePlayer )
if thePlayer == getLocalPlayer() then
hidePlayerFuel()
end
end
addEventHandler("onClientVehicleStartExit", getRootElement(), startExit )

function decFuel2()
local PlayerInCar = getPedOccupiedVehicle( getLocalPlayer() )
if (PlayerInCar ) then
local x, y = guiGetSize( fuelBar2, true )
local NewY = y - 0.001
local Posx, Posy = guiGetPosition ( fuelBar2, true )
local NewPosY = Posy + 0.001
guiSetSize(fuelBar2, x, NewY, true)
guiSetPosition(fuelBar2, Posx, NewPosY, true )
local Positions = {}
Positions ["Size.X"] = x
Positions ["Size.Y"] = NewY
Positions ["Pos.X"] = Posx
Positions ["Pos.Y"] = NewPosY
Positions ["VehicleId"] = getElementModel (PlayerInCar)
triggerServerEvent("Positions", getLocalPlayer(), Positions)
if ( tonumber(gettok(tostring(y),1,49)) == 0.03700) then
warningdot2 = guiCreateStaticImage( 0.9388, 0.802, 0.014, 0.016, "Petrol/Image/warning_dot.png", true)
guiBringToFront (warningdot2)
outputChatBox("-- You Are Quite Low On Fuel", source, 255, 255, 0, true)
if ( math.abs(0.01500 - 0.015001999214292) < 0.0001) then
freezeCarOutOfFuel ()
end
end
end
end

function decFuel1()
local PlayerInCar = getPedOccupiedVehicle( getLocalPlayer() )
if (PlayerInCar ) then
local x, y = guiGetSize( fuelBar1, true )
local NewY = y - 0.001
local Posx, Posy = guiGetPosition ( fuelBar1, true )
local NewPosY = Posy + 0.001
guiSetSize(fuelBar1, x, NewY, true)
guiSetPosition(fuelBar1, Posx, NewPosY, true )
local Positions = {}
Positions ["Size.X"] = x
Positions ["Size.Y"] = NewY
Positions ["Pos.X"] = Posx
Positions ["Pos.Y"] = NewPosY
Positions ["VehicleId"] = getElementModel (PlayerInCar)
triggerServerEvent("Positions", getLocalPlayer(), Positions)
if ( tonumber(gettok(tostring(y),1,49)) == 0.03700) then
warningdot1 = guiCreateStaticImage( 0.9388, 0.802, 0.014, 0.016, "Petrol/Image/warning_dot.png", true)
guiBringToFront (warningdot1)
outputChatBox("-- You Are Quite Low On Fuel", source, 255, 255, 0, true)
if ( math.abs(0.01500 - 0.015001999214292) < 0.0001) then
freezeCarOutOfFuel ()
end
end
end
end

function freezeCarOutOfFuel ()
outFuelMemo = guiCreateMemo(0.10, 0.10, 0.80, 0.60, "Looks Like You Have Run Out Of Fuel Below Are 2 Options, Abandon Vehicle Or Refill($60). Abandoning Your Vehicle Means You Are Not Paying, Refill Is $15 More Than Filling Up At A Garage.", false, helpGui)
playerHelpGuibutton = guiCreateButton( 0.10, 0.90, 0.30, 0.30, "Abandon", false, helpGui)
refillGuibutton = guiCreateButton( 0.60, 0.90, 0.30, 0.30, "Refill", false, helpGui)
showCursor ( false )
guiMemoSetReadOnly (outFuelMemo, false )
addEventHandler ( "onClientGUIClick", playerHelpGuibutton, abandonRefiling, ture )
addEventHandler ( "onClientGUIClick", refillGuibutton, standardRefills , ture )
end
addEvent("freezeCarOutOfFuel", true)
addEventHandler("freezeCarOutOfFuel", getLocalPlayer(), freezeCarOutOfFuel)

function standardRefills ()
local PlayerInCar = getPedOccupiedVehicle( getLocalPlayer() )
local details = {}
details ["VehicleId"] = getElementModel (PlayerInCar)
triggerServerEvent("moneyCheck", getLocalPlayer(), details )
end

function refillStart ()
outputChatBox("-- You Refilled Your Car For $118", getRootElement(), 255, 255, 0, true)
guiSetVisible (helpGui, false )
showCursor ( false)
showPlayerFuel(getRootElement())
end  
addEvent("cashiin", true )
addEventHandler("cashiin", getLocalPlayer(), refillStart)

function abandonRefiling ()
outputChatBox("-- You Have Abandoned Your Car", getRootElement())
guiSetVisible (helpGui, false )
showCursor ( false)
hidePlayerFuel(getRootElement())
triggerServerEvent("-- AbandonVehicle", getLocalPlayer(),"abandon" )
end
addEvent("nocash", true )
addEventHandler("nocash", getLocalPlayer(), abandonRefiling)

function joinGui()
joinGui = guiCreateWindow ( 550, 250, 200, 300, "Welcome", false )
joinGuibutton = guiCreateButton( 0.60, 0.90, 0.30, 0.30, "Akceptuj", true, joinGui)
guiCreateStaticImage( 0.25, 0.50, 0.50, 0.28, "Petrol/Image/Welcome.png", true, joinGui )
declineGuibutton = guiCreateButton( 0.10, 0.90, 0.30, 0.30, "Odrzuc", true, joinGui)
joinMemo = guiCreateMemo(0.10, 0.10, 0.80, 0.30, "Kliknij Akceptuj by zaakceptowac zasady paliwa jak i Regulaminu", true, joinGui)
guiMemoSetReadOnly (joinMemo, true)
showCursor ( true )
    addEventHandler ( "onClientGUIClick", joinGuibutton, triggerServer, false )
addEventHandler ( "onClientGUIClick", declineGuibutton, freezePlayer , false )
addEventHandler ( "onClientGUIClick", joinGuibutton, hideWelcomeFuel, false )
addEventHandler ( "onClientGUIClick", declineGuibutton, hideWelcomeFuel, false )
end
addEvent("Join", true)
addEventHandler("Join",getLocalPlayer(), joinGui )

function triggerServer()
local name = {}
name ["player"] = getLocalPlayer()
triggerServerEvent("OkJoin", getLocalPlayer(), name)
end  

function hideWelcomeFuel ()
guiSetVisible( joinGui, false )
showCursor ( false )
end

function freezePlayer ( )
toggleAllControls ( false )    
    outputChatBox("-- Zostales zablokowany z powodu nie zaakceptowania zasad do nastepnej wizyty na serwerze.", source,  255, 255, 0, true)
end

function hidePlayerFuel ()
if fuelBar1 then
guiSetVisible( fuelBar1, false )
guiSetVisible ( fuelFrame, false )
guiSetVisible (warningdot1, false )
end
if fuelBar2 then
guiSetVisible( fuelBar2, false )
guiSetVisible ( fuelFrame2, false )
guiSetVisible (warningdot2, false )
end
end
addEvent("jacked", true )
addEventHandler("jacked", getLocalPlayer(), hidePlayerFuel )

function petrolwindow (fuelDetails)
local x,y,z = getElementPosition( getLocalPlayer())
petrolwindow = guiCreateWindow ( 550, 250, 200, 300, getZoneName ( x, y, z ).." Stacja Benzynowa P24", false )
paybutton = guiCreateButton( 0.60, 0.90, 0.30, 0.30, "Zatankuj", true, petrolwindow)
guiCreateLabel (0.06, 0.10, 0.96, 0.050, "Stacja P24: "..getZoneName ( x, y, z ), true, petrolwindow)
guiCreateLabel (0.06, 0.16, 0.50, 0.050, "Obecnie masz: "..fuelDetails ["slrpercent"].."%", true, petrolwindow)
guiCreateLabel (0.06, 0.22, 0.96, 0.050, "Koszt: $1.18 per litre", true, petrolwindow)
guiCreateLabel (0.06, 0.28, 0.58, 0.050, "Potrzebne L.: "..fuelDetails ["Percent"].."l", true, petrolwindow)
guiCreateLabel (0.06, 0.31, 0.96, 0.050, "-------------------------", true, petrolwindow)
guiCreateLabel (0.06, 0.37, 0.48, 0.050, "Koszt: $"..fuelDetails ["WorkOut"], true, petrolwindow)
showCursor ( true )
    addEventHandler ( "onClientGUIClick", paybutton, petrolWindowPay, false )
end
addEvent("petrolwindow", true)
addEventHandler("petrolwindow",getLocalPlayer(), petrolwindow)

function petrolNoCash(fuelDetails)
local x,y,z = getElementPosition ( getLocalPlayer())
petrolnocash = guiCreateWindow ( 550, 250, 200, 300, getZoneName ( x, y, z ).." Petrol Station", false )
leavebutton = guiCreateButton  ( 0.60, 0.90, 0.30, 0.30, "Wyjdz", true, petrolnocash)
guiCreateLabel (0.06, 0.10, 0.96, 0.050, "Petrol Station: "..getZoneName ( x, y, z ), true, petrolnocash)
guiCreateLabel (0.06, 0.16, 0.50, 0.050, "Current Fuel: "..fuelDetails ["slrpercent"].."%", true, petrolnocash)
guiCreateLabel (0.06, 0.22, 0.96, 0.050, "Fuel Price: $1.18 per litre", true, petrolnocash)
guiCreateLabel (0.06, 0.28, 0.58, 0.050, "Litres Needed: "..fuelDetails ["Percent"].."lt", true, petrolnocash)
guiCreateLabel (0.06, 0.31, 0.96, 0.050, "-------------------------", true, petrolnocash)
noCashMemo = guiCreateMemo  (0.10, 0.38, 0.80, 0.48, "Im Sorry But I Am Afraid That You Will Have To Leave, You Do Not Have Enough Money To Purchase Any Petrol", true, petrolnocash)
guiMemoSetReadOnly (noCashMemo, true)
showCursor ( true )
    addEventHandler ( "onClientGUIClick", leavebutton, petrolWindowLeave, false )
end
addEvent("petrolNoCash", true )
addEventHandler("petrolNoCash", getLocalPlayer(), petrolNoCash)
 
function petrolWindowPay ()
    guiSetVisible ( petrolwindow, false )
showCursor ( false )
outputChatBox ( "-- Zatankowales do Pelna.", source, 255, 255, 0, true )
end
 
function petrolWindowLeave ()
guiSetVisible ( petrolnocash, false )
showCursor ( false )
outputChatBox ( "-- Dziekujemy i zapraszamy ponownie", source, 255, 255, 0, true )
end
Zapisane
I.K.
Egzekutor
****

Piw: +58/-8
Offline Offline

Wiadomości: 313


Mam burdel w głowie


Zobacz profil
« Odpowiedz #9 : 25 Lipiec 2010, 12:48:48 pm »

Nie oglądałem kodu, ale sam robiłem kiedyś system paliwa, to ci powiem, co wiem z właśnego doświadczenia:
- musisz mieć tam gdzieś timer, czy cokolwiek, co sprawdza poziom paliwa. Jeśli dojdzie do zera, zwyczajnie wyłączasz silnik tym.
- żeby nie dało się włączyć, musisz po wejściu gracza (tu[/url) sprawdzić poziom paliwa. Jeśli jest zerowy, traktujesz samochód [url=http://wiki.mtasa.com/wiki/SetVehicleEngineState]tym.
Zapisane

WYPIERDALAJ
Strony: [1]   Do góry
  Drukuj  
 
Skocz do:  

Reklama
Działa na MySQL Działa na PHP Powered by SMF 1.1.11 | SMF © 2006-2007, Simple Machines LLC | Sitemap Prawidłowy XHTML 1.0! Prawidłowy CSS!
Strona wygenerowana w 0.096 sekund z 23 zapytaniami.