Wysłany: 2012-08-30, 19:40
HartHol
Log Out
Wiek: 27 Na forum: 5037 dni Posty: 116
Nick w MP: HartHol
Piwa : 14
Kod:
source = getLocalPlayer()
function closegui()
guiSetVisible(GUIEditor_Window[1],false)
showCursor(false)
end
outputChatBox("Skrypt wystartowa?!",255,0,0)
local towar = 0
if towar == 0 then
outputChatBox("Zmienna towar wynosi 0", 0, 255, 0)
else
outputChatBox("Zmienna towar nie wynosi 0.", 0, 255, 0)
end
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)
pozmark = v[1]
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 pozmark == pozblip then
setElementData(source,"Pkt",tonumber(Pkt + 1))
towar = 0
rmoney = math.random(350,700)
givePlayerMoney ( source, rmoney )
outputChatBox("Roz?adowa?e? trociny!", player)
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)
pozblip = dest[1]
else
outputChatBox("Aby za?adowa? ten towar musisz mie? minimum 0 punkt?w!", 0, 255, 0)
end
end
addEventHandler( "onClientGUIClick", GUIEditor_Button[1], towarTrociny)
Prosz? o pomoc, poniewa? za?aduj?c towar i wje?d?aj?c w wylosowany marker skrypt wypisuje "To nie jest ten roz?adunek", a error?w i warning'?w nie ma.
PS. Prosz? bez g?upich odpowiedzi typu: nikt nie b?dzie ci robi? tego za darmo lub cz?owieku je?eli takiego prostego problemu nie umiesz naprawi? to spadaj na drzewo.
Więcej szczegółów
Wystawiono 1 piw(a):Matinews12
Wysłany: 2012-08-30, 20:09
luki123luki123
Place Game
Wiek: 28 Na forum: 5275 dni Posty: 1948
Nick w MP: LuKiO
Piwa : 6101
HartHol , nie by?o lepiej tego robi? na xml ju?
Wysłany: 2012-08-30, 20:17
Piorun
Wiek: 32 Na forum: 6712 dni Posty: 1837
Nick w MP: Piorun
Piwa : 516
Cytat: HartHol, nie by?o lepiej tego robi? na xml ju?
Tabelami ?atwiej i szybciej .
Wysłany: 2012-08-31, 07:39
HartHol
Log Out
Wiek: 27 Na forum: 5037 dni Posty: 116
Nick w MP: HartHol
Piwa : 14
Wysłany: 2012-08-31, 15:33
luki123luki123
Place Game
Wiek: 28 Na forum: 5275 dni Posty: 1948
Nick w MP: LuKiO
Piwa : 6101
HartHol , morzecz zrobic bez math.random i da? na givePlayerMoney kase
Wysłany: 2012-08-31, 15:43
Riot
3X
Wiek: 29 Na forum: 5729 dni Posty: 1123
Nick w MP: Riot/3X
Piwa : 286
luki123luki123 , math.random MUSI by? by losowa?o miejsce roz?adowania. A ostatnio jak co? kombinowa?em przy stronie clienta z dawaniem kasy to kiepsko dzia?a?o. Zr?b triggera i po stronie serwera dawaj kase, jak tak zawsze robie
Wysłany: 2012-09-11, 15:35
HartHol
Log Out
Wiek: 27 Na forum: 5037 dni Posty: 116
Nick w MP: HartHol
Piwa : 14
Kod:
source = getLocalPlayer()
local towar = 0
-- Tworzenie marker?w i blip?w oraz inicjowanie ich
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])
id = getElementData(destmarker, "id")
createBlip(v[1],v[2],v[3], 51)
end
-- Funkcja roz?adunek
function rozladunek(source)
for b, tow in ipairs (pack) do
if towar == b and tostring(id) == tostring(id2) then
triggerServerEvent("punkty", localPlayer, points)
towar = 0
rmoney = math.random(tow[4],tow[5])
triggerServerEvent("kasa", localPlayer, rmoney)
outputChatBox("Roz?adowa?e?: " .. tow[2], player)
destroyElement(destblip)
else
outputChatBox("To nie jest ten roz?adunek!", 0, 255, 0)
end
end
end
-- Funkcje za?adunk?w
function towarTrociny()
dest = markers[math.random(1, #markers)]
if 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])
id2 = getElementData(source, "id2")
outputChatBox("Id: " .. tostring(id) .. "Id 2: " .. tostring(id2), player, 0, 255, 0)
else
outputChatBox("Aby za?adowa? ten towar musisz mie? minimum 0 punkt?w!", 0, 255, 0)
end
end
Zrobi?em tak, poniewa? tak pisali z forum mtasa.com. B??d?w nie ma, ale mo?na roz?adowa? towar byle gdzie. Pomocy
Wysłany: 2012-09-11, 16:42
Piorun
Wiek: 32 Na forum: 6712 dni Posty: 1837
Nick w MP: Piorun
Piwa : 516
Cytat: Zrobi?em tak, poniewa? tak pisali z forum mtasa.com.
Niech oni Ci w takim razie pomagaj? .
Wysłany: 2012-09-12, 14:18
HartHol
Log Out
Wiek: 27 Na forum: 5037 dni Posty: 116
Nick w MP: HartHol
Piwa : 14
Jakbym nie chcia? waszej pomocy (+ beznadziejnie g?upich odpowiedzi np. ^^^) to nie pisa?bym tutaj.
Tagi: skrypt :: rozwożenia :: towarów/paczek.
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: