MTASA TÜRK
Türkiye'nin En Güncel MTA Platformu


[YARDIM] Görevdeki Araba

0 Üye ve 1 Ziyaretçi konuyu incelemekte.

Çevrimdışı Speaw

  • Yeni Üye
  • *
    • İleti: 69
: 11 Haziran 2017, 17:55:46
Görevi alınca arabadan inmeyi nasıl engellerim inmicek arabadan ve araba hasar almıcak.
« Son Düzenleme: 11 Haziran 2017, 19:27:09 Gönderen: Narkoz »
 


MTASA TÜRK

[YARDIM] Görevdeki Araba
« : 11 Haziran 2017, 17:55:46 »

Çevrimdışı Mahlukat

  • Scripter
  • *
    • İleti: 526
Yanıtla #1 : 11 Haziran 2017, 19:54:18
Sanırım böyle araçtan inmesini engelleme
Kod: lua
Arac = createVehicle ( ID, x, y, z, 0, 0, r )
addEventHandler ( "onVehicleStartExit", Arac, function ()
cancelEvent ()
end )
 


Çevrimdışı Speaw

  • Yeni Üye
  • *
    • İleti: 69
Yanıtla #2 : 12 Haziran 2017, 14:48:10
Kod: lua
addEvent("openinf_voditel", true)
screenWidth, screenHeight = guiGetScreenSize()
function windm ()
if not getElementData ( localPlayer, "trash_working") then
  infowind = guiCreateWindow(screenWidth - 700, screenHeight - 500, 200, 229, "Posta Teslimat Görevi", false)
  infotext = guiCreateMemo(15,20,165,150,"Posta Tesmilat Görevini Bitir Ve ₺20000 Al !",false,infowind)
  guiMemoSetReadOnly( infotext, true )
  guiSetFont(text2, "default-bold-small")
  showCursor(true)
  guiSetVisible ( infowind , true)
  guiWindowSetSizable(infowind, false)
  Button_Glose = guiCreateButton(10, 174, 90, 45, "İptal", false, infowind)
  Button_Start = guiCreateButton(100, 174, 90, 45, "Kabul", false, infowind)
  addEventHandler("onClientGUIClick", Button_Start, kit )
addEventHandler("onClientGUIClick", Button_Glose, noshow )
else
for i, v in ipairs ( createdPickups ) do
if isElement ( v ) then
local pick2 = getElementData ( v, "pick2")
if isElement ( pick2 ) then
destroyElement ( pick2 )
end
local icon = getElementData ( v, "icon" )
if isElement ( icon ) then
destroyElement ( icon )
end
destroyElement ( v )
end
end
triggerServerEvent ( "finitoWork_voditel", localPlayer )
setElementData ( localPlayer, "trash_working", false )
end
end
addEventHandler("openinf_voditel", root, windm )
function noshow ()
 if ( source == Button_Glose ) then
   destroyElement ( infowind )
   showCursor ( false )
 end
end
addEventHandler("onClientVehicleDamage", root, handleVehicleDamage)
function kit ()
 if ( source == Button_Start ) then
startWorking()
    destroyElement ( infowind )
    showCursor ( false )
  end
end

addEvent ( "pay", true )
function giving ()

end
addEventHandler("pay", resourceRoot, giving )
addEvent ( "get", true )
function peremen (plr)
 plr = getLocalPlayer ()
end
addEventHandler("get", resourceRoot, peremen )

pickupSpawns = {
{ -2053,-2527,30 },

}

max_pickups_set = 12 -- como você precisa pegar para o fim dos captadores

createdPickups = {}

max_pickups = max_pickups_set
if max_pickups_set > #pickupSpawns then
max_pickups = #pickupSpawns
end

function startWorking ()
if not getElementData ( localPlayer, "trash_working" ) then
createdPickups = {}
triggerServerEvent ( "picku_voditel", localPlayer )
setElementData ( localPlayer, "trash_working", true )
setElementData ( localPlayer, "trash_working_hit", 0 )
outputChatBox ( "Görevi Başarıyla Aldın ", 255, 255, 255, false )

