[DemoN] Posted June 3, 2011 Share Posted June 3, 2011 Hello Guys. I'm trying to learn how to make script. I was making a special room for admins but it says TestRoom\script.lua:1: unexpected symbol near ´ ' ´ I need help. Here is my code: local hqEnter = createMarker ( -1944.1850585938, 883.42474365234, 40.861415863037, 'arrow', 1, 0, 255, 0, 150 ) local hqExit = createMarker ( -1937.171875, 883.54663085938, 32.687938690186, 'arrow', 1, 0, 255, 0, 150 ) local hqAdminEnter = createMarker (-1965.48828125, 880.1640625, 21.552816390991, 'corona', 1, 0, 255, 0, 0) local hqAdminExit = createMarker (-1966.7939453125, 880.14501953125, 21.552816390991, 'corona', 1, 0, 255, 0, 0) local hqPartyGuns = createMarker (-1950.0562744141, 877.08581542969, 28.183406829834, 'cylinder', 1, 255, 0, 0, 150) local hqAdminGuns = createMarker (-1980.4031982422, 879.88684082031, 20.843906402588, 'cylinder', 1, 0, 255, 0, 150) -------------------------- function Enter( hitPlayer, matchingDimension ) local account = getPlayerAccount(hitPlayer) aclGroups = if isObjectInACLGroup( 'user.'..getAccountName( account ), aclGetGroup( 'Member' ) ) then setElementPosition ( hitPlayer, -1935, 884, 33 ) elseif aclGroups = if isObjectInACLGroup( 'user.'..getAccountName( account ), aclGetGroup( 'V.I.P' ) ) then setElementPosition ( hitPlayer, -1935, 884, 33 ) elseif aclGroups = if isObjectInACLGroup( 'user.'..getAccountName( account ), aclGetGroup( 'Moderator' ) ) then setElementPosition ( hitPlayer, -1935, 884, 33 ) elseif aclGroups = if isObjectInACLGroup( 'user.'..getAccountName( account ), aclGetGroup( 'Admin' ) ) then setElementPosition ( hitPlayer, -1935, 884, 33 ) outputChatBox ( "Entering to the Room Test1",hitPlayer ) else outputChatBox ( "Error Test1!",hitPlayer ) end end addEventHandler( "onMarkerHit", hqEnter, Enter ) function Exit( hitPlayer, matchingDimension ) setElementPosition ( hitPlayer, -1945, 884, 40 ) end addEventHandler( "onMarkerHit", hqExit, Exit ) --------------------------------------------- function adminEnter( hitPlayer, matchingDimension ) local account = getPlayerAccount(hitPlayer) if isObjectInACLGroup( 'user.'..getAccountName( account ), aclGetGroup( 'Admin' ) ) then setElementPosition ( hitPlayer, -1967, 881, 22 ) outputChatBox ( "Entering to the Room Test2",hitPlayer ) else outputChatBox ( "Error Test2!",hitPlayer ) end end addEventHandler( "onMarkerHit", hqAdminEnter, adminEnter ) function adminExit( hitPlayer, matchingDimension ) setElementPosition ( hitPlayer, -1962, 881, 22 ) end addEventHandler( "onMarkerHit", hqAdminExit, adminExit ) --------------------------------------------- function partyGuns( hitPlayer, matchingDimension ) local account = getPlayerAccount(hitPlayer) if isObjectInACLGroup( 'user.'..getAccountName( account ), aclGetGroup( 'Moderator' ) ) then giveWeapon( hitPlayer, 29, 10000 ) giveWeapon( hitPlayer, 31, 10000 ) giveWeapon( hitPlayer, 34, 10000 ) giveWeapon( hitPlayer, 17, 10000 ) giveWeapon( hitPlayer, 46, 10000 ) giveWeapon( hitPlayer, 5, 1 ) setElementHealth ( hitPlayer, 1000 ) addEventHandler( "onMarkerHit", hqPartyGuns, partyGuns ) function adminGuns( hitPlayer, matchingDimension ) local account = getPlayerAccount(hitPlayer) if isObjectInACLGroup( 'user.'..getAccountName( account ), aclGetGroup( 'Admin' ) ) then giveWeapon( hitPlayer, 28, 10000 ) giveWeapon( hitPlayer, 31, 10000 ) giveWeapon( hitPlayer, 34, 10000 ) giveWeapon( hitPlayer, 39, 10000 ) giveWeapon( hitPlayer, 46, 10000 ) giveWeapon( hitPlayer, 9, 1 ) setElementHealth ( hitPlayer, 1000 ) addEventHandler( "onMarkerHit", hqAdminGuns, adminGuns ) Link to comment
Aibo Posted June 3, 2011 Share Posted June 3, 2011 lines 12,14,16,18: if statement does not work that way. also missing "end"s: local hqEnter = createMarker ( -1944.1850585938, 883.42474365234, 40.861415863037, 'arrow', 1, 0, 255, 0, 150 ) local hqExit = createMarker ( -1937.171875, 883.54663085938, 32.687938690186, 'arrow', 1, 0, 255, 0, 150 ) local hqAdminEnter = createMarker (-1965.48828125, 880.1640625, 21.552816390991, 'corona', 1, 0, 255, 0, 0) local hqAdminExit = createMarker (-1966.7939453125, 880.14501953125, 21.552816390991, 'corona', 1, 0, 255, 0, 0) local hqPartyGuns = createMarker (-1950.0562744141, 877.08581542969, 28.183406829834, 'cylinder', 1, 255, 0, 0, 150) local hqAdminGuns = createMarker (-1980.4031982422, 879.88684082031, 20.843906402588, 'cylinder', 1, 0, 255, 0, 150) -------------------------- function Enter( hitPlayer, matchingDimension ) local account = getPlayerAccount(hitPlayer) if isObjectInACLGroup( 'user.'..getAccountName( account ), aclGetGroup( 'Member' ) ) then setElementPosition ( hitPlayer, -1935, 884, 33 ) elseif isObjectInACLGroup( 'user.'..getAccountName( account ), aclGetGroup( 'V.I.P' ) ) then setElementPosition ( hitPlayer, -1935, 884, 33 ) elseif isObjectInACLGroup( 'user.'..getAccountName( account ), aclGetGroup( 'Moderator' ) ) then setElementPosition ( hitPlayer, -1935, 884, 33 ) elseif isObjectInACLGroup( 'user.'..getAccountName( account ), aclGetGroup( 'Admin' ) ) then setElementPosition ( hitPlayer, -1935, 884, 33 ) outputChatBox ( "Entering to the Room Test1",hitPlayer ) else outputChatBox ( "Error Test1!",hitPlayer ) end end addEventHandler( "onMarkerHit", hqEnter, Enter ) function Exit( hitPlayer, matchingDimension ) setElementPosition ( hitPlayer, -1945, 884, 40 ) end addEventHandler( "onMarkerHit", hqExit, Exit ) --------------------------------------------- function adminEnter( hitPlayer, matchingDimension ) local account = getPlayerAccount(hitPlayer) if isObjectInACLGroup( 'user.'..getAccountName( account ), aclGetGroup( 'Admin' ) ) then setElementPosition ( hitPlayer, -1967, 881, 22 ) outputChatBox ( "Entering to the Room Test2",hitPlayer ) else outputChatBox ( "Error Test2!",hitPlayer ) end end addEventHandler( "onMarkerHit", hqAdminEnter, adminEnter ) function adminExit( hitPlayer, matchingDimension ) setElementPosition ( hitPlayer, -1962, 881, 22 ) end addEventHandler( "onMarkerHit", hqAdminExit, adminExit ) --------------------------------------------- function partyGuns( hitPlayer, matchingDimension ) local account = getPlayerAccount(hitPlayer) if isObjectInACLGroup( 'user.'..getAccountName( account ), aclGetGroup( 'Moderator' ) ) then giveWeapon( hitPlayer, 29, 10000 ) giveWeapon( hitPlayer, 31, 10000 ) giveWeapon( hitPlayer, 34, 10000 ) giveWeapon( hitPlayer, 17, 10000 ) giveWeapon( hitPlayer, 46, 10000 ) giveWeapon( hitPlayer, 5, 1 ) setElementHealth ( hitPlayer, 1000 ) end -- missing end -- missing addEventHandler( "onMarkerHit", hqPartyGuns, partyGuns ) function adminGuns( hitPlayer, matchingDimension ) local account = getPlayerAccount(hitPlayer) if isObjectInACLGroup( 'user.'..getAccountName( account ), aclGetGroup( 'Admin' ) ) then giveWeapon( hitPlayer, 28, 10000 ) giveWeapon( hitPlayer, 31, 10000 ) giveWeapon( hitPlayer, 34, 10000 ) giveWeapon( hitPlayer, 39, 10000 ) giveWeapon( hitPlayer, 46, 10000 ) giveWeapon( hitPlayer, 9, 1 ) setElementHealth ( hitPlayer, 1000 ) end -- missing end -- missing addEventHandler( "onMarkerHit", hqAdminGuns, adminGuns ) Link to comment
[DemoN] Posted June 3, 2011 Author Share Posted June 3, 2011 Thanks for helping. I've just tried it but it still says TestRoom\script.lua:1: unexpected symbol near ´ ' ´ It fails. My map was loaded but markers were not Link to comment
Aibo Posted June 3, 2011 Share Posted June 3, 2011 check your lua file encoding then. like ANSI or UTF-8 Link to comment
[DemoN] Posted June 3, 2011 Author Share Posted June 3, 2011 check your lua file encoding then. like ANSI or UTF-8 What are ANSI and UTF-8?? No need to turn this topic into Lesson Topic. Just pm me.. Link to comment
BriGhtx3 Posted June 3, 2011 Share Posted June 3, 2011 I tested it and it works. Try to delete your script and paste the one of Aibo Link to comment
Aibo Posted June 3, 2011 Share Posted June 3, 2011 check your lua file encoding then. like ANSI or UTF-8 What are ANSI and UTF-8?? No need to turn this topic into Lesson Topic. Just pm me.. what editor are you using for scripting? if windows notepad — when saving, make sure encoding is not UTF-8 but ANSI (look for dropdown in save dialog). also: dont use windows notepad. Link to comment
[DemoN] Posted June 4, 2011 Author Share Posted June 4, 2011 what editor are you using for scripting?if windows notepad — when saving, make sure encoding is not UTF-8 but ANSI (look for dropdown in save dialog). also: dont use windows notepad. I use Windows Notepad and it is ANSI not UTF-8. What do you suggest? Link to comment
BriGhtx3 Posted June 4, 2011 Share Posted June 4, 2011 Try to use an LUA Editor, like LuaEdit or LUA Scite (recommend) Link to comment
Castillo Posted June 5, 2011 Share Posted June 5, 2011 I would use Notepad++, it's the one I use, it's perfect, syntax highlighting and so on, you can download it here. Link: http://notepad-plus-plus.org/download Link to comment
[DemoN] Posted June 5, 2011 Author Share Posted June 5, 2011 Try to use an LUA Editor, like LuaEdit or LUA Scite (recommend) Thank you xthepr0mise. I'll try it I would use Notepad++, it's the one I use, it's perfect, syntax highlighting and so on, you can download it here.Link: http://notepad-plus-plus.org/download Thanks Castillo. I'll try it too 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