Loading map from files
#1

I need help with a function...
...well, I have NO clue how to do this, because I have no experience with something like that.
The files are made like this:
Код:
modelid, posx, posy, posz, rotx, roty, rotz
modelid,...
...
Those will be loaded with "CreateObject()", when the race is loaded, and destroyed with "DestroyObject()", when the race ends.

I only have this:
http://pawn.pastebin.com/m493fdd50

Well I don't know if I've done anything good
Reply
#2

Can't anybody help me?
I really need this, but have no clue. I don't know how to read all those info's out of the file. It's with one object per line.
Reply
#3

You want an object or a Checkpoint ?
Reply
#4

Quote:
Originally Posted by Peter Corneile
You want an object or a Checkpoint ?
Multiple Objects...
the checkpoints are working 100%.
Reply
#5

Well i would suggest this

pawn Код:
forward NearObject(playerid);
new MultipleObjects[MAX_PLAYERS];
pawn Код:
if (strcmp("/race", cmdtext,true, 10) == 0)
 {

  CreateObject(coords);
  racecheckpoint[playerid] = 1;
  return 1;
 }
Then make a new public

pawn Код:
public NearObject(playerid)

{
   DestroyObject(objectid);
   if(MultipleObjects[playerid] == 1)
   {
     CreateObject(next object coords);
     MultipleObjects[playerid] = 2; // NEXT Object
     
   }
   return 1;
}
This is untested , just made this as i read the post xD .......
Reply
#6

Quote:
Originally Posted by Y_Leѕѕ
You haven't actually included the LoadRaceMap function in that code. However if you use sscanf it would be something along the lines of:

pawn Код:
sscanf(inputLine, "p,iffffff", model, x, y, z, rx, ry, z);
First: Where should I put that?
And second: The main problem is that I REALLY HAVE NO CLUE how I can realize that idea, of loading/unloading a map with the race. I haven't scripted for 1.5 years and have really no clue. On another forum I asked something similar to this question here, but I can't remember where it was...
Reply
#7

Quote:
Originally Posted by Y_Leѕѕ
Well you said you had code to load checkpoints - start by reading that code to see what it does and modify things slowly. If you can't remember how to script you need to do what you did when you first started - look at existing code and modify it to see what happens, then go and learn from there.
Well, the checkpoint code isn't mine. I'm currently working on a mod of Yagu's Race filterscript (again) with more features. The thing is, that I don't know how to read out files properly, so that it's like that:
Код:
racemap = {
CreateObject(1st line of file);
CreateObject(2nd line of file);
...}
and later
Код:
DestroyObject(racemap);
Reply
#8

Did you test the code i gave you ? Or it went to vain ?
Reply
#9

Quote:
Originally Posted by Peter Corneile
Did you test the code i gave you ? Or it went to vain ?
Ty for your code, but it's not what I need. The point is that the modelid, coords and the rotations are saved in a file. I need to read out those. To make it easier the infos in the file have exactly the same syntax like the CreateObject() function in normal.
Reply
#10

So , the codes in a FS ? And you want it to be used in your GM while being in the FS ?
Reply
#11

Quote:
Originally Posted by Peter Corneile
So , the codes in a FS ? And you want it to be used in your GM while being in the FS ?
Yes, the original FS is Yagu's Race Filterscript, you can find here:
http://forum.sa-mp.com/index.php?topic=20637.0

The files are in the scriptfiles folder together with the race files. For example:
Код:
.../scriptfiles/fastlane.yr
.../scriptfiles/fastlane.y+  => That's the file with the modelid's, the coord's and the rot's
Reply
#12

I know yagu's script but i dont know if i can use it in my GM while being in a FS ......
Reply
#13

Quote:
Originally Posted by Peter Corneile
I know yagu's script but i dont know if i can use it in my GM while being in a FS ......
Ehhhm, I don't understand this right now...
...I'm adding this function with some others. That one is the most important one. When I get this working, I'll upload that new FS. In other words:
It's all in one FS.
Reply
#14

Can't anybody help me
The first thing would be reading out one line. Please help me...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)