for i, v in ipairs ( pickupSpawns ) do
local pick = createMarker ( v[1],v[2],v[3], "checkpoint", 4.0, 255, 255, 255 )
local pick2 = createPickup ( v[1],v[2],v[3], 3, 1314, 10000 )
setElementData ( pick, "taken", false )
setElementData ( pick, "pick2", pick2 )
setElementData ( pick, "bus_pickup", true )
setElementData ( pick, "id", s )
if i == 1 then
local icon = createBlipAttachedTo ( pick, 41, 2 )
setElementData ( pick, "icon", icon )
end
table.insert (createdPickups, pick)
end
end
end

function clientPickupHit(thePlayer, matchingDimension)
        if thePlayer == localPlayer and getElementData ( source, "bus_pickup" ) and not getElementData ( source, "taken" ) then
                setElementData ( source, "taken", true )
                outputChatBox ( "Tebrikler Görevi Bitirdin Ve ₺20000 Aldın ", 255, 100, 100, true )
                triggerServerEvent ( "giveMoneyFromClient_voditel", localPlayer, 20000 )
                local hitted = getElementData ( localPlayer, "trash_working_hit" ) or 0
                hitted = hitted+1
                triggerServerEvent ( "experience", localPlayer, 20 )
                local pick2 = getElementData ( source, "pick2" )
                if isElement ( pick2 ) then
                        destroyElement ( pick2 )
                end
                local icon = getElementData ( source, "icon" )
                if isElement ( icon ) then
                        destroyElement ( icon )
                end
local icon = getElementData ( source, "icon" )
if isElement ( icon ) then
destroyElement ( icon )
end
destroyElement(source)
setElementData ( localPlayer, "trash_working_hit", hitted)
if hitted >= max_pickups then
for i, v in ipairs ( createdPickups ) do
if isElement ( v ) then
local pick2 = getElementData ( v, "pick2")
if isElement ( pick2 ) then
destroyElement ( pick2 )
end
local icon = getElementData ( v, "icon" )
if isElement ( icon ) then
destroyElement ( icon )
end
destroyElement ( v )
end
end
setElementData ( localPlayer, "trash_working", false )
triggerServerEvent ( "finitoWork_voditel", localPlayer )
return true
end
if createdPickups[hitted+1] then
local icon = createBlipAttachedTo ( createdPickups[hitted+1], 41, 2 )
setElementData ( createdPickups[hitted+1], "icon", icon )
end
end
end
addEventHandler ( "onClientMarkerHit", getRootElement(), clientPickupHit )








Görev sc si bu ben kodu yerleştiremedim birde arabanın hasar almasını patlamasını nasıl engellerim o koduda yerleştirirmisiniz
 


Çevrimdışı Mahlukat

  • Scripter
  • *
    • İleti: 526
Yanıtla #3 : 12 Haziran 2017, 15:03:28
Linki görebilmek için Kayıt olun yada Giriş yapın.
Görev sc si bu ben kodu yerleştiremedim birde arabanın hasar almasını patlamasını nasıl engellerim o koduda yerleştirirmisiniz
server.lua atarmısın lütfen :c
 


Çevrimdışı Speaw

  • Yeni Üye
  • *
    • İleti: 69
Yanıtla #4 : 12 Haziran 2017, 15:26:51
Linki görebilmek için Kayıt olun yada Giriş yapın.
server.lua atarmısın lütfen :c
Kod: lua
jobm = createMarker ( -1978,106,28 - 1.1, "cylinder", 1.5, 255, 0, 0, 170 )
myBlip = createBlipAttachedTo ( jobm, 56 )
 
give_skin = 255 -- скин, который выдается водиле
function enter (element)
        if getElementType ( element ) == "player" then
                        triggerClientEvent ( element, "openinf_voditel", element)
        end
end
addEventHandler( "onMarkerHit", jobm, enter )
addEvent ( "picku_voditel", true )
 
function create ()
   local jobvehicle = createVehicle ( 459, -1990, 102, 27 )
        warpPedIntoVehicle ( source, jobvehicle )
        setElementData ( source, "working_veh", jobvehicle )
        setElementModel ( source, give_skin)
                setElementData(source,"Mta",true)
end
addEventHandler ( "picku_voditel", root, create )
 
addEvent ( "finitoWork_voditel", true )
 
