السلام عليككم ورححمة لله
شباب عندي مشككلة في هذا الكود ان اذا الاعب ركب يطلع له الماركر ولاكن بعد ماتختفي السيارة وطلعت ثانية
اذ ركب ما يطلع الماركر اذا فيه خطأ صلحوه لاهنتم
ca3 =
{
{ 0, 0, 3 },
{ 0, 0, 3 },
{ 0, 0, 3 },
{ 0, 0, 3 },
}
marker =
{
{ 102.0269241333, 54.090785980225, 0.44342550635338 },
{ 11.605502128601, 58.490795135498, 1.6355142593384 },
}
function CreatCarRandom ()
random = ca3[math.random(#ca3)]
car = createVehicle(411, -0.77234786748886, 0.1968837082386, 3.1171875)
blip1Car = createBlipAttachedTo(car, 53)
outputChatBox("#B22222 automobile has been requsted and placed on your map , get it first !!", root, 255, 255, 255, true)
end
addEventHandler ( "onResourceStart", getRootElement(), CreatCarRandom )
addEventHandler("onPlayerVehicleEnter", root,
function (vehicle)
if (vehicle == car) and not Marker then
random = marker[math.random(#marker)]
Marker = createMarker(random[1], random[2], random[3], "cylinder", 5, 0, 0, 205, 170)
blipCar2 = createBlipAttachedTo(Marker, 51)
setElementVisibleTo(Marker, root, false)
setElementVisibleTo(Marker, source, true)
end
end )
addEventHandler( "onMarkerHit", root,
function (hitElement)
if source == Marker then
if isPedInVehicle ( hitElement ) then
givePlayerMoney ( hitElement, math.random(50000,70000) )
triggerClientEvent(hitElement, "playSoundC", hitElement)
destroyElement(car)
destroyElement(Marker)
destroyElement(blipCar2)
destroyElement(blip1Car)
CreatCarRandom ()
end
end
end )
addEventHandler("onPlayerVehicleExit", root,
function (vehicle)
if (vehicle == car) and not Marker then
setElementVisibleTo(Marker, root, false)
setElementVisibleTo(Marker, source, false)
setElementVisibleTo(blipCar2, root, false)
setElementVisibleTo(blipCar2, root, false)
end
end )