Jump to content

Recover marker after destroyed?


Recommended Posts

Posted

hello i'm currently working on a bankrob script right now but,

is it possible when the marker got destroyed by destroyelement , it can recover again? here's my code of client.lua

local bankmarker = createMarker( -725.01849, 969.94299, 11.4, "cylinder", 1.5, 255, 0, 0, 255 ) 
  
addEventHandler ( "onClientMarkerHit", bankmarker, 
    function ( hitElement ) 
        if ( hitElement == localPlayer and getElementType ( hitElement ) == "player" ) then 
            local playerTeam = getPlayerTeam ( hitElement ) 
            if ( playerTeam and getTeamName ( playerTeam ) == "Criminals" ) then 
                triggerServerEvent ("stealstart",getLocalPlayer(),stealstart) 
                triggerServerEvent ("trespass",getLocalPlayer(),trespass) 
                setTimer ( destroyElement, 30000, 1, source, bankmarker ) 
            end 
        end 
    end 
) 

Aftermath

Posted

tried this but marker doensn't create and marker doesn't appear even tho i restart the script

addEventHandler("onElementDestroy", getRootElement(), function (player) 
if getElementType(source) == "marker" then 
setTimer ( createElement, 30000, 1, source, bankmarker ) 
end 

Aftermath

Posted
this is clientside not server side.
addEventHandler("onClientElementDestroy", getRootElement(), 
function () 
    if getElementType(source) == "marker" and source == bankmarker then 
    setTimer ( function() 
    createMarker( -725.01849, 969.94299, 11.4, "cylinder", 1.5, 255, 0, 0, 255 ) 
    end,3000,1) 
end) 

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

Posted
loading script failed: prison/client.lua:45 unexpected symbol near ')'

what should i do

addEventHandler("onClientElementDestroy", getRootElement(), 
function () 
    if getElementType(source) == "marker" and source == bankmarker then 
    setTimer ( function() 
    createMarker( -725.01849, 969.94299, 11.4, "cylinder", 1.5, 255, 0, 0, 255 ) 
    end,3000,1) 
end 
end  
) 

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

Posted

EDIT:

When it creates the marker again, the trigger doesn't work anymore when i step in the new created marker.

when i step in the new created marker , nothing happens

Aftermath

Posted
EDIT:

When it creates the marker again, the trigger doesn't work anymore when i step in the new created marker.

when i step in the new created marker , nothing happens

You must define the marker like this :

addEventHandler("onClientElementDestroy", getRootElement(), 
function () 
    if getElementType(source) == "marker" and source == bankmarker then 
    setTimer ( function() 
    bankmarker = createMarker( -725.01849, 969.94299, 11.4, "cylinder", 1.5, 255, 0, 0, 255 ) 
    end,3000,1) 
end 
end 
) 

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

Posted
do i just need to add that code in my client.lua?

copy and past my code

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

Posted
do i just need to add that code in my client.lua?

ofc man it's client side ,copy and past my code

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

Posted

img of problem:

KX2owAq.png

here is the line of 30-41 in my server.lua 34 is the killtimer( V )

function killPlayer( ) 
outputChatBox ( "Radio: the robber stopped stealing money!", getRootElement(), 100, 200, 0, true ) 
    for i, v in ipairs( players[ source ] ) do 
        if isTimer( v ) then 
            killTimer( v ) 
            players[ source ][ i ] = nil 
        end 
    end 
    players[ source ] = nil 
end 
addEvent( "killplayer", true ) 
addEventHandler( "killplayer", root, killPlayer ) 

Aftermath

Posted

Are you serious player[source] table ????

Post full code here

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

Posted

full server.lua

local players = {} 
local ticks = {} 
addEvent("stealstart",true)  
addEventHandler("stealstart",root,  
function() 
    if players[ source ] and players[ source ][ 3 ] then 
        return  
    end 
    players[ source ] = {} 
    players[ source ][ 1 ] = setTimer ( outputChatBox, 30000, 1, "You have successfully stolen 50000$ in the bank",source, 255, 0, 0, false) 
    players[ source ][ 2 ] = setTimer ( givePlayerMoney, 30000, 1, source, 50000 ) 
    players[ source ][ 3 ] = setTimer( function( ) end, 100, 1 ) 
    setTimer( function( source ) players[ source ][ 3 ] = nil end, 100, 1, source ) 
   if ( getPlayerMoney (source) >= 0 ) then 
outputChatBox("You need to wait 30 seconds to get your 50000$ stay in the marker to get the money", source, 255, 0, 0) 
  
  
end 
end) 
  
addEvent("trespass",true)  
addEventHandler("trespass",root,  
function() 
    if ticks[ source ] and getTickCount( ) - ticks[ source ] < 1000 then return end 
    ticks[ source ] = getTickCount() 
   if ( getPlayerMoney (source) >= 0 ) then 
outputChatBox ( "Radio: Someone is robbing the bank! , all police respond immediately!", getRootElement(), 100, 200, 0, true ) 
end 
end) 
  
function killPlayer( ) 
outputChatBox ( "Radio: the Robber(s) stopped stealing money!", getRootElement(), 100, 200, 0, true ) 
    for i, v in ipairs( players[ source ] ) do 
        if isTimer( v ) then 
            killTimer( v ) 
            players[ source ][ i ] = nil 
        end 
    end 
    players[ source ] = nil 
end 
addEvent( "killplayer", true ) 
addEventHandler( "killplayer", root, killPlayer ) 

Aftermath

Posted
:o what are trying to do , i think you need this Wiki

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

Posted
all works dude , only doesn't work is the respawning marker.

i'm sorry i can't help you your code is totaly wrong, you need to learn LUA language first . sorry

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

Posted

i know lua language , this code really works for me . i only need the marker to respawn and i have scripts posted in the community.

Aftermath

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...