Got problem with function
#7

I have again one little problem!
pawn Код:
#define MAX_ADS 20

enum KAdsInfo
{
    nblank,
    objectidsa,
    costed,
    Float:aX,
    Float:aY,
    Float:aZ,
    Float:rotX,
    Float:rotY,
    Float:rotZ,
    aObject,
    Text3D:aLabel
};

new kadscoords[MAX_ADS][KAdsInfo];

stock SavefixAds()
{
    new filestring[256];
    new File: file = fopen(AD_FILE, io_write);
    for(new adid = 0; adid < MAX_ADS; adid++)
    {
            format(filestring, sizeof(filestring), "%f,%f,%f,%f,%f,%f,%i,%i\n",
            kadscoords[adid][aX],
            kadscoords[adid][aY],
            kadscoords[adid][aZ],
            kadscoords[adid][rotX],
            kadscoords[adid][rotY],
            kadscoords[adid][rotZ],
            kadscoords[adid][objectidsa],
            kadscoords[adid][costed]
            );
        fwrite(file, filestring);
    }
    fclose(file);
}
Makes 20 lines wich are all identical zero... even it should create only 1 line per element, but why it does so?
Код:
0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0,0
0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0,0
0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0,0
0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0,0
0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0,0
0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0,0
0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0,0
0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0,0
0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0,0
0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0,0
0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0,0
0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0,0
0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0,0
0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0,0
0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0,0
0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0,0
0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0,0
0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0,0
0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0,0
0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0,0
The function part wich creates object ja 3dtext and saves coords to array..
pawn Код:
if (cSetting[fixmoney] > cSetting[adkyltti1])
            {
            new msg[145];
            new Float:x, Float:y, Float:z, Float:Angle;
            GetPlayerPos(playerid, x, y, z);
            GetPlayerFacingAngle(playerid, Angle);
            for(new adid = 1; adid < MAX_ADS; adid++)
            {
            kadscoords[adid][aX] = x;
            kadscoords[adid][aY] = y;
            kadscoords[adid][aZ] = z;
            kadscoords[adid][rotX] = 0.0;
            kadscoords[adid][rotY] = 0.0;
            kadscoords[adid][rotZ] = Angle;
            kadscoords[adid][aObject] = CreateDynamicObject(cSetting[adkylttiid1], kadscoords[adid][aX], kadscoords[adid][aY], kadscoords[adid][aZ], kadscoords[adid][rotX], kadscoords[adid][rotY], Angle);
            kadscoords[adid][aLabel] = Create3DTextLabel(fixcentername[fixcenteradtext], ADS_COLOR, kadscoords[adid][aX], kadscoords[adid][aY], kadscoords[adid][aZ], DRAW_DISRANCE_3DTEXT, 0, 1);
            }
            cSetting[fixmoney] = (cSetting[fixmoney] - cSetting[adkyltti1]);
            format(msg, sizeof(msg), "Ostit juuri kyltin joka maksoi %iЂ (Raha veloitettiin korjaamon tililtд ja sinne jдi vielд %iЂ)", cSetting[adkyltti1], cSetting[fixmoney]);
            ShowPlayerDialog(playerid,0,DIALOG_STYLE_MSGBOX, fixcentername[fixcenter], msg, "OK","Poistu");
            UpdateDynamicADLabels();
            }
            else
            {
            SendClientMessage(playerid, COLOR_YELLOW, "Korjaamon tilillд ei ole edes noin paljon rahaa!");
            new string[65];
            format(string, sizeof(string), "Pieni kyltti %iЂ\nNormaali kyltti %iЂ\nIso kyltti %iЂ", cSetting[adkyltti1], cSetting[adkyltti2], cSetting[adkyltti3]);
            ShowPlayerDialog(playerid, 2356, DIALOG_STYLE_LIST, fixcentername[fixcenter], string, "Valitse", "Poistu");
            }
What wrong is it in?

BTW SavefixAds() is called on ongameexit.
Reply


Messages In This Thread
Got problem with function - by woaha - 13.11.2010, 14:57
Re: Got problem with function - by willsuckformoney - 13.11.2010, 15:01
Re: Got problem with function - by MadeMan - 13.11.2010, 15:25
Re: Got problem with function - by Mean - 13.11.2010, 18:39
Re: Got problem with function - by marko94 - 13.11.2010, 22:08
Re: Got problem with function - by woaha - 14.11.2010, 07:59
Re: Got problem with function - by woaha - 16.11.2010, 10:25
Re: Got problem with function - by woaha - 17.11.2010, 14:05
Re: Got problem with function - by woaha - 18.11.2010, 14:06
Re: Got problem with function - by woaha - 20.11.2010, 16:58

Forum Jump:


Users browsing this thread: 2 Guest(s)