|
Wysłany: 2014-12-22, 01:43
|
|
darekpo799


Wiek: 40 Na forum: 4383 dni Posty: 10
Nick w MP: darekpo799
|
|
|
|
Witam mam problem z praca kierowca autobusu poniewasz mam jeden przestanek i po nim bym chcial zeby po tym przestanku praca sie konczyla i pisalo "zakonczyles prace" i zeby potym jednym przestanku odrazu sie dostawalo kase a nie dopiero po wyjsciu z busa i zebym mugl sam ustawic ile ma dawac graczowi kasy.
co dopisac do skryptu i gdzie ?
Piwko napewno poleci
local rootElement = getRootElement()
local busses = {[431] = true, [437] = true}
local busTable = {
[1]={-1990.33325, 138.666671, 26.948751},
}
createBlip(1256.6, -1812.2, 13.41, 55, 3, 0, 0, 255, 255, 0, 250)
function getNewBusLocation(thePlayer, ID)
local x, y, z = busTable[ID][1], busTable[ID][2], busTable[ID][3]
triggerClientEvent(thePlayer,"bus_set_location",thePlayer,x,y,z)
end
function busJob(thePlayer)
local theVehicle = getPedOccupiedVehicle (thePlayer)
local id = getElementModel(theVehicle)
if id == 431 or id == 437 then
local x, y, z = getNewBusLocation(thePlayer, 1)
setElementData(thePlayer,"buszp",0)
setElementData(thePlayer,"busData",1)
else
end
end
addEventHandler("onVehicleEnter",rootElement,busJob)
function busStart(thePlayer)
local theVehicle = getPedOccupiedVehicle (thePlayer)
local id = getElementModel(theVehicle)
if id == 431 or id == 437 then
outputChatBox("Zacz??e? prac? busiarza!", thePlayer, 255, 255, 0)
end
end
addEventHandler("onVehicleEnter",rootElement,busStart)
addEvent("bus_finish",true)
addEventHandler("bus_finish",rootElement,
function (client)
if not isPedInVehicle(client) then return end
if not busses[getElementModel(getPedOccupiedVehicle(client))] then return end
local zarp = getElementData(client, "buszp")
local money = math.random(10,20)
setElementData(client, "buszp", zarp + money)
if #busTable == tonumber(getElementData(client,"busData")) then
setElementData(client,"busData",1)
else
setElementData(client,"busData",tonumber(getElementData(client,"busData"))+1)
end
getNewBusLocation(client, tonumber(getElementData(client,"busData")))
end)
function giveMoney(thePlayer)
local theVehicle = getPedOccupiedVehicle (thePlayer)
local id = getElementModel(theVehicle)
if id == 431 or 437 then
local gpm = getElementData(thePlayer, "buszp")
if ((gpm) > 0 ) then
givePlayerMoney(thePlayer, tonumber(gpm))
outputChatBox("Dosta?e? " .. gpm .. "$", thePlayer, 0, 140, 240)
setElementData(thePlayer, "buszp", 0)
end
end
end
addEventHandler("onVehicleExit", rootElement, giveMoney)
addEventHandler("onPlayerQuit", rootElement, giveMoney)
|
|
|
|
|
|
|
Wysłany: 2014-12-22, 09:57
|
|
Maximerr
Programmer PHP, LUA


Wiek: 25 Na forum: 4427 dni Posty: 548
Piwa: 1051
|
|
|
|
darekpo799, b?agam Ci?, popraw ortografi? bo, a? oczy piek?.
Co do problemu, mo?e ods?onisz triggera, poniewa? tutaj nie ma nawet zmiennej markera.
I trzecia sprawa, wstawiaj kod w [lua]
|
|
|
|
|
|
| Tagi: praca :: autobusy |
Anonymous


Na forum: 245 dni
Posty: 1

|
Anonymous Koniecznie zajrzyj na:
|
|
|
|
|