Jump to content

Replacing the command with the marker. Please help me!


Turk-oghlan

Recommended Posts

HI guys

I downloaded Bank System . The system is such that when the player enters the marker, the ATM becomes active.

mta_screen_2020_02_17_14_19_28.jpg

 

But, I want to get the  ATM system activated here by writing a text(Command For Example: /Bank). And in the custom area.

 

Server.Lua The part that defines ATM activation with the marker

atmls1 = 2116, -1118.3000488281,24.89999961853,0,0,162
atmls2 = 1186.1999511719,-1374.3000488281, 13.199999809265 ,0,0,90
atmls3 = 1975.4000244141,-2176.1000976563, 13.199999809265 ,0,0,178

atmsf1 = -1571.0999755859,666.59997558594, 6.8000001907349 ,0,0,88
atmsf2 = -2655.8999023438,257.89999389648, 4 ,0,0,90

atmredcounty = -74.800003051758,1116.3000488281, 19.39999961853 ,0,0,90

atmlv1 = 1715.5999755859,1533.5, 10.39 ,0,0,92
atmlv2 = 2176.6000976563,2443.6999511719, 10.5 ,0,0,178
atmlv3 = 2159.5,950.79998779297, 10.699999809265 ,0,0,270

atmler = { { 2116, -1118.3000488281,24.89999961853,0,0,162 }, { 1186.1999511719,-1374.3000488281, 13.199999809265 ,0,0,90 }, { 1975.4000244141,-2176.1000976563, 13.199999809265 ,0,0,178 }, { -1571.0999755859,666.59997558594, 6.8000001907349 ,0,0,88 }, { -2655.8999023438,257.89999389648, 4 ,0,0,90 }, {-74.800003051758,1116.3000488281, 19.39999961853 ,0,0,90 }, { 1715.5999755859,1533.5, 10.39 ,0,0,92 }, { 2176.6000976563,2443.6999511719, 10.5 ,0,0,178 }, { 2159.5,950.79998779297, 10.699999809265 ,0,0,270 } }


atm = {}
function displayLoadedRes ( res )
 for theKey,theAtm in ipairs(atmler) do 
atm[theAtm] = createObject ( 2942,  theAtm [ 1 ],  theAtm  [ 2 ],  theAtm [ 3 ], theAtm [ 4 ], theAtm [ 5 ], theAtm [ 6 ] )
atmx, atmy, atmz = getElementPosition (atm[theAtm])
atmMarker = createMarker ( atmx, atmy, atmz -1, "cylinder", 1.5, 100, 100, 200, 170 )
setElementData (atmMarker,"atm",true)
atmBlip = createBlipAttachedTo ( atm[theAtm], 52 )
setBlipVisibleDistance (atmBlip,200)
setElementCollisionsEnabled(atm[theAtm], false)
end
end
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), displayLoadedRes )


function MarkerHit( hitElement, matchingDimension )
if ((getElementType(hitElement) == "player")) then
local acc = getPlayerAccount (hitElement)
 if (acc and not isGuestAccount (acc)) then
  local atmmi = getElementData (source,"atm")
   if (atmmi == true) then
      triggerClientEvent(hitElement, "bankaGuiAc", hitElement)
end
end
end
end
addEventHandler( "onMarkerHit", getRootElement(), MarkerHit )

please guide me

Thanks

Link to comment
atmls1 = 2116, -1118.3000488281,24.89999961853,0,0,162
atmls2 = 1186.1999511719,-1374.3000488281, 13.199999809265 ,0,0,90
atmls3 = 1975.4000244141,-2176.1000976563, 13.199999809265 ,0,0,178

atmsf1 = -1571.0999755859,666.59997558594, 6.8000001907349 ,0,0,88
atmsf2 = -2655.8999023438,257.89999389648, 4 ,0,0,90

atmredcounty = -74.800003051758,1116.3000488281, 19.39999961853 ,0,0,90

atmlv1 = 1715.5999755859,1533.5, 10.39 ,0,0,92
atmlv2 = 2176.6000976563,2443.6999511719, 10.5 ,0,0,178
atmlv3 = 2159.5,950.79998779297, 10.699999809265 ,0,0,270