function finitoWorkS ()
        local veh = getElementData ( source, "working_veh" )
        if isElement ( veh ) then
                destroyElement ( veh )
                setElementData ( source, "working_veh", false )
                                removeElementData(source,"Mta",true )
        end
end
addEventHandler ( "finitoWork_voditel", root, finitoWorkS )
 
addEvent ( "giveMoneyFromClient_voditel", true )
 
function giveMoneyFromClientS (amount)
    givePlayerMoney ( source, amount )
end
addEventHandler ( "giveMoneyFromClient_voditel", root, giveMoneyFromClientS )
 


Çevrimdışı Mahlukat

  • Scripter
  • *
    • İleti: 526
Yanıtla #5 : 12 Haziran 2017, 16:25:44
client.lua
Kod: lua
addEvent("openinf_voditel", true)
screenWidth, screenHeight = guiGetScreenSize()
function windm ()
        if not getElementData ( localPlayer, "trash_working") then
                  infowind = guiCreateWindow(screenWidth - 700, screenHeight - 500, 200, 229, "Posta Teslimat Görevi", false)
                  infotext = guiCreateMemo(15,20,165,150,"Posta Tesmilat Görevini Bitir Ve ?20000 Al !",false,infowind)
                  guiMemoSetReadOnly( infotext, true )
                  guiSetFont(text2, "default-bold-small")
                  showCursor(true)
                  guiSetVisible ( infowind , true)
                  guiWindowSetSizable(infowind, false)
                  Button_Glose = guiCreateButton(10, 174, 90, 45, "İptal", false, infowind)
                  Button_Start = guiCreateButton(100, 174, 90, 45, "Kabul", false, infowind)
                  addEventHandler("onClientGUIClick", Button_Start, kit )
                        addEventHandler("onClientGUIClick", Button_Glose, noshow )
        else
                for i, v in ipairs ( createdPickups ) do
                        if isElement ( v ) then
                                local pick2 = getElementData ( v, "pick2")
                                if isElement ( pick2 ) then
                                        destroyElement ( pick2 )
                                end
                                local icon = getElementData ( v, "icon" )
                                if isElement ( icon ) then
                                        destroyElement ( icon )
                                end
                                destroyElement ( v )
                        end
                end
                triggerServerEvent ( "finitoWork_voditel", localPlayer )
                setElementData ( localPlayer, "trash_working", false )
        end
end
addEventHandler("openinf_voditel", root, windm )
function noshow ()
 if ( source == Button_Glose ) then
   destroyElement ( infowind )
   showCursor ( false )
 end
end
--addEventHandler("onClientVehicleDamage", root, handleVehicleDamage)
function kit ()
 if ( source == Button_Start ) then
        startWorking()
    destroyElement ( infowind )
    showCursor ( false )
  end
end
 
addEvent ( "pay", true )
function giving ()
 
end
addEventHandler("pay", resourceRoot, giving )
addEvent ( "get", true )
function peremen (plr)
 plr = getLocalPlayer ()
end
addEventHandler("get", resourceRoot, peremen )
 
pickupSpawns = {
        { -2053,-2527,30 },
               
}
 
max_pickups_set = 12 -- como você precisa pegar para o fim dos captadores
 
createdPickups = {}
 
max_pickups = max_pickups_set
if max_pickups_set > #pickupSpawns then
        max_pickups = #pickupSpawns
end
 
function startWorking ()
        if not getElementData ( localPlayer, "trash_working" ) then
                createdPickups = {}
                triggerServerEvent ( "picku_voditel", localPlayer )
                setElementData ( localPlayer, "trash_working", true )
                setElementData ( localPlayer, "trash_working_hit", 0 )
                        outputChatBox ( "Görevi Başarıyla Aldın ", 255, 255, 255, false )           
                               
                for i, v in ipairs ( pickupSpawns ) do
                        local pick = createMarker ( v[1],v[2],v[3], "checkpoint", 4.0, 255, 255, 255 )
                        local pick2 = createPickup ( v[1],v[2],v[3], 3, 1314, 10000 )
                        setElementData ( pick, "taken", false )
                        setElementData ( pick, "pick2", pick2 )
                        setElementData ( pick, "bus_pickup", true )
                        setElementData ( pick, "id", s )
                        if i == 1 then
                                local icon = createBlipAttachedTo ( pick, 41, 2 )
                                setElementData ( pick, "icon", icon )
                        end
                        table.insert (createdPickups, pick)
                end
        end
