A small question
#1

It is possible to put objects within a file, and everytime I get the server on it will reload the map from the file itself instead of spamming my gamemode with mapping and such.
Reply
#2

Yes, it is.
Reply
#3

Quote:
Originally Posted by Kevln
Посмотреть сообщение
Yes, it is.
Arh-.. and how do I do so?
Reply
#4

Filterscripts are a great way. We keep all of our mapping in one - then reload the filterscript everytime we do a gmx. Quite easy to create.
Reply
#5

Quote:
Originally Posted by DemME
Посмотреть сообщение
Arh-.. and how do I do so?
You could have them stored in a file using a specifier to separate the object model, x, y, z positions, x, y, z rotations respectively and finally use sscanf.

Imagine I have a file called objects.txt in the scriptfiles folder, and I've predefined the following format to store the objects in the file:

Код:
Object model|PosX|PosY|PosZ|RotX|RotY|RotZ
Note I'm using the | delimiter to break up the needed information for each object.


If we considerate the format stated above we might end up with a line into the file which would look like this:

Код:
19941|144.134|931.33|444.11|0.0|.0.0|0.0
4141|1444.134|1131.33|44.11|0.0|.0.0|0.0
5414|1484.134|51.33|344.11|0.0|.0.0|0.0
Now to load these objects and create them in game you would come up with something like this:

PHP код:
LoadObjects()
{
    new 
        
File:handle fopen("objects.txt"io_read),
        
buf[128]
    ;
    if(!
handle) return 0;
    new
        
model,
        
Float:pos[3],
        
Float:rot[3],
        
count
    
;
    while(
fread(handlebuf))
    {
        if(
sscanf(buf"p<|>dffffff"modelpos[0], pos[1], pos[2], rot[0], rot[1], rot[2]))
        {
            
count++;
            
CreateObject(modelpos[0], pos[1], pos[2], rot[0], rot[1], rot[2]);
        }
    }
    
fclose(handle);
    
printf("Objects loaded from 'objects.txt': %d objects."count);
    return 
1;

Reply
#6

https://github.com/AbyssMorgan/ADM/b...pts/objsX2.pwn

Permitted record
PHP код:
CreateDynamicObject(modelidFloat:xFloat:yFloat:zFloat:rxFloat:ryFloat:rz);
CreateDynamicObject(modelidFloat:xFloat:yFloat:zFloat:rxFloat:ryFloat:rzworldid);
CreateDynamicObject(modelidFloat:xFloat:yFloat:zFloat:rxFloat:ryFloat:rzworldidinteriorid);
CreateDynamicObject(modelidFloat:xFloat:yFloat:zFloat:rxFloat:ryFloat:rzworldidinterioridplayerid);
CreateDynamicObject(modelidFloat:xFloat:yFloat:zFloat:rxFloat:ryFloat:rzworldidinterioridplayeridFloat:streamdistance);
CreateDynamicObject(modelidFloat:xFloat:yFloat:zFloat:rxFloat:ryFloat:rzworldidinterioridplayeridFloat:streamdistanceFloat:drawdistance); 
Reply
#7

https://github.com/Gammix/Map-Loader

An edit of Southclaw's map parser filterscript to an include, you can very easily move all your map code to a file and then do in your script:
pawn Код:
Map_Load("your_file_name");
Many other interesting features as well, and this only supports streamer and streamer items only.
Reply
#8

Quote:
Originally Posted by Gammix
Посмотреть сообщение
https://github.com/Gammix/Map-Loader

An edit of Southclaw's map parser filterscript to an include, you can very easily move all your map code to a file and then do in your script:
pawn Код:
Map_Load("your_file_name");
Many other interesting features as well, and this only supports streamer and streamer items only.
Genius! thanks
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)