Jump to content

Need Help About Scripting


[DemoN]

Recommended Posts

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

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

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