Help with reading map objects and spawns from a file.
#1

THIS IS SOLVED.
Hello everyone,

So here's the thing.
I'm using/editing, well more editing(Learning) than using, Grim_'s Sumo Gamemode.And, you've to create objects, and different spawn positions for every map...
And the code for spawns is something like:
pawn Код:
new Float:SumoSpawns[MAX_MAPS][MAX_PLAYERS][4] =
{
    {
        {x, y, z, blah}, //Spawns for Map1
        {x, y, z, blah},
        .....
    },
    {
        {x, y, z, blah}, //Spawns for Map2
        {x, y, z, blah},
        .....
    },
And so on...
And the map part looks like:
pawn Код:
LoadMapObjects()
{
    switch(iMap)
    {
        case 0:
        {
            CreateObject{Blaaaaah}; //Map1
            CreateObject{Blaaaaah};
        }
        case 1:
        {
            CreateObject{Blaaaaah}; //Map2
            CreateObject{Blaaaaah};        
        }
    }
}
..So what i wanted is to (somehow) read the map objects and spawns, from a .txt file in scriptfiles.Because like this(i have 12 maps at the moment) the code is really messy and takes long time to find what i was looking for.And yes, i've looked at the wiki and searched around but had no success.

Thanks in advance.
Reply
#2

Sorry for bumping, but I really need help with this. Thanks.
Reply
#3

Check the LoadStaticVehiclesFromFile() function from Grandlarc (gamemode you get with the server) for hints on how to do it
Reply
#4

Thank you! It helped me But now i'm getting this error:
Код:
\pawno\include\sumo_spawns.inc(269) : error 052: multi-dimensional arrays must be fully initialized
It is the last line in sumo_spawns.inc.It looks:
Код:
#define MAX_MAPS 12
new Float:SumoSpawns[MAX_MAPS][MAX_PLAYERS][4] = 
{
        {
-REST OF SPAWN POSITIONS-
        },
	{
 		{bla, bla, -bla, -bla};
		{ble, ble, -ble, -ble};
 		{And 18 more spawn positions}        		
	}
}; //Here is the error o.O
Reply
#5

Just to say, i did it.I just had to #define MAX_PLAYERS in the include, it works now.Thanks for helping very much.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)