[HELP] Loading event cp
#1

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");
Reply
#2

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]);
    }
}
Reply
#3

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
Reply
#4

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

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
Reply
#6

Check your loop in your writing code if you call all cps
Reply
#7

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)