SA-MP Forums Archive
[HELP] Loading event cp - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [HELP] Loading event cp (/showthread.php?tid=565502)



[HELP] Loading event cp - Luca12 - 28.02.2015

Hello so I load event cp with command and it set a cp to farm somewhere in LS but cordinates for x y z are fine written in ini file and of course I load those cordinates as float

this is the code for cps from loading command
pawn Код:
inline loadracedata(string:name[],string:value[])
            {
                new scps[128];
                INI_Int("raceNumberCP",UtrkaInfo[raceNumberCP]);
                for(new cpsrc = 0; cpsrc < UtrkaInfo[raceNumberCP]; cpsrc++)
                {
                    format(scps,sizeof(scps),"CPPosX%d",cpsrc);
                    INI_Float(scps,CPInfo[cpsrc][cpX]);
                    format(scps,sizeof(scps),"CPPosY%d",cpsrc);
                    INI_Float(scps,CPInfo[cpsrc][cpY]);
                    format(scps,sizeof(scps),"CPPosZ%d",cpsrc);
                    INI_Float(scps,CPInfo[cpsrc][cpZ]);[cpZ]);
                }
            }
new file[128]; format(file,128,"races/%s.ini",racename);
INI_ParseFile(file,"loadracedata");



AW: [HELP] Loading event cp - Nero_3D - 28.02.2015

If you use an inline function you need to call it as an inline
pawn Код:
new file[128];
format(file, sizeof file, "races/%s.ini", racename);
INI_ParseFile(file, using inline loadracedata);
Way to much format in your code :/
pawn Код:
inline loadracedata(string:name[],string:value[])
{
    INI_Int("raceNumberCP", UtrkaInfo[raceNumberCP]);

    new
        scps[32] = "CPPos_",
        cpsrc = UtrkaInfo[raceNumberCP]
    ;
    while(cpsrc--)
    {
        valstr(scpc[6], cpsrc, false);

        scpc[5] = 'X';
        INI_Float(scps, CPInfo[cpsrc][cpX]);

        scpc[5] = 'Y';
        INI_Float(scps, CPInfo[cpsrc][cpY]);

        scpc[5] = 'Z';
        INI_Float(scps, CPInfo[cpsrc][cpZ]);
    }
}



Re: [HELP] Loading event cp - Luca12 - 28.02.2015

okay thanks know I have one more problem I create race with name file LVRT okay all data is fine writted inside and I create second file TGR and the cordinates from file LVRT is somehow written in TGR why is that happening* Thanks


AW: [HELP] Loading event cp - Nero_3D - 28.02.2015

How should I know ? , probably some simply mistake in your code


Re: [HELP] Loading event cp - Luca12 - 28.02.2015

Okay I fix it thanks and this is the last question I have created 10 cp but from those 10 cp only is written 9 in ini file. Thanks


AW: [HELP] Loading event cp - Nero_3D - 28.02.2015

Check your loop in your writing code if you call all cps


Re: [HELP] Loading event cp - Luca12 - 28.02.2015

I check wright know and know I write fine few cps with all data and I load that file data and it sets first event cp on the farm I did like you post here . Thanks