end     
 
function clientPickupHit(thePlayer, matchingDimension)
        if thePlayer == localPlayer and getElementData ( source, "bus_pickup" ) and not getElementData ( source, "taken" ) then
                setElementData ( source, "taken", true )
                outputChatBox ( "Tebrikler Görevi Bitirdin Ve ?20000 Aldın ", 255, 100, 100, true )
                triggerServerEvent ( "giveMoneyFromClient_voditel", localPlayer, 20000 )
                local hitted = getElementData ( localPlayer, "trash_working_hit" ) or 0
                hitted = hitted+1
                triggerServerEvent ( "experience", localPlayer, 20 )
                local pick2 = getElementData ( source, "pick2" )
                if isElement ( pick2 ) then
                        destroyElement ( pick2 )
                end
                local icon = getElementData ( source, "icon" )
                if isElement ( icon ) then
                        destroyElement ( icon )
                end
                local icon = getElementData ( source, "icon" )
                if isElement ( icon ) then
                        destroyElement ( icon )
                end
                destroyElement(source)
                setElementData ( localPlayer, "trash_working_hit", hitted)
                if hitted >= max_pickups then
                        for i, v in ipairs ( createdPickups ) do
                                if isElement ( v ) then
                                        local pick2 = getElementData ( v, "pick2")
                                        if isElement ( pick2 ) then
                                                destroyElement ( pick2 )
                                        end
                                        local icon = getElementData ( v, "icon" )
                                        if isElement ( icon ) then
                                                destroyElement ( icon )
                                        end
                                        destroyElement ( v )
                                end
                        end
                        setElementData ( localPlayer, "trash_working", false )
                        triggerServerEvent ( "finitoWork_voditel", localPlayer )
                        return true
                end
                if createdPickups[hitted+1] then
                        local icon = createBlipAttachedTo ( createdPickups[hitted+1], 41, 2 )
                        setElementData ( createdPickups[hitted+1], "icon", icon )
                end
        end
end
addEventHandler ( "onClientMarkerHit", getRootElement(), clientPickupHit )


addEvent ( "HayaletArac", true )
addEventHandler ( "HayaletArac", root, function (x )
    for i,v in ipairs(getElementsByType("vehicle")) do
        setElementCollidableWith(v, getPedOccupiedVehicle(getLocalPlayer()), false)
    end
end )
server.lua
Kod: lua
jobm = createMarker ( -1978,106,28 - 1.1, "cylinder", 1.5, 255, 0, 0, 170 )
myBlip = createBlipAttachedTo ( jobm, 56 )
 
give_skin = 255 -- скин, который выдается водиле
function enter (element)
        if getElementType ( element ) == "player" then
                        triggerClientEvent ( element, "openinf_voditel", element)
        end
end
addEventHandler( "onMarkerHit", jobm, enter )
addEvent ( "picku_voditel", true )


function cancel ()
cancelEvent ()
end
 
function create ()
   local jobvehicle = createVehicle ( 459, -1990, 102, 27 )
        warpPedIntoVehicle ( source, jobvehicle )
addEventHandler ( "onVehicleStartExit", jobvehicle, cancel )
triggerClientEvent ( root, "HayaletArac", root, jobvehicle )
        setElementData ( source, "working_veh", jobvehicle )
        setElementModel ( source, give_skin)
        setElementData(source,"Mta",true)
end
addEventHandler ( "picku_voditel", root, create )

 
addEvent ( "finitoWork_voditel", true )
function finitoWorkS ()
        local veh = getElementData ( source, "working_veh" )
        if isElement ( veh ) then
                destroyElement ( veh )
                setElementData ( source, "working_veh", false )
                removeElementData(source,"Mta",true )
        end
end
addEventHandler ( "finitoWork_voditel", root, finitoWorkS )
 
addEvent ( "giveMoneyFromClient_voditel", true )
 
function giveMoneyFromClientS (amount)
    givePlayerMoney ( source, amount )
