d43dr4 Posted April 20, 2013 Share Posted April 20, 2013 (edited) Hello everyone, i just edited a BrieFCase script But it have some bugs here's the code: mark = { --San Fierro {-2125.9267578125, 489.92904663086, 34}, } bag = { --San Fierro {-2281.2316894531, 1090.7425537109, 80.25749206543}, } function createBag() local mt = math.random(#bag) ob = createObject(1210,bag[mt][1],bag[mt][2],bag[mt][3]) setElementCollisionsEnabled(ob,false) time = setTimer(roo,50,0,ob) mar = createMarker(bag[mt][1],bag[mt][2],bag[mt][3],"corona",2,255,0,0,0) mar2 = createMarker(bag[mt][1],bag[mt][2],bag[mt][3]+1,"arrow",0.5,255,0,0,255) bl = createBlipAttachedTo(mar,17) setElementData(mar,"num",mt) outputChatBox("#FF0000* BrieFCase #00FF00Start !!",root,0,255,0,true) end addEventHandler("onResourceStart",resourceRoot,createBag) addEventHandler("onMarkerHit",root, function (player) if ( source == mar ) then if getElementType(player) == "player" and not isPedInVehicle(player) then local x,y,z = getElementPosition(player) local data = getElementData(mar,"num") local data = tonumber(data) destroyElement(mar) destroyElement(mar2) destroyElement(ob) destroyElement(bl) killTimer(time) setElementData(player,"bag",true) atBag = createObject(1210,x,y,z) setElementData(atBag,"num",data) exports.bone_attach:attachElementToBone(atBag,player,12,0,0.05,0.27,0,180,0) bli = createBlipAttachedTo(player,17) outputChatBox("#FFFF00" .. getPlayerName(player) .. "#00FF00 has took the Bag!",root,0,255,0,true) marker = createMarker(mark[data][1],mark[data][2],mark[data][3],"cylinder",2,189,98,222,255,player) marker1 = createMarker(mark[data][1],mark[data][2],mark[data][3],"arrow",0.5,255,0,0,255,player) attachElements ( marker1, player, 0, 0, 1.5 ) marBli = createBlipAttachedTo(marker,56,2,255,0,0,255,0,99999.0,player) end end end ) function roo(ele) local x,y,z = getElementRotation(ele) setElementRotation(ele,x,y,z + 5) end addEventHandler ( "onClientRender", root, roo ) addEventHandler("onPlayerWasted",root, function () if getElementData(source,"bag") and getElementData(source,"bag") == true then local data = getElementData(atBag,"num") local data = tonumber(data) local x,y,z = getElementPosition(source) setElementData(source,"bag",false) destroyElement(atBag) destroyElement(marker) destroyElement(marker1) destroyElement(bli) destroyElement(marBli) ob = createObject(1210,x,y,z) setElementCollisionsEnabled(ob,false) time = setTimer(roo,50,0,ob) mar = createMarker(x,y,z,"corona",2,255,0,0,0) mar2 = createMarker(x,y,z+1,"arrow",0.5,255,0,0,0) setElementData(mar,"num",data) bl = createBlipAttachedTo(mar,17) outputChatBox("#FF0000" .. getPlayerName(player) .. "#00FF00 has lost the Bag!",root,0,255,0,true) end end ) addEventHandler("onMarkerHit",root, function (player) if ( source == marker ) and not isPedInVehicle(player) then if getElementType(player) == "player" then setElementData(player,"bag",false) destroyElement(marker) destroyElement(marBli) destroyElement(bli) destroyElement(atBag) outputChatBox("#FFFF00" .. getPlayerName(player) .. " #00FF00has delivery the bag successfully!",root,255,0,0,true) outputChatBox("#FFFF00" .. getPlayerName(player) .. " has won #00FF00$10000 !",root,255,0,0,true) givePlayerMoney(player,10000) destroyElement(marker1) triggerClientEvent(player,"onShowMoney",player) setTimer(createBag,300000,1) end end end ) addEventHandler("onVehicleStartEnter",root, function (player) if getElementData(player,"bag") and getElementData(player,"bag") == true then cancelEvent() end end ) addEventHandler("onPlayerQuit",root, function () if getElementData(source,"bag") and getElementData(source,"bag") == true then local data = getElementData(atBag,"num") local data = tonumber(data) local x,y,z = getElementPosition(source) setElementData(source,"bag",false) destroyElement(atBag) destroyElement(marker) destroyElement(bli) destroyElement(marBli) ob = createObject(1210,x,y,z) setElementCollisionsEnabled(ob,false) time = setTimer(roo,50,0,ob) mar = createMarker(x,y,z,"corona",2,255,0,0,0) mar2 = createMarker(x,y,z+1,"arrow",0.5,255,0,0,255) setElementData(mar,"num",data) bl = createBlipAttachedTo(mar,17) end end ) Bugs: 1- Has lost the bag does not showed on chat when player wasted 2- If u hit the marker of delivery even u dont have the bc you won 3- BrieFCase rotation is not normally, want it to do a rotation like pickups and so on So please Help me fixing those bugs Thx .. Edited April 25, 2013 by Guest Link to comment
WASSIm. Posted April 23, 2013 Share Posted April 23, 2013 mark = { --San Fierro {-2125.9267578125, 489.92904663086, 34}, } bag = { --San Fierro {-2281.2316894531, 1090.7425537109, 80.25749206543}, } function createBag() local mt = math.random(#bag) ob = createObject(1210,bag[mt][1],bag[mt][2],bag[mt][3]) setElementCollisionsEnabled(ob,false) time = setTimer(roo,50,0,ob) mar = createMarker(bag[mt][1],bag[mt][2],bag[mt][3],"corona",2,255,0,0,0) mar2 = createMarker(bag[mt][1],bag[mt][2],bag[mt][3]+1,"arrow",0.5,255,0,0,255) bl = createBlipAttachedTo(mar,17) setElementData(mar,"num",mt) outputChatBox("#FF0000* BrieFCase #00FF00Start !!",root,0,255,0,true) end addEventHandler("onResourceStart",resourceRoot,createBag) addEventHandler("onMarkerHit",root, function (player) if ( source == mar ) then if getElementType(player) == "player" and not isPedInVehicle(player) then local x,y,z = getElementPosition(player) local data = getElementData(mar,"num") local data = tonumber(data) destroyElement(mar) destroyElement(mar2) destroyElement(ob) destroyElement(bl) killTimer(time) setElementData(player,"bag",true) atBag = createObject(1210,x,y,z) setElementData(atBag,"num",data) exports.bone_attach:attachElementToBone(atBag,player,12,0,0.05,0.27,0,180,0) bli = createBlipAttachedTo(player,17) outputChatBox("#FFFF00" .. getPlayerName(player) .. "#00FF00 has took the Bag!",root,0,255,0,true) marker = createMarker(mark[data][1],mark[data][2],mark[data][3],"cylinder",2,189,98,222,255,player) marker1 = createMarker(mark[data][1],mark[data][2],mark[data][3],"arrow",0.5,255,0,0,255,player) attachElements ( marker1, player, 0, 0, 1.5 ) marBli = createBlipAttachedTo(marker,56,2,255,0,0,255,0,99999.0,player) end end end ) function roo(ele) local x,y,z = getElementRotation(ele) setElementRotation(ele,x,y,z + 10) end addEventHandler ( "onClientRender", root, roo ) addEventHandler("onPlayerWasted",root, function () if getElementData(source,"bag") and getElementData(source,"bag") == true then local data = getElementData(atBag,"num") local data = tonumber(data) local x,y,z = getElementPosition(source) setElementData(source,"bag",false) destroyElement(atBag) destroyElement(marker) destroyElement(marker1) destroyElement(bli) destroyElement(marBli) ob = createObject(1210,x,y,z) setElementCollisionsEnabled(ob,false) time = setTimer(roo,50,0,ob) mar = createMarker(x,y,z,"corona",2,255,0,0,0) mar2 = createMarker(x,y,z+1,"arrow",0.5,255,0,0,0) setElementData(mar,"num",data) bl = createBlipAttachedTo(mar,17) outputChatBox("#FF0000" .. getPlayerName(source) .. "#00FF00 has lost the Bag!",root,0,255,0,true) end end ) addEventHandler("onMarkerHit",root, function (player) if ( source == marker ) and not isPedInVehicle(player) then if getElementType(player) == "player" then setElementData(player,"bag",false) destroyElement(marker) destroyElement(marBli) destroyElement(bli) destroyElement(atBag) outputChatBox("#FFFF00" .. getPlayerName(player) .. " #00FF00has delivery the bag successfully!",root,255,0,0,true) outputChatBox("#FFFF00" .. getPlayerName(player) .. " has won #00FF00$10000 !",root,255,0,0,true) givePlayerMoney(player,10000) destroyElement(marker1) triggerClientEvent(player,"onShowMoney",player) setTimer(createBag,300000,1) end end end ) addEventHandler("onVehicleStartEnter",root, function (player) if getElementData(player,"bag") and getElementData(player,"bag") == true then cancelEvent() end end ) addEventHandler("onPlayerQuit",root, function () if getElementData(source,"bag") and getElementData(source,"bag") == true then local data = getElementData(atBag,"num") local data = tonumber(data) local x,y,z = getElementPosition(source) setElementData(source,"bag",false) destroyElement(atBag) destroyElement(marker) destroyElement(bli) destroyElement(marBli) ob = createObject(1210,x,y,z) setElementCollisionsEnabled(ob,false) time = setTimer(roo,50,0,ob) mar = createMarker(x,y,z,"corona",2,255,0,0,0) mar2 = createMarker(x,y,z+1,"arrow",0.5,255,0,0,255) setElementData(mar,"num",data) bl = createBlipAttachedTo(mar,17) outputChatBox("#FF0000" .. getPlayerName(source) .. "#00FF00 has lost the Bag!",root,0,255,0,true) end end ) Link to comment
d43dr4 Posted April 25, 2013 Author Share Posted April 25, 2013 Thank You @wassmas You helped me alot ! Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now