Jump to content

Whats wrong with my script? (getElementZoneName)


Hadif

Recommended Posts

Script: (Server)

function theLocator() 
    local allLocation = {"Las Venturas", 
    "San Fierro", 
    "Whetstone", 
    "Flint County", 
    "Red County", 
    "Los Santos"} 
    local theLocation = getElementZoneName(source, true) 
    for theKey, allLocation in ipairs(allLocation) do 
        if (theLocation == allLocation) then 
            killPed(source) 
        end 
    end 
end 
  
setTimer(theLocator, 1000, 0) 

Debug:

Bad argument @ 'getElementZoneName' [Expected element at argument 1, got nil] 

Link to comment

Try this ( untested ):

  
function theLocator() 
    local allLocation = {"Las Venturas", 
    "San Fierro", 
    "Whetstone", 
    "Flint County", 
    "Red County", 
    "Los Santos"} 
    local players = getElementsByType ( "player" ) 
    for i, source in ipairs ( players ) do 
     local theLocation = getElementZoneName(source, true) 
       for theKey, allLocation in ipairs(allLocation) do 
        if (theLocation == allLocation) then 
            killPed(source) 
        end 
    end 
end 
end 
  
function startLocator() 
setTimer ( theLocator, 1000, 0 ) 
end 
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), startLocator ) 

Link to comment

The error I think is it on the 2nd argument, where's going to show you only Cities no Villages, you can try this.

function theLocator() 
    local allLocation = {"Las Venturas", 
    "San Fierro", 
    "Whetstone", 
    "Flint County", 
    "Red County", 
    "Los Santos"} 
    local theLocation = getElementZoneName( source ) 
    for theKey, allLocation in ipairs(allLocation) do 
        if (theLocation == allLocation) then 
            killPed(source) 
        end 
    end 
end 
  
setTimer(theLocator, 1000, 0) 

Link to comment
The error I think is it on the 2nd argument, where's going to show you only Cities no Villages, you can try this.
function theLocator() 
    local allLocation = {"Las Venturas", 
    "San Fierro", 
    "Whetstone", 
    "Flint County", 
    "Red County", 
    "Los Santos"} 
    local theLocation = getElementZoneName( source ) 
    for theKey, allLocation in ipairs(allLocation) do 
        if (theLocation == allLocation) then 
            killPed(source) 
        end 
    end 
end 
  
setTimer(theLocator, 1000, 0) 

urmmm, ill try it!

Link to comment
Try this ( untested ):
  
function theLocator() 
    local allLocation = {"Las Venturas", 
    "San Fierro", 
    "Whetstone", 
    "Flint County", 
    "Red County", 
    "Los Santos"} 
    local players = getElementsByType ( "player" ) 
    for i, source in ipairs ( players ) do 
     local theLocation = getElementZoneName(source, true) 
       for theKey, allLocation in ipairs(allLocation) do 
        if (theLocation == allLocation) then 
            killPed(source) 
        end 
    end 
end 
end 
  
function startLocator() 
setTimer ( theLocator, 1000, 0 ) 
end 
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), startLocator ) 

alright!

Link to comment
Try this ( untested ):
  
function theLocator() 
    local allLocation = {"Las Venturas", 
    "San Fierro", 
    "Whetstone", 
    "Flint County", 
    "Red County", 
    "Los Santos"} 
    local players = getElementsByType ( "player" ) 
    for i, source in ipairs ( players ) do 
     local theLocation = getElementZoneName(source, true) 
       for theKey, allLocation in ipairs(allLocation) do 
        if (theLocation == allLocation) then 
            killPed(source) 
        end 
    end 
end 
end 
  
function startLocator() 
setTimer ( theLocator, 1000, 0 ) 
end 
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), startLocator ) 

thank you very very very much sande... i appreciate yr help :D, may god bless you and keep you! :mrgreen::mrgreen::mrgreen:

feel free to join my server soon! :wink:

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