Jump to content

Data/Boolean [HELP]


Recommended Posts

I want to add get/setElementData to the code like

There are bank robbery and i want to takes all players within colshape and set data "Robber" for gang mates of man who opened first door: Robber

and Assistant for other

  
  
addEvent...event of door opening 
addEventHandler.. door opening too 
function(Door) 
if Door=="Door1" then 
destroyElement....... 
moveObject....... 
createMarker...... 
for i,g in ipairs (getElementsWithinColShape(getElementColShape(colShape),"player")) do 
local sGang = getElementData(source,"gang", gangName) 
local pGang = getElementData(g,"gang", gangName ) 
if sGang == pGang then 
setElementData(g,"Robbery", robber ) 
elseif sGang ~= pGang then 
setElementData(g,"Robbery", assistant) 
end 
end 
  
//////// 
  

When i have starting script all is good

But i have opeing door then debug string sending me this :

warning : scriptfolder BadArgument @ setElementData [ Expected argument at argument 3, got none ]

warning : scriptfolder BadArgument @ getElementsWithinColShape [ expected colshape at argument 1, got boolean ]

error ; bad argument #1 in ipairs [ table expected got boolean ]

I can send full script only for advenced people

Link to comment

The problem with setElementData is that "robber" and "assistant" variables aren't defined, I think the problem is that you wanted to put a string, so it would be like this:

setElementData ( g,"Robbery", "robber" ) 

And the problem with getElementsWithinColShape is that the colshape doesn't exist for what it seems.

Link to comment
The problem with setElementData is that "robber" and "assistant" variables aren't defined, I think the problem is that you wanted to put a string, so it would be like this:
setElementData ( g,"Robbery", "robber" ) 

And the problem with getElementsWithinColShape is that the colshape doesn't exist for what it seems.

sorry but what you means ?

I've got this method from HouseRob and it's works there :(

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