end
addEventHandler ( "giveMoneyFromClient_voditel", root, giveMoneyFromClientS )
Araç bir yere çarptığı zaman hasar alıyor fakat başka birisi hasar veremiyor araca  :P
 


MTASA TÜRK

Ynt: [YARDIM] Görevdeki Araba
« Yanıtla #5 : 12 Haziran 2017, 16:25:44 »

Çevrimdışı Speaw

  • Yeni Üye
  • *
    • İleti: 69
Yanıtla #6 : 12 Haziran 2017, 20:00:02
Linki görebilmek için Kayıt olun yada Giriş yapın.
client.lua
Kod: lua
addEvent("openinf_voditel", true)
screenWidth, screenHeight = guiGetScreenSize()
function windm ()
        if not getElementData ( localPlayer, "trash_working") then
                  infowind = guiCreateWindow(screenWidth - 700, screenHeight - 500, 200, 229, "Posta Teslimat Görevi", false)
                  infotext = guiCreateMemo(15,20,165,150,"Posta Tesmilat Görevini Bitir Ve ?20000 Al !",false,infowind)
                  guiMemoSetReadOnly( infotext, true )
                  guiSetFont(text2, "default-bold-small")
                  showCursor(true)
                  guiSetVisible ( infowind , true)
                  guiWindowSetSizable(infowind, false)
                  Button_Glose = guiCreateButton(10, 174, 90, 45, "İptal", false, infowind)
                  Button_Start = guiCreateButton(100, 174, 90, 45, "Kabul", false, infowind)
                  addEventHandler("onClientGUIClick", Button_Start, kit )
                        addEventHandler("onClientGUIClick", Button_Glose, noshow )
        else
                for i, v in ipairs ( createdPickups ) do
                        if isElement ( v ) then
                                local pick2 = getElementData ( v, "pick2")
                                if isElement ( pick2 ) then
                                        destroyElement ( pick2 )
                                end
                                local icon = getElementData ( v, "icon" )
                                if isElement ( icon ) then
                                        destroyElement ( icon )
                                end
                                destroyElement ( v )
                        end
                end
                triggerServerEvent ( "finitoWork_voditel", localPlayer )
                setElementData ( localPlayer, "trash_working", false )
        end
end
addEventHandler("openinf_voditel", root, windm )
function noshow ()
 if ( source == Button_Glose ) then
   destroyElement ( infowind )
   showCursor ( false )
 end
end
--addEventHandler("onClientVehicleDamage", root, handleVehicleDamage)
function kit ()
 if ( source == Button_Start ) then
        startWorking()
    destroyElement ( infowind )
    showCursor ( false )
  end
end
 
addEvent ( "pay", true )
function giving ()
 
end
addEventHandler("pay", resourceRoot, giving )
addEvent ( "get", true )
function peremen (plr)
 plr = getLocalPlayer ()
end
addEventHandler("get", resourceRoot, peremen )
 
pickupSpawns = {
        { -2053,-2527,30 },
               
}
 
max_pickups_set = 12 -- como você precisa pegar para o fim dos captadores
 
createdPickups = {}
 
max_pickups = max_pickups_set
if max_pickups_set > #pickupSpawns then
        max_pickups = #pickupSpawns
end
 
function startWorking ()
        if not getElementData ( localPlayer, "trash_working" ) then
                createdPickups = {}
                triggerServerEvent ( "picku_voditel", localPlayer )
                setElementData ( localPlayer, "trash_working", true )
                setElementData ( localPlayer, "trash_working_hit", 0 )
                        outputChatBox ( "Görevi Başarıyla Aldın ", 255, 255, 255, false )           
                               
                for i, v in ipairs ( pickupSpawns ) do
                        local pick = createMarker ( v[1],v[2],v[3], "checkpoint", 4.0, 255, 255, 255 )
                        local pick2 = createPickup ( v[1],v[2],v[3], 3, 1314, 10000 )
                        setElementData ( pick, "taken", false )
                        setElementData ( pick, "pick2", pick2 )
                        setElementData ( pick, "bus_pickup", true )
                        setElementData ( pick, "id", s )
                        if i == 1 then
                                local icon = createBlipAttachedTo ( pick, 41, 2 )
                                setElementData ( pick, "icon", icon )
                        end
                        table.insert (createdPickups, pick)
                end
        end
