This script isn't even worth selling...
Edit
Thiz tok me 1 hur to mke, plis lik
(Requires bone_attach)
meta.xml:
<meta>
<info author="xXMADEXx" name="Breif Case" type="script" version="1.0" />
<script src="breif_shared.lua" type="shared" />
<script src="breif_c.lua" type="client" />
<script src="breif_s.lua" type="server" />
<oop>true</oop>
</meta>
breif_c.lua
--[[Command.add ( "pos", function ( )
local x, y, z = getElementPosition ( localPlayer )
local str = table.concat ( { x, y, z }, ", " )
setClipboard ( str );
print ( str );
end )]]
Breif = {
vars = {
marker = null,
blip = null,
dxAlpha = 0,
dxCount = "up"
},
onMarker = function ( p )
if ( p ~= localPlayer ) then return end
Event.remove ( "onClientPickupHit", source, Breif.onMarker )
source:destroy ( );
Event.trigger ( "BreifCase:onPlayerWin!", p )
Breif.vars.dxAlpha = 0
Breif.vars.dxCount = "up"
Event.add ( "onClientRender", root, Breif.onRender )
Breif.vars.blip:destroy( );
end ,
onRender = function ( )
dxDrawText ( "+ $2,000", 0, 0, sx, sy, tocolor ( 0, 255, 0, Breif.vars.dxAlpha ), 2, "pricedown", "center", "center")
if ( Breif.vars.dxCount == "up" ) then
if ( Breif.vars.dxAlpha >= 245 ) then
Breif.vars.dxCount = "down"
else
Breif.vars.dxAlpha = Breif.vars.dxAlpha + 2
end
else
if ( Breif.vars.dxAlpha <= 10 ) then
Event.remove ( "onClientRender", root, Breif.onRender )
else
Breif.vars.dxAlpha = Breif.vars.dxAlpha - 2
end
end
end
}
Event.add_ ( "BreifCase:DestroyClientElements", true )
Event.add ( "BreifCase:DestroyClientElements", root, function ( )
if ( Breif.vars.marker and isElement ( Breif.vars.marker ) ) then
Event.remove ( "onClientPickupHit", Breif.vars.marker, Breif.onMarker )
destroyElement( Breif.vars.marker )
Breif.vars.blip:destroy( );
end
end )
Event.add_ ( "BreifCase:onClientPickup", true )
Event.add ( "BreifCase:onClientPickup", root, function ( pos )
if ( isElement ( Breif.vars.marker ) ) then
Event.remove ( "onClientMarkerHit", Breif.vars.marker, Breif.onMarker )
destroyElement ( Breif.vars.marker );
Breif.vars.blip:destroy( );
end
local x, y, z = unpack ( pos )
Breif.vars.marker = Marker.create ( x, y, z-1, "cylinder", 2, 255, 255, 0, 120 )
Breif.vars.blip = Blip.create ( x, y, z, 41 )
Event.add ( "onClientMarkerHit", Breif.vars.marker, Breif.onMarker )
end )
breif_s.lua
Breif = {
vars = {
holder = null,
element = null,
object = null,
goto = null,
blip = null
},
create = function ( )
local this = Breif
this.remove ( );
local info = this.positions [ math.random ( #this.positions ) ]
local x, y, z = unpack ( info.create )
Breif.vars.element = Pickup.create ( x, y, z, 3, 1210 )
Breif.vars.goto = info.goTo
Breif.vars.blip = Blip.create ( x, y, z, 33 )
Event.add ( "onPickupHit", Breif.vars.element, this.onHit )
print ( "A breif case has been created in "..tostring(getZoneName(x,y,z))..", "..tostring(getZoneName(x,y,z,true)).."!", root, 0, 255, 0)
end,
remove = function ( )
local this = Breif
if ( this.vars.element and isElement ( this.vars.element ) ) then
destroyElement ( this.vars.element )
end
Breif.vars.element = null
Breif.vars.goto = null
if ( this.vars.object and isElement ( this.vars.object ) ) then
destroyElement ( this.vars.object )
end
Breif.vars.object = null
if ( this.vars.blip and isElement ( this.vars.blip ) ) then
this.vars.blip:destroy ( )
end
Breif.vars.blip = null
if ( this.vars.holder and isElement ( this.vars.holder ) ) then
Event.trigger ( this.vars.holder, "BreifCase:DestroyClientElements", this.vars.holder )
end
Breif.vars.holder = null
end,
onHit = function ( p )
if ( not p or getElementType ( p ) ~= "player" ) then return end
local this = Breif
setTimer ( destroyElement, 500, 1, source )
Breif.vars.holder = p
Breif.vars.object = Object.create ( 1210, 0, 0, 0 )
exports.bone_attach:attachElementToBone ( Breif.vars.object, p, 11, 0, 0, 0.3, 0, 180, 0 )
Event.remove ( "onPickupHit", source, Breif.onHit )
print ( p:getName ( ).." has got the breif case!", root, 255, 255, 0 )
Event.trigger ( p, "BreifCase:onClientPickup", p, Breif.vars.goto )
Breif.vars.blip:destroy ( );
end,
triggerDrop = function ( )
local this = Breif
if ( this.vars.holder ) then
Event.trigger ( this.vars.holder, "BreifCase:DestroyClientElements", this.vars.holder )
local x, y, z = getElementPosition ( this.vars.holder )
if ( isElement ( Breif.vars.object ) ) then
Breif.vars.object:destroy ( );
end
if ( isElement ( Breif.vars.element ) ) then
Breif.vars.element:destroy ( )
end
Breif.vars.holder = null
print ( "The breif case has been dropped in "..getZoneName(x,y,z)..", "..getZoneName(x,y,z,true), root, 255, 255, 0 )
Breif.vars.element = Pickup.create ( x, y, z, 3, 1210 )
Event.add ( "onPickupHit", Breif.vars.element, Breif.onHit )
Breif.vars.blip = Blip.create ( x, y, z, 33 )
end
end,
positions = {
{
create = { -708.50079345703, 962.47711181641, 12.477653503418 },
goTo = { -703.84838867188, 956.98223876953, 12.398029327393 }
},
}
}
if ( not getResourceFromName ( "bone_attach" ) or getResourceState ( getResourceFromName ( "bone_attach" ) ) ~= "running" ) then
return print ( "The "..getResourceName(getThisResource()).." resource requires bone_attach.", root, 255, 0, 0 )
end
Event.add ( "onPlayerWasted", root, function ( )
local this = Breif
if ( this.vars.holder and this.vars.holder == source ) then
Breif.triggerDrop ( );
end
end )
Event.add ( "onPlayerQuit", root, function ( )
local this = Breif
if ( this.vars.holder and this.vars.holder == source ) then
Breif.triggerDrop ( );
end
end )
Event.add_ ( "BreifCase:onPlayerWin!", true )
Event.add ( "BreifCase:onPlayerWin!", root, function ( )
Breif.remove ( );
print ( source:getName ( ).." captured the breif case and got $2,000!", root, 0, 255, 0 )
source:giveMoney ( 2000 );
end )
Breif.create ( );
breif_shared.lua
local function __isServer ( )
if ( _G['dbConnect'] ) then
return true
end
return false
end
print = outputChatBox
null = nil
Command = {
add = addCommandHandler,
remove = removeCommandHandler,
execute = executeCommandHandler
}
Event = {
add_ = addEvent,
add = addEventHandler,
remove = removeEventHandler
}
if ( __isServer ( ) ) then
Event.trigger = triggerClientEvent
else
Event.trigger = triggerServerEvent
sx, sy = guiGetScreenSize ( );
end