Pickups don't appear
#1

Yet another question.

The pickups of my houses do not appear (server creates them all at 0 0 0)
I don't know where to search, because it compiles just fine.

pawn Код:
public OnGameModeInit()
{

    // Objects and cars etc

    for(new p = 0; p <= MAX_HOUSES; p++)
    {
      new section[32];
      new fX, fY, fZ;
      valstr(section, p);
        getINIStringDefault("HOUSES_A.ini", section, "posx", "10.0", HouseInfoA[p][posx]);
        getINIStringDefault("HOUSES_A.ini", section, "posy", "10.0", HouseInfoA[p][posy]);
        getINIStringDefault("HOUSES_A.ini", section, "posz", "10.0", HouseInfoA[p][posz]);
        getINIStringDefault("HOUSES_A.ini", section, "sold", "true", HouseInfoA[p][sold]);

        fX = strval(HouseInfoA[p][posx]);
        fY = strval(HouseInfoA[p][posy]);
        fZ = strval(HouseInfoA[p][posz]);

        Icons_Houses_A[p] = CreatePickup(1239, 23, fX, fY, fZ);
        printf("Pickup [%i] created at: %f, %f, %f", p, fX, fY, fZ);
       
    }
    return 1;
}
This displays in the console:

Код:
Pickup [0] created at: 0.000000, 0.000000, 0.000000
Pickup [1] created at: 0.000000, 0.000000, 0.000000
Pickup [2] created at: 0.000000, 0.000000, 0.000000
Pickup [3] created at: 0.000000, 0.000000, 0.000000
Pickup [4] created at: 0.000000, 0.000000, 0.000000
Pickup [5] created at: 0.000000, 0.000000, 0.000000
Pickup [6] created at: 0.000000, 0.000000, 0.000000
Reply
#2

It looks like you're getting the Float positions of the house from the ini as strings.. If you saved them as Floats you would not have to use strval() to retrieve them, and this might fix a problem..

EDIT: Dini would help here...
Reply
#3

The ini file looks like this:

Код:
[0]
posx=659.3267 
posy=-2415.0774
posz=9.6549
sold=false
owner=Test
price=1000
rent=50

[1]
posx=658.0355
posy=-2374.7556
posz=9.9662
sold=false
owner=Test
price=1000
rent=50

etc.
Should I add quotes around the values or what?
Reply
#4

I've only ever used Dini, which I found to be highly successful... I'm worried that there are Floats mixed in with strings, and fear that lead to something..
Reply
#5

That is because these values are Floats, so you need to use the proper function/formats.

Start by changing:

new fX, fY, fZ;

to

new Float:fX, Float:fY, Float:fZ;

After that, use floatstr instead of strval.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)