atmler = { { 2116, -1118.3000488281,24.89999961853,0,0,162 }, { 1186.1999511719,-1374.3000488281, 13.199999809265 ,0,0,90 }, { 1975.4000244141,-2176.1000976563, 13.199999809265 ,0,0,178 }, { -1571.0999755859,666.59997558594, 6.8000001907349 ,0,0,88 }, { -2655.8999023438,257.89999389648, 4 ,0,0,90 }, {-74.800003051758,1116.3000488281, 19.39999961853 ,0,0,90 }, { 1715.5999755859,1533.5, 10.39 ,0,0,92 }, { 2176.6000976563,2443.6999511719, 10.5 ,0,0,178 }, { 2159.5,950.79998779297, 10.699999809265 ,0,0,270 } }


atm = {}
function displayLoadedRes ( res )
 for theKey,theAtm in ipairs(atmler) do 
atm[theAtm] = createObject ( 2942,  theAtm [ 1 ],  theAtm  [ 2 ],  theAtm [ 3 ], theAtm [ 4 ], theAtm [ 5 ], theAtm [ 6 ] )
atmx, atmy, atmz = getElementPosition (atm[theAtm])
atmMarker = createMarker ( atmx, atmy, atmz -1, "cylinder", 1.5, 100, 100, 200, 170 )
setElementData (atmMarker,"atm",true)
atmBlip = createBlipAttachedTo ( atm[theAtm], 52 )
setBlipVisibleDistance (atmBlip,200)
setElementCollisionsEnabled(atm[theAtm], false)
end
end
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), displayLoadedRes )

function Bank_( hitElement,v )
if ((getElementType(hitElement) == "player")) then
local acc = getPlayerAccount (hitElement)
 if (acc and not isGuestAccount (acc)) then
  local atmmi = getElementData (source,"atm")
   if (atmmi == v) then
      triggerClientEvent(hitElement, "bankaGuiAc", hitElement)
end end end end
--/////////////
addEventHandler( "onMarkerHit", getRootElement(),function (hitElement )
Bank_(hitElement, true )
end)
--/////////////
addCommandHandler ( "Bank", function ( source, commandName) 
Bank_( source,false)
end)

 

Edited by #\_oskar_/#
  • Confused 1
Link to comment
10 hours ago, ReZurrecti0n said:

triggerClientEvent(hitElement, "bankaGuiAc", hitElement) -- This seems to be what triggers the Bank

So, just make your own /Bank command and then trigger it with the above line. Make whatever adjustments needed of course

Hi thank you for the guidance

I made these changes but when I write the /bank the system is not activated.

function MarkerHit( command, matchingDimension )
if ((getElementType(commands) == "player")) then
local acc = getPlayerAccount (command)
 if (acc and not isGuestAccount (acc)) then
  local atmmi = getElementData (source,"atm")
   if (atmmi == true) then
      addCommandHandler(command, "bankaGuiAc", command)
end
end
end
end
addCommandHandler("bank", MarkerHit)
executeCommandHandler (  bank, player, matchingDimension  )


Please  very guide

Edited by Turk-oghlan
editing text
Link to comment

If you're not yet familiar with Lua or MTA's Functions and are just learning, then I have to recommend starting out much more simple. Rather than trying to jump into some complex scripting that is a bank system, make your own very simple command. Once you grasp the basic concept of things, it'll become easier to "mod" something more to your liking...

function TestFunction(player,command)
 outputChatBox("This is just a test!",player,255,255,255)
 -- Add more code here, keep it simple until you got the very basics of scripting down, then move on to more complex things
end

addCommandHandler("test",TestFunction)

 

  • Like 1
Link to comment
1 hour ago, ReZurrecti0n said:

If you're not yet familiar with Lua or MTA's Functions and are just learning, then I have to recommend starting out much more simple. Rather than trying to jump into some complex scripting that is a bank system, make your own very simple command. Once you grasp the basic concept of things, it'll become easier to "mod" something more to your liking...


function TestFunction(player,command)
 outputChatBox("This is just a test!",player,255,255,255)
 -- Add more code here, keep it simple until you got the very basics of scripting down, then move on to more complex things
end

addCommandHandler("test",TestFunction)

 

Thanks

  • Like 1
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...