Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2013-03-14, 02:58


twitter89







Wiek: 29
Na forum: 5032 dni
Posty: 23



Respekt: 50

witajcie pom??cie mi zrobi? ten skrypt na paczki. :( :(


problem polega na tym ?e gdy pojad? w marker wy?wietla si? lista jest tylko jeden towar trociny za 0 Pkt chc? ?eby by?o wi?cej za ile? tam score np 10,15,20,25,30,35 i tak dalej 2 problem jest taki gdy wezm? te trociny jad? do znaczka czerwonego roz?aduje i nie dostaje kasy bo pkt pisz? 0 to wiem ?e nie doda oto kody.


1 kod:


source = getLocalPlayer()

function closegui()
guiSetVisible(GUIEditor_Window[1],false)
showCursor(false)
end

outputChatBox("Skrypt wystartowa?!",255,0,0)
local towar = 0

GUIEditor_Window = {}
GUIEditor_Button = {}
GUIEditor_Window[1] = guiCreateWindow(131,55,586,509,"",false)
GUIEditor_Button[1] = guiCreateButton(23,42,130,32,"Trociny 0 Pkt.",false,GUIEditor_Window[1])
GUIGetText = guiCreateLabel ( 0.45,0.48, 0.10, 0.04,"Trociny",true,GUIEditor_Window[1] )
GUIEditor_Button[2] = guiCreateButton(18,383,550,54,"Zaladuj",false,GUIEditor_Window[1])
GUIEditor_Button[3] = guiCreateButton(130,454,332,46,"Zamknij",false,GUIEditor_Window[1])
addEventHandler( "onClientGUIClick", GUIEditor_Button[3], closegui )
guiSetVisible(GUIEditor_Window[1], false)

local markers = {
{ -1725, -121, 2 },
{-1854, 1402, 6.1},
{-2282, 2278, 4,5},
{-367, 1547, 75,1},
{345, 2534, 16,2},
{1641, 2412, 10},
{-2887, 503, 4},
{-1515, 721, 6},
{-683, 965, 12},
{948, 2279, 11},
{1488, 2146, 10},
{1910, 2157, 10},
{2242, 1977, 9},
{-658, 2318, 138},
{-2054, -2565, 30},
{-1416, -1468, 101},
{-605, -483, 25},
{-55, -326, 5},
{1077, -307, 75},
{-2644, 1334, 7},
{2481, 2796, 10},
{-857, -1944, 15},
{-87, -1574, 2},
{-2264, -1688, 480},
{ -2029.1010742188, 172.45364379883, 27.35425567627 }
}

local pmoney = getPlayerMoney(source)

points = getElementData(getLocalPlayer(), "Pkt")

local vehicle_ids = {[524] = true, [578] = true, [403] = true, [514] = true, [414] = true, [515] = true, [440] = true, [455] = true}
-- Cement Truck, DFT-30, Linerunner, Tanker, Mule, RoadTrain, Rumpo, Flatbed

dest = markers[math.random(1, #markers)]

for k, v in ipairs (markers) do
destmarker = createMarker(v[1], v[2], v[3], "cylinder", 3, 255, 255, 0, 255)
setElementData(destmarker, "id", v[4])
createBlip(v[1],v[2],v[3], 51)
end

function towary(hitElement)
local vehicle = getPedOccupiedVehicle(hitElement)
if vehicle then
if vehicle_ids[getElementModel(vehicle)] then
if towar == 0 then
guiSetVisible(GUIEditor_Window[1], true)
showCursor(true)
else
rozladunek()
end
else
outputChatBox("To nie jest pojazd dostawczy!", 0, 255, 0)
end
else
outputChatBox("Aby za?adowa? towar musisz mie? pojazd dostawczy!", 0, 255, 0)
end
end
addEventHandler( "onClientMarkerHit", getRootElement(), towary )

function rozladunek()
if towar == 1 and id == id2 then
setElementData(getLocalPlayer(),"points",tonumber(points + 1))
towar = 0
rmoney = math.random(350,700)
givePlayerMoney ( source, rmoney )
outputChatBox("Roz?adowa?e? trociny!", player)
destroyElement(destblip)
else
outputChatBox("To nie jest ten roz?adunek!", 0, 255, 0)
end
end

function towarTrociny()
if points >= 0 and towar == 0 then
towar = 1
outputChatBox("Za?adowa?e? trociny!", player)
destblip = createBlip( dest[1], dest[2], dest[3], 41, 2, 255, 255, 0, 0, 100)
setElementData(source, "id2", dest[4])
else
outputChatBox("Aby za?adowa? ten towar musisz mie? minimum 0 punkt?w!", 0, 255, 0)
end
end
addEventHandler( "onClientGUIClick", GUIEditor_Button[1], towarTrociny)



2 kod:


local markers = {
{ -1725, -121, 2 },
{-1854, 1402, 6.1},
{-2282, 2278, 4,5},
{-367, 1547, 75,1},
{345, 2534, 16,2},
{1641, 2412, 10},
{-2887, 503, 4},
{-1515, 721, 6},
{-683, 965, 12},
{948, 2279, 11},
{1488, 2146, 10},
{1910, 2157, 10},
{2242, 1977, 9},
{-658, 2318, 138},
{-2054, -2565, 30},
{-1416, -1468, 101},
{-605, -483, 25},
{-55, -326, 5},
{1077, -307, 75},
{-2644, 1334, 7},
{2481, 2796, 10},
{-857, -1944, 15},
{-87, -1574, 2},
{-2264, -1688, 480},
{ -2029.1010742188, 172.45364379883, 27.35425567627 }
}

local pmoney = getPlayerMoney(source)

points = getElementData(getLocalPlayer(), "Pkt")

local vehicle_ids = {[524] = true, [578] = true, [403] = true, [514] = true, [414] = true, [515] = true, [440] = true, [455] = true}
-- Cement Truck, DFT-30, Linerunner, Tanker, Mule, RoadTrain, Rumpo, Flatbed

local dest = markers[math.random(1, #markers)]

local aplayer = getPlayerFromName ( nick )

local towar = 0

local markers_objects = {}
local i = 0;

for k, v in ipairs (markers) do
markers_objects[i] = createMarker(v[1], v[2], v[3], "cylinder", 3, 255, 255, 0, 255)
createBlip(v[1],v[2],v[3], 51)
i++;
end

function towary()
local v = getPedOccupiedVehicle(element)
if getElementType(v) == "vehicle" then
if vehicle_ids[getElementModel(v)] then
if towar == 0 and destblip ~= destmarker then
if source == markers_objects[i] then
GUIEditor_Window[1] = guiCreateWindow(131,55,586,509,"",false)
GUIEditor_Button[1] = guiCreateButton(5,42,130,32,"Trociny 0 Pkt.",false,GUIEditor_Window[1])
GUIEditor_Button[2] = guiCreateButton(18,383,550,54,"Zaladuj",false,GUIEditor_Window[1])
addEventHandler("onClientGUIClick",GUIEditor_Button[2],towarTrociny)
GUIEditor_Button[3] = guiCreateButton(130,454,332,46,"Zamknij",false,GUIEditor_Window[1])
guiSetVisible(GUIEditor_Window[1], true)
showCursor(true)
end
else
rozladunek()
end
else
outputChatBox("To nie jest pojazd dostawczy!", 0, 255, 0)
end
else
outputChatBox("Aby za?adowa? towar musisz mie? pojazd dostawczy!", 0, 255, 0)
end
end

function rozladunek()
if towar == 1 and destblip == destmarker then
setElementData(source,"Pkt",tonumber(Pkt + 1))
rmoney = math.random(350,700)
givePlayerMoney ( aplayer, rmoney )
else
outputChatBox("To nie jest ten roz?adunek!", 0, 255, 0)
end
end

function towarTrociny (player)
if points >= 0 and towar == 0 then
local towar = 1
outputChatBox("Za?adowa?e? trociny!", player)
local destblip = createBlip( dest[1], dest[2], dest[3], 41, 2, 255, 255, 0, 0, 100)
else
outputChatBox("Aby za?adowa? ten towar musisz mie? minimum 0 punkt?w!", 0, 255, 0)
end
end

addEventHandler("onClientMarkerHit",getRootElement(),towary)
addEventHandler("onClientGUIClick",GUIEditor_Button[1],towarTrociny)

pozdrawiam i prosz? o pomoc jak co? podaje numer gadu: 24423999

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-03-14, 08:10


Riot

3X






Wiek: 29
Na forum: 5729 dni
Posty: 1123
Nick w MP: Riot/3X

Piwa: 286

Respekt: 123
Respekt: 123

Ludzie! B?AGAM. Nauczcie si? analizowa? kod, chocia? nie jest tw?j. Masz jaki? przycisk 'Trociny' + podpi?t? pod to funkcj? i dziwisz si? czemu reszty nie ma...BO JEJ NIE MA W KODZIE.

Gdy jeste? nowy zapraszam do poradnik?w i na wiki.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-03-14, 14:45


Brzysiek

Skrypter pralek






Wiek: 27
Na forum: 5198 dni
Posty: 488
Nick w MP: Brzysiek

Piwa: 1034

Respekt: 360
Respekt: 360Respekt: 360Respekt: 360Respekt: 360

Skrypt napisany przez HartHola, na forum MTA:SA udost?pni? linka ;)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-03-14, 18:36


HartHol

Log Out






Wiek: 27
Na forum: 5037 dni
Posty: 116
Nick w MP: HartHol

Piwa: 14

Respekt: 50

Tak, dok?adnie. To jest m?j skrypt - jeszcze kiedy nie potrafi?em napisa? samemu kodu bez pomocy innych, wi?c nie polecam korzysta? z niego.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-03-16, 20:17


twitter89







Wiek: 29
Na forum: 5032 dni
Posty: 23



Respekt: 50

HartHol je?li masz poprawk? tego skryptu na towary to daj mi co dzia?a prawid?owo pozdrawiam postawie za pomoc :piwo: :piwo: :piwo: :piwo: :piwo:

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-03-16, 21:13


Riot

3X






Wiek: 29
Na forum: 5729 dni
Posty: 1123
Nick w MP: Riot/3X

Piwa: 286

Respekt: 123
Respekt: 123

"twitter89" napisał/a:

HartHol je?li masz poprawk? tego skryptu na towary to daj mi co dzia?a prawid?owo pozdrawiam postawie za pomoc :piwo: :piwo: :piwo: :piwo: :piwo:


Ten kod dzia?a poprawnie, w nim jest tylko by by? jeden towar (Trociny).

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-03-17, 07:46


HartHol

Log Out






Wiek: 27
Na forum: 5037 dni
Posty: 116
Nick w MP: HartHol

Piwa: 14

Respekt: 50

Mo?e i tak, ale z tego co ja pami?tam to mia?em bardzo du?o problem?w z nim.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-03-17, 14:45


twitter89







Wiek: 29
Na forum: 5032 dni
Posty: 23



Respekt: 50

Ok harthol to podaj gg i sie zgadamy.

[ Dodano: 2013-03-17, 14:47 ]
Ziomek11 powiem tak on nie jest poprawnie napisany bo mam skrypt na bramki i jak przejade przez bramke to pisze roz?adowa?e? towar wi?c albo si? gryzie albo co? jest z nim nie tak ani nie daje kasy za trociny! pozdrawiam

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-03-17, 17:37


HartHol

Log Out






Wiek: 27
Na forum: 5037 dni
Posty: 116
Nick w MP: HartHol

Piwa: 14

Respekt: 50

Pisz na pw.

PS. Nie mam poprawionego kodu ( w ca?o?ci ).

Postaw piwo autorowi tego posta
 

 
Tagi: trucksystem
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku