teronrussell Posted November 22, 2010 Share Posted November 22, 2010 Editor = {} Gate = {} Gate2 = {} Precision = {} status = {} coll = {} coll2 = {} coll3 = {} coll4 = {} -- this script mod is (no longer) PRIVATE -- - Deject3d function startBuilding(playerSource, commandName, objectid) if not objectid then outputChatBox("usage: /addgate objectid teamname", playerSource) end team = getTeamName(getPlayerTeam(playerSource)) if team == false then team = "" end for i = 1,20 do if Editor[i] == playerSource then destroyElement(Gate[i]) Gate[i] = null Editor[i] = null Precision[i] = null end if Editor[i] == null then Editor[i] = playerSource -- set Editor[i] to who made the object --creating object -v local x,y,z = getElementPosition(playerSource) object = createObject ( objectid, x + 3,y + 3,z) interior = getElementInterior ( playerSource ) setElementInterior(object,interior) i need help i keep getting warning errors at lines:19,25,35,37 Link to comment
Aibo Posted November 22, 2010 Share Posted November 22, 2010 team = getTeamName(getPlayerTeam(playerSource)) getPlayerTeam() returns false if player is not in a team, so resulting getTeamName(false) can cause your warning destroyElement(Gate) destroyElement() can cause a warning if Gate is not an element ,use «if isElement(Gate) then destroyElement(Gate) end» object = createObject ( objectid, x + 3,y + 3,z) «objectid» can be undefined. there is a check whether it is specified, but it does nothing to prevent the rest of the code from running. if not objectid then outputChatBox("usage: /addgate objectid teamname", playerSource) return false end setElementInterior(object,interior) error here is a result of error at line 35 («object» wasnt created). PS: «null» in Lua is «nil» Link to comment
teronrussell Posted November 22, 2010 Author Share Posted November 22, 2010 Editor = {} Gate = {} Gate2 = {} Precision = {} status = {} coll = {} coll2 = {} coll3 = {} coll4 = {} -- this script mod is (no longer) PRIVATE -- - Deject3d function startBuilding(playerSource, commandName, objectid) if not objectid then outputChatBox("usage: /addgate objectid teamname", playerSource) return false end team = getTeamName(getPlayerTeam(playerSource)) if team == false then team = "" end for i = 1,20 do if Editor[i] == playerSource then destroyElement(Gate[i]) Gate[i] = null Editor[i] = null Precision[i] = null end if Editor[i] == null then Editor[i] = playerSource -- set Editor[i] to who made the object --creating object -v local x,y,z = getElementPosition(playerSource) object = createObject ( objectid, x + 3,y + 3,z) interior = getElementInterior ( playerSource ) setElementInterior(object,interior) now i have a warning for lines 20,36,38 Link to comment
Aibo Posted November 22, 2010 Share Posted November 22, 2010 about line 20 i've told you already, 36 and 38 depend on what you have in «objectid» variable. Link to comment
teronrussell Posted November 22, 2010 Author Share Posted November 22, 2010 i dont understand what exactly should i put for line 20 Link to comment
Aibo Posted November 22, 2010 Share Posted November 22, 2010 you should first check if player is in a team, and if it is — get team name. local team = getPlayerTeam(playerSource) if team then team = getTeamName(team) else team = "" end Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now