Jump to content

Wrong script


iPot

Recommended Posts

I got this code here wich gives an error where I can't find the solution for. Anyone that can help is thankful.

Here's the error btw:

 [19:26:43] SCRIPT ERROR: ...Program Files/MTA DM/server/mods/deathmatc s/Headcrab/spawn.lua:13: unexpected symbol near ')' [19:26:43] INFO: Loading script failed: ...Program Files/MTA DM/server hmatch/resources/Headcrab/spawn.lua:13: unexpected symbol near ')' 

And here's the code:

function startMap(startedMap) 
local mapRoot = getResourceRootElement(startedMap) 
local players = getElementsByType("player") 
  
fadeCamera ( thePlayer, false, 1.0, 0, 0, 0 )       
for key, player in pairs(players) do 
local spawn = spawns[math.random(1, #spawns)] 
local posX = getElementData(spawn, "posX") 
local posY = getElementData(spawn, "posY") 
local posZ = getElementData(spawn, "posZ") 
local angle = getElementData(spawn, "angle") 
spawnPlayer(player, posX, posY, posZ, angle)) 
end 
end 
  
addEventHandler("onGamemodeMapStart", getRootElement(), startMap 

Tom :fadein:

Link to comment

Try

function startMap(startedMap) 
local mapRoot = getResourceRootElement(startedMap) 
local players = getElementsByType("player") 
  
fadeCamera ( thePlayer, false, 1.0, 0, 0, 0 )       
for key, player in pairs(players) do 
local spawn = spawns[math.random(1, #spawns)] 
local posX = getElementData(spawn, "posX") 
local posY = getElementData(spawn, "posY") 
local posZ = getElementData(spawn, "posZ") 
local angle = getElementData(spawn, "angle") 
spawnPlayer(player, posX, posY, posZ, angle) 
end 
end 
addEventHandler ( "onGamemodeMapStart", getRootElement(), startMap ) 

Link to comment

There's another 1 :D

[20:24:07] SCRIPT ERROR: ...Program Files/MTA DM/server/mods/deathmatch/resource 
s/Headcrab/spawn.lua:8: ']' expected near 'local' 
[20:24:07] INFO: Loading script failed: ...Program Files/MTA DM/server/mods/deat 
hmatch/resources/Headcrab/spawn.lua:8: ']' expected near 'local' 

I used the exact code as you said.

Tom :fadein:

Link to comment
There's another 1 :D

[20:24:07] SCRIPT ERROR: ...Program Files/MTA DM/server/mods/deathmatch/resource 
s/Headcrab/spawn.lua:8: ']' expected near 'local' 
[20:24:07] INFO: Loading script failed: ...Program Files/MTA DM/server/mods/deat 
hmatch/resources/Headcrab/spawn.lua:8: ']' expected near 'local' 

I used the exact code as you said.

Tom :fadein:

I eddited try the code standing there now... (Oh jeah i tested it and i get no errors.)

Link to comment

Here are all my code's now :

Meta for gamemode:

<meta> 
    <info author="Underworld" name="Bla" version="1" type="gamemode"/> 
    <config src="help.xml" type="client" />  
<script src="spawn.lua" /> 
</meta> 
  

Spawn script:

function startMap(startedMap) 
local mapRoot = getResourceRootElement(startedMap) 
local players = getElementsByType("player") 
  
fadeCamera ( thePlayer, false, 1.0, 0, 0, 0 )       
for key, player in pairs(players) do 
local spawn = spawns[math.random(1, #spawns)] 
local posX = getElementData(spawn, "posX") 
local posY = getElementData(spawn, "posY") 
local posZ = getElementData(spawn, "posZ") 
local angle = getElementData(spawn, "angle") 
spawnPlayer(player, posX, posY, posZ, angle) 
end 
end 
addEventHandler ( "onGamemodeMapStart", getRootElement(), startMap ) 

---------------------------------------------------------------------------------------------------------------

Meta for the map:

<meta> 
    <info author="Underworld" description="map" version="1" type="map" gamemodes="Bla"/> 
    <map src="Bla.map"/> 
</meta> 

And here, the map:

 <map> 
    <spawnpoint posX="2495.1257324219" posY="-1686.6124267578" posZ="13.513834953308" angle="3.4530944824219"/> 
     <spawnpoint posX="2519.9204101563" posY="-1678.9359130859" posZ="14.879755020142" angle="91.500610351563"/> 
    <spawnpoint posX="2509.6416015625" posY="-1654.0524902344" posZ="13.655654907227" angle="135.68103027344"/> 
   <spawnpoint posX="2487.0036621094" posY="-1647.6352539063" posZ="14.0703125" angle="181.4281463623"/> 
    <spawnpoint posX="2471.869140625" posY="-1686.2700195313" posZ="13.5078125" angle="325.85275268555"/> 
   <spawnpoint posX="2469.6413574219" posY="-1650.4163818359" posZ="13.471806526184" angle="183.62147521973"/> 
    <spawnpoint posX="2452.4020996094" posY="-1646.6909179688" posZ="13.468873977661" angle="178.92138671875"/> 
</map> 

Link to comment

Try this

function startMap(startedMap) 
local mapRoot = getResourceRootElement(startedMap) 
local players = getElementsByType("player") 
local spawns = getElementsByType("spawnpoint") 
      
for key, player in pairs(players) do 
local spawn = spawns[math.random(1, #spawns)] 
local posX = getElementData(spawn, "posX") 
local posY = getElementData(spawn, "posY") 
local posZ = getElementData(spawn, "posZ") 
local angle = getElementData(spawn, "angle") 
spawnPlayer(player, posX, posY, posZ, angle) 
fadeCamera (player, false, 1.0, 0, 0, 0 )   
end 
end 
addEventHandler ( "onGamemodeMapStart", getRootElement(), startMap ) 

Edit: bah eAi was faster :)

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