It' not loading The objects from the file :(
#5

Quote:
Originally Posted by PowerPC603
Посмотреть сообщение
Try this:
pawn Код:
stock LoadObjectsFromFile(const filename[])
{
    new File:file = fopen(filename, io_read);
    if (!file) return 0;
    TotalObjects = 0;
    new line[100], modelid, Float:Pos[6];
    while (fread(file, line))
    {
        // Use "," as delimiter and read one integer and 6 floats, and store the values in the following variables
        sscanf(line, "p<,>iffffff", modelid, Pos[0], Pos[1], Pos[2], Pos[3], Pos[4], Pos[5]);

        ActivityObject[TotalObjects] = CreateDynamicObject(modelid, Pos[0], Pos[1], Pos[2], Pos[3], Pos[4], Pos[5], ActivityInfo[ActivityNumber][a_VirtualWorld], ActivityInfo[ActivityNumber][a_Interior]);
        TotalObjects++;
    }
    fclose(file);
    return printf("Objects Loaded: %d", TotalObjects);
}
It's much shorter and better looking as well.

You'll need to have sscanf plugin:
https://sampforum.blast.hk/showthread.php?tid=120356
I checked,
It does not print

return printf("Objects Loaded: %d", TotalObjects);

If it does not print then does not work


This file:
PHP код:
19129, -121.0011300, -3134.0932600 ,57.56268000.00000000.00000000.0000000 
19129
, -534.0517000,-3535.4785200,114.4814800,0.0000000,0.0000000,354.3518700 
19129
, -122.6251100,-3016.5725100,57.5626800,0.0000000,0.0000000,0.0000000 
19129
, -102.6189700,-3016.5590800,57.5626800,0.0000000,0.0000000,0.0000000 
18985
, -106.5768300,-3074.8088400,62.6421000,0.0000000,0.0000000,0.0000000 
18985
, -117.0517700,-3074.7829600,62.6421000,0.0000000,0.0000000,0.0000000 
18985
, -325.3542800,-3070.1792000,121.0345600,0.0000000,0.0000000,44.0141300 
18985
, -95.8325700,-3074.7893100,62.6421000,0.0000000,0.0000000,0.0000000 
19129
, -102.6106500,-2996.6013200,57.5626800,0.0000000,0.0000000,0.0000000 
19129
, -101.0454300,-3134.1303700,57.5626800,0.0000000,0.0000000,0.0000000 
18786
, -101.0143400,-3149.3740200,59.7643000,0.0000000,0.0000000,90.0000000 
18786
, -120.7318100,-3149.7727100,59.7643000,0.0000000,0.0000000,90.0000000 
19071
, -111.1166900,-3248.0314900,62.0510400,0.0000000,0.0000000,0.0000000 
19071
, -111.1058900,-3189.2966300,62.0510400,0.0000000,0.0000000,0.0000000 
10009
, -122.3169900,-3272.6711400,73.6331800,0.0000000,0.0000000,146.0429800 
10009
, -127.9908500,-3269.4316400,66.3223000,0.0000000,0.0000000,0.0000000 
10009
, -96.1774400,-3271.0693400,66.3223000,0.0000000,0.0000000,0.0000000 
10009
, -90.9951200,-3274.0444300,73.6331800,0.0000000,0.0000000,146.0429800 
10009
, -107.2300900,-3270.3752400,66.3223000,0.0000000,0.0000000,0.0000000 
10009
, -101.7403600,-3273.5800800,73.6331800,0.0000000,0.0000000,146.0429800 
10009
, -116.4964400,-3270.8779300,66.3223000,0.0000000,0.0000000,0.0000000 
10009
, -111.6371200,-3273.7575700,73.6331800,0.0000000,0.0000000,146.0429800 
4824
, -106.6922900,-3256.3996600,80.3698000,0.0000000,0.0000000,-90.0000000 
9164
, -189.8492100,-3189.6840800,84.7051000,0.0000000,0.0000000,90.0000000 
9164
, -106.6519300,-3214.1457500,84.7050900,0.0000000,0.0000000,0.0000000 
9164
, -130.8468900,-3189.6821300,84.7051000,0.0000000,0.0000000,90.0000000 
13562
, -241.4598200,-3189.9614300,81.7438000,0.0000000,0.0000000,0.0000000 
13562
, -221.9563100,-3189.1137700,81.7438000,0.0000000,0.0000000,0.0000000 
13562
, -227.0530400,-3189.2221700,81.7438000,0.0000000,0.0000000,0.0000000 
13562
, -232.1478900,-3189.5388200,81.7438000,0.0000000,0.0000000,0.0000000 
13562
, -236.8617400,-3189.7053200,81.7438000,0.0000000,0.0000000,0.0000000 
18367
, -304.6135600,-3190.2966300,88.1229900,0.0000000,0.0000000,90.0000000 
18367
, -242.9237400,-3190.2126500,88.1902000,0.0000000,0.0000000,-90.0000000 
896
, -353.1185000,-3181.6911600,80.8500100,0.0000000,0.0000000,0.0000000 
896
, -308.5878000,-3187.7360800,82.0067000,0.0000000,0.0000000,0.0000000 
896
, -324.0789800,-3190.9294400,80.8500100,0.0000000,0.0000000,0.0000000 
14596
, -340.6820100,-3162.8894000,111.2414400,0.0000000,0.0000000,216.3846000 
13749
, -344.2560100,-3173.7331500,93.8166000,0.0000000,0.0000000,0.0000000 
11496
, -329.8741500,-3158.0456500,117.7660000,0.0000000,0.0000000,-49.7000000 
11496
, -315.9997900,-3146.3725600,117.7660000,0.0000000,0.0000000,-49.7000000 
11496
, -286.3873900,-3120.3652300,119.0611100,0.0000000,0.0000000,-49.7000000 
3865
, -294.8303500,-3129.5437000,120.4394200,18.0000000,0.0000000,313.0000000 
11496
, -302.5575000,-3134.9267600,117.7660000,0.0000000,0.0000000,-49.7000000 
19333
, -286.3783000,-3115.5205100,118.2615000,0.0000000,0.0000000,312.7442000 
19333
, -288.0451700,-3113.8615700,118.2615000,0.0000000,0.0000000,312.7442000 
19333
, -289.6282000,-3112.1447800,118.2615000,0.0000000,0.0000000,312.7442000 
19333
, -291.2431300,-3110.3977100,118.2615000,0.0000000,0.0000000,312.7442000 
18985
, -127.4433800,-3074.8098100,62.6421000,0.0000000,0.0000000,0.0000000 
8397
, -429.4354200,-3042.2465800,110.4959300,90.0000000,0.0000000,-222.0000000 
8397
, -364.4501000,-3030.5649400,109.6570400,90.0000000,0.0000000,-135.0000000 
3887
, -434.6907300,-3046.8405800,125.1993100,0.0000000,0.0000000,342.2366600 
18779
, -443.0655200,-3094.9145500,132.7571400,0.0000000,0.0000000,76.0000000 
18769
, -517.4881600,-3331.4812000,114.0473100,0.0000000,0.0000000,345.5240800 
18999
, -488.9436600,-3227.7426800,133.7966500,98.0000000,0.0000000,343.3731700 
18769
, -455.7695300,-3121.9660600,142.0396100,0.0000000,0.0000000,347.9712500 
18836
, -534.2612300,-3410.3427700,119.5674000,0.0000000,57.0000000,348.0000000 
18836
, -524.9414100,-3366.5451700,119.5674400,0.0000000,0.0000000,347.8703000 
4853
,- 545.5495600,-3478.8073700,111.4241600,0.0000000,0.0000000,82.0385300 
19129
, -122.3889800,-2996.6264600,57.5626800,0.0000000,0.0000000,0.0000000 
19129
, -553.8348400,-3533.5881300,114.4814800,0.0000000,0.0000000,354.3518700 
19129
, -573.5466300,-3531.6853000,114.4814800,0.0000000,0.0000000,354.3518700 
19129
, -536.0752000,-3555.3422900,114.4814800,0.0000000,0.0000000,354.3518700 
19129
, -555.9111300,-3553.3278800,114.4814800,0.0000000,0.0000000,354.3518700 
19129
, -575.5449800,-3551.4824200,114.4814800,0.0000000,0.0000000,354.3518700 
19076
, -553.4882200,-3543.0024400,114.3630500,0.0000000,0.0000000,355.4047200 
19056
, -554.3201900,-3543.0681200,115.1618600,0.0000000,0.0000000,0.0000000 
19056
, -552.7874100,-3543.1289100,115.1618600,0.0000000,0.0000000,0.0000000 
19056
, -553.5070800,-3542.4138200,115.1618600,0.0000000,0.0000000,0.0000000 
19056
, -553.6635100,-3544.0400400,115.1618600,0.0000000,0.0000000,0.0000000 
19057
, -547.8059100,-3525.1001000,114.9543900,0.0000000,0.0000000,354.8526900 
19057
, -547.9779700,-3526.8010300,114.9543900,0.0000000,0.0000000,354.8526900 
19057
, -548.0853300,-3528.8283700,114.9543900,0.0000000,0.0000000,354.8526900 
19057
, -548.2321200,-3530.5564000,114.9543900,0.0000000,0.0000000,354.8526900 
19057
, -548.3511400,-3532.6452600,114.9543900,0.0000000,0.0000000,354.8526900 
19057
, -548.7917500,-3535.2629400,114.9543900,0.0000000,0.0000000,354.8526900 
19057
, -549.2036700,-3538.0363800,114.9543900,0.0000000,0.0000000,354.8526900 
19057
, -549.6940900,-3541.3144500,114.9543900,0.0000000,0.0000000,354.8526900 
19058
, -554.7719100,-3523.9440900,114.9585000,0.0000000,0.0000000,352.1909500 
19058
, -555.0019500,-3526.5310100,114.9585000,0.0000000,0.0000000,352.1909500 
19058
, -555.3303200,-3529.0896000,114.9585000,0.0000000,0.0000000,352.1909500 
19058
, -555.5799000,-3531.5578600,114.9585000,0.0000000,0.0000000,352.1909500 
19058
, -555.7878400,-3534.0087900,114.9585000,0.0000000,0.0000000,352.1909500 
19058
, -555.9921300,-3536.4816900,114.9585000,0.0000000,0.0000000,352.1909500 
19058
, -556.2909500,-3539.0859400,114.9585000,0.0000000,0.0000000,352.1909500 
896
, -339.7589400,-3186.5639600,80.8500100,0.0000000,0.0000000,0.0000000 
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)