end     
 
function clientPickupHit(thePlayer, matchingDimension)
        if thePlayer == localPlayer and getElementData ( source, "bus_pickup" ) and not getElementData ( source, "taken" ) then
                setElementData ( source, "taken", true )
                outputChatBox ( "Tebrikler Görevi Bitirdin Ve ?20000 Aldın ", 255, 100, 100, true )
                triggerServerEvent ( "giveMoneyFromClient_voditel", localPlayer, 20000 )
                local hitted = getElementData ( localPlayer, "trash_working_hit" ) or 0
                hitted = hitted+1
                triggerServerEvent ( "experience", localPlayer, 20 )
                local pick2 = getElementData ( source, "pick2" )
                if isElement ( pick2 ) then
                        destroyElement ( pick2 )
                end
                local icon = getElementData ( source, "icon" )
                if isElement ( icon ) then
                        destroyElement ( icon )
                end
                local icon = getElementData ( source, "icon" )
                if isElement ( icon ) then
                        destroyElement ( icon )
                end
                destroyElement(source)
                setElementData ( localPlayer, "trash_working_hit", hitted)
                if hitted >= max_pickups then
                        for i, v in ipairs ( createdPickups ) do
                                if isElement ( v ) then
                                        local pick2 = getElementData ( v, "pick2")
                                        if isElement ( pick2 ) then
                                                destroyElement ( pick2 )
                                        end
                                        local icon = getElementData ( v, "icon" )
                                        if isElement ( icon ) then
                                                destroyElement ( icon )
                                        end
                                        destroyElement ( v )
                                end
                        end
                        setElementData ( localPlayer, "trash_working", false )
                        triggerServerEvent ( "finitoWork_voditel", localPlayer )
                        return true
                end
                if createdPickups[hitted+1] then
                        local icon = createBlipAttachedTo ( createdPickups[hitted+1], 41, 2 )
                        setElementData ( createdPickups[hitted+1], "icon", icon )
                end
        end
end
addEventHandler ( "onClientMarkerHit", getRootElement(), clientPickupHit )


addEvent ( "HayaletArac", true )
addEventHandler ( "HayaletArac", root, function (x )
    for i,v in ipairs(getElementsByType("vehicle")) do
        setElementCollidableWith(v, getPedOccupiedVehicle(getLocalPlayer()), false)
    end
end )
server.lua
Kod: lua
jobm = createMarker ( -1978,106,28 - 1.1, "cylinder", 1.5, 255, 0, 0, 170 )
myBlip = createBlipAttachedTo ( jobm, 56 )
 
give_skin = 255 -- скин, который выдается водиле
function enter (element)
        if getElementType ( element ) == "player" then
                        triggerClientEvent ( element, "openinf_voditel", element)
        end
end
addEventHandler( "onMarkerHit", jobm, enter )
addEvent ( "picku_voditel", true )


function cancel ()
cancelEvent ()
end
 
function create ()
   local jobvehicle = createVehicle ( 459, -1990, 102, 27 )
        warpPedIntoVehicle ( source, jobvehicle )
addEventHandler ( "onVehicleStartExit", jobvehicle, cancel )
triggerClientEvent ( root, "HayaletArac", root, jobvehicle )
        setElementData ( source, "working_veh", jobvehicle )
        setElementModel ( source, give_skin)
        setElementData(source,"Mta",true)
end
addEventHandler ( "picku_voditel", root, create )

 
addEvent ( "finitoWork_voditel", true )
function finitoWorkS ()
        local veh = getElementData ( source, "working_veh" )
        if isElement ( veh ) then
                destroyElement ( veh )
                setElementData ( source, "working_veh", false )
                removeElementData(source,"Mta",true )
        end
end
addEventHandler ( "finitoWork_voditel", root, finitoWorkS )
 
addEvent ( "giveMoneyFromClient_voditel", true )
 
function giveMoneyFromClientS (amount)
    givePlayerMoney ( source, amount )
end
addEventHandler ( "giveMoneyFromClient_voditel", root, giveMoneyFromClientS )
Araç bir yere çarptığı zaman hasar alıyor fakat başka birisi hasar veremiyor araca  :P
Çok teşekkürler