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


[YARDIM] Görev Sistemi

0 Üye ve 1 Ziyaretçi konuyu incelemekte.

Çevrimdışı Scholt

  • Yeni Üye
  • *
    • İleti: 3
: 03 Haziran 2017, 01:13:33
Arkadaşlar bende görev sc si var 1 tane sevkiyat ben onu editledim başka bir görev daha yapmaya çalıştım aynısından sadece araba ve kordinatları degiştirdim fakat önceki arabadan ve yeni arabadan aynısından oluşuyor
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, "Silah Teslimat Görevi", false)
  infotext = guiCreateMemo(15,20,165,150,"Silah 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
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 = {
{ 135,1949,19 },

}

max_pickups_set = 13 -- 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", i )
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 ) -- 50 награда
local hitted = getElementData ( localPlayer, "trash_working_hit" ) or 0
hitted = hitted+1
local pick2 = getElementData ( source, "pick2" )
if isElement ( pick2 ) then
destroyElement ( pick2 )
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 )







Kod: lua
jobm = createMarker ( -1975,106,28 - 1.1, "cylinder", 1.5, 255, 0, 0, 170 )
myBlip = createBlipAttachedTo ( jobm, 22 )

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 ( 609, -1990, 102, 27 )
warpPedIntoVehicle ( source, jobvehicle )
setElementData ( source, "working_veh", jobvehicle )
setElementModel ( source, give_skin)
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 )
end
end
addEventHandler ( "finitoWork_voditel", root, finitoWorkS )

addEvent ( "giveMoneyFromClient_voditel", true )

function giveMoneyFromClientS (amount)
    givePlayerMoney ( source, amount )
end
addEventHandler ( "giveMoneyFromClient_voditel", root, giveMoneyFromClientS )













Bu Benim kendi yapmaya çalıştıgım

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
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", i )
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 ) -- 50 награда
local hitted = getElementData ( localPlayer, "trash_working_hit" ) or 0
hitted = hitted+1
local pick2 = getElementData ( source, "pick2" )
if isElement ( pick2 ) then
destroyElement ( pick2 )
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 )








Kod: lua
jobm = createMarker ( -1978,106,28 - 1.1, "cylinder", 1.5, 255, 0, 0, 170 )
myBlip = createBlipAttachedTo ( jobm, 60 )

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)
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 )
end
end
addEventHandler ( "finitoWork_voditel", root, finitoWorkS )

addEvent ( "giveMoneyFromClient_voditel", true )

function giveMoneyFromClientS (amount)
    givePlayerMoney ( source, amount )
end
addEventHandler ( "giveMoneyFromClient_voditel", root, giveMoneyFromClientS )











« Son Düzenleme: 04 Haziran 2017, 23:58:09 Gönderen: Narkoz »
 


MTASA TÜRK

[YARDIM] Görev Sistemi
« : 03 Haziran 2017, 01:13:33 »

Çevrimdışı MarkeloF

  • Moderatör
  • *
    • İleti: 735
  • Just do it.
Yanıtla #1 : 03 Haziran 2017, 09:35:13
İki görevden birinin eventlerini değiştirmen yeterli olacaktır.


Aracı terk edince araç kaybolur. (2. satırı scripte göre uyarlamalısın)
Kod: lua
function vehicleExit (leaver)
if source == rekka and leaver == source then
addEventHandler ("onVehicleEnter", getRootElement(), destrTimer)
else
return false
end
end
Kod: lua
removeEventHandler ("onVehicleExit", getRootElement(), vehicleExit)

« Son Düzenleme: 03 Haziran 2017, 11:23:53 Gönderen: MarkeloF »
                                                 
 


Çevrimdışı LaykSis

  • Yeni Üye
  • *
    • İleti: 47
Yanıtla #2 : 03 Haziran 2017, 15:13:37
Linki görebilmek için Kayıt olun yada Giriş yapın.
İki görevden birinin eventlerini değiştirmen yeterli olacaktır.


Aracı terk edince araç kaybolur. (2. satırı scripte göre uyarlamalısın)
Kod: lua
function vehicleExit (leaver)
if source == rekka and leaver == source then
addEventHandler ("onVehicleEnter", getRootElement(), destrTimer)
else
return false
end
end
Kod: lua
removeEventHandler ("onVehicleExit", getRootElement(), vehicleExit)
Olmadı görev markeri bozuluyor
 


Çevrimdışı MarkeloF

  • Moderatör
  • *
    • İleti: 735
  • Just do it.
Yanıtla #3 : 03 Haziran 2017, 15:24:16
Verdiğim kodları bende kullanıyorum ve bir sorun yok.
Eventi eklemedin galiba.
Kod: lua
addEventHandler ("onVehicleEnter", getRootElement(), destrTimer)
Bu kodu create vehicle satırının altına yapıştır.