Gamesnert Posted May 24, 2008 Posted May 24, 2008 Hello everybody, Since a few days i'm trying to make a MTA server to play on with my friends. I want it to be a TDM server, and the problems is the T for team... I paste the script and the error here, because i don't exactly know what's wrong. Only the important part, the part where it goes wrong is at "call(getresourcefromname....(etc)". Since i'm inexperienced and didn't find a topic to help, i posted this threat on the forums. And the Wiki tutorial doesn't work too, so that's why i didn't take that script. Before i forget, my reason for this script is to make spawnpoints for a certain team only. --3 spawnpoints voor Restricted Area: --1:283.339 1972.488 17.64063 --2:279.5817 2013.327 17.64063 --3:338.7903 2012.863 20.63943 --1 spawnpoint voor Airport Graveyard: --1:397.40676879883 2533.9304199219 16.544166564941 --Anderen moeten nog komen... addEventHandler("onPlayerJoin",getRootElement(), function() local joinedPlayerName = getClientName ( source ) joinHandler(source) outputChatBox ( "Welcome " .. joinedPlayerName .. " to my server." , source, 255, 255, 255 ) end ) addEventHandler("onPlayerWasted",getRootElement(), function() setTimer(joinHandler,5000,1,source) end ) addEventHandler("onResourceStart",getRootElement(), function(res) if res == getThisResource() then team1 = getElementByID("team1") team2 = getElementByID("team2") for _,player in pairs(getElementsByType("player")) do setTimer(joinHandler,1000,1,player) end end end ) call(getResourceFromName("spawnmanager"), "setSpawnpointTeam", getElementByID("spawnpoint1"), getElementByID("team1") ) call(getResourceFromName("spawnmanager"), "setSpawnpointTeam", getElementByID("spawnpoint2"), getElementByID("team1") ) call(getResourceFromName("spawnmanager"), "setSpawnpointTeam", getElementByID("spawnpoint3"), getElementByID("team1") ) call(getResourceFromName("spawnmanager"), "setSpawnpointTeam", getElementByID("spawnpoint4"), getElementByID("team2") ) function joinHandler(player) fadeCamera(player,true) call(getResourceFromName("spawnmanager"),"spawnPlayerAtSpawnpoint",player) balanceTeams(player) end function balanceTeams ( thePlayer ) if not getPlayerTeam(thePlayer) then if countPlayersInTeam(team1) > countPlayersInTeam(team2) then setPlayerTeam ( thePlayer , team2 ) else setPlayerTeam ( thePlayer , team1 ) end end end I also paste the map file, except the map file and this one there is no other script for my server. (except for quite much lines for vehicles+spawn, but that just works.) <map mode="myserver" version="1.0"> <!-- Creeër teams --> <team name="team1" colorR="255" colorG="0" colorB="0" friendlyfire="true"/> <team name="team2" colorR="255" colorG="255" colorB="0" friendlyfire="true" /> <!-- Coalitie spawns --> <spawnpoint id="spawnpoint1" posX="283.339" posY="1972.488" posZ="17.64063" rot="270" skin="287"/> <spawnpoint id="spawnpoint2" posX="279.5817" posY="2013.327" posZ="17.64063" rot="270" skin="287"/> <spawnpoint id="spawnpoint3" posX="338.7903" posY="2012.863" posZ="20.63943" rot="270" skin="287"/> <!-- Oppositie spawns --> <spawnpoint id="spawnpoint4" posX="397.40676879883" posY="2533.9304199219" posZ="16.544166564941" rot="270" skin="287"/> <!-- Coalitie wapens --> <pickup posX="320.49975585938" posY="1961.5589599609" posZ="17.640625" type="31" amount="250" respawn="30000"/> <pickup posX="320.49975585938" posY="1956.5589599609" posZ="17.640625" type="29" amount="200" respawn="30000"/> <pickup posX="325.49975585938" posY="1956.5589599609" posZ="17.640625" type="16" amount="15" respawn="30000"/> <pickup posX="325.49975585938" posY="1961.5589599609" posZ="17.640625" type="34" amount="25" respawn="30000"/> <pickup posX="320.49975585938" posY="1951.5589599609" posZ="17.640625" type="armor" amount="100" respawn="30000"/> <pickup posX="325.49975585938" posY="1951.5589599609" posZ="17.640625" type="36" amount="5" respawn="30000"/> <!-- Oppositie wapens --> <pickup posX="415.55285644531" posY="2531.0788574219" posZ="19.17321395874" type="35" amount="10" respawn="30000"/> <pickup posX="413.05285644531" posY="2531.0788574219" posZ="19.17321395874" type="36" amount="5" respawn="30000"/> <pickup posX="415.55285644531" posY="2533.5788574219" posZ="19.17321395874" type="18" amount="5" respawn="30000"/> </map> Help would be very apriciated, Gamesnert. P.S. Sorry for most of the comments being Dutch, but there is no crucial information in it. EDIT: Foolish me... Forgot the error... "spawn.lua*: setSpawnpointTeam: Invalid variable specified as team. Element expected, got boolean. - Line: 47" * = This is a strange part since the script is called "script.lua", not spawn. Still the server file thinks so...
Gamesnert Posted May 24, 2008 Author Posted May 24, 2008 Hello everybody, Since a few days i'm trying to make a MTA server to play on with my friends. I want it to be a TDM server, and the problems is the T for team... I paste the script and the error here, because i don't exactly know what's wrong. Only the important part, the part where it goes wrong is at "call(getresourcefromname....(etc)". Since i'm inexperienced and didn't find a topic to help, i posted this threat on the forums. And the Wiki tutorial doesn't work too, so that's why i didn't take that script. Before i forget, my reason for this script is to make spawnpoints for a certain team only. --3 spawnpoints voor Restricted Area:--1:283.339 1972.488 17.64063--2:279.5817 2013.327 17.64063--3:338.7903 2012.863 20.63943 --1 spawnpoint voor Airport Graveyard:--1:397.40676879883 2533.9304199219 16.544166564941--Anderen moeten nog komen... addEventHandler("onPlayerJoin",getRootElement(), function() local joinedPlayerName = getClientName ( source ) joinHandler(source) outputChatBox ( "Welcome " .. joinedPlayerName .. " to my server." , source, 255, 255, 255 ) end ) addEventHandler("onPlayerWasted",getRootElement(), function() setTimer(joinHandler,5000,1,source) end ) addEventHandler("onResourceStart",getRootElement(), function(res) if res == getThisResource() then team1 = getElementByID("team1") team2 = getElementByID("team2") for _,player in pairs(getElementsByType("player")) do setTimer(joinHandler,1000,1,player) end end end ) call(getResourceFromName("spawnmanager"), "setSpawnpointTeam", getElementByID("spawnpoint1"), getElementByID("team1") )call(getResourceFromName("spawnmanager"), "setSpawnpointTeam", getElementByID("spawnpoint2"), getElementByID("team1") )call(getResourceFromName("spawnmanager"), "setSpawnpointTeam", getElementByID("spawnpoint3"), getElementByID("team1") )call(getResourceFromName("spawnmanager"), "setSpawnpointTeam", getElementByID("spawnpoint4"), getElementByID("team2") ) function joinHandler(player) fadeCamera(player,true) call(getResourceFromName("spawnmanager"),"spawnPlayerAtSpawnpoint",player) balanceTeams(player) end function balanceTeams ( thePlayer ) if not getPlayerTeam(thePlayer) then if countPlayersInTeam(team1) > countPlayersInTeam(team2) then setPlayerTeam ( thePlayer , team2 ) else setPlayerTeam ( thePlayer , team1 ) end end end I also paste the map file, except the map file and this one there is no other script for my server. (except for quite much lines for vehicles+spawn, but that just works.) Help would be very apriciated, Gamesnert. P.S. Sorry for most of the comments being Dutch, but there is no crucial information in it. EDIT: Foolish me... Forgot the error... "spawn.lua*: setSpawnpointTeam: Invalid variable specified as team. Element expected, got boolean. - Line: 47" * = This is a strange part since the script is called "script.lua", not spawn. Still the server file thinks so...
Recommended Posts