TheTroll
Pan Majster
Wiek: 38 Na forum: 4764 dni Posty: 219
Nick w MP: TheTroll
Piwa : 1114
Witam, znalazlem skrypt do mta na rozworzenie towar?w ale tez skrypt nie jest jeszcze gotowy i tu mam takie pytanie jak mam zrobic aby po przewiezieniu towaru dostawac kase i punkty score ? Kod:
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, Burrito
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)