Is this code correct ?
#1

Hi.

I'm working on my accessories system, and for saving, I use OnPlayerEditAttachedObject.

But I'd like to know if my code is correct

PHP код:

new bandana1[] = {18891188921889518896188971889818899};
for(
asizeof(bandana1); a++)
        {
            if(
== modelid)
            {
                
PlayerInfo[playerid][pBandana1o][0] = fOffsetX;
                
PlayerInfo[playerid][pBandana1o][1] = fOffsetY;
                
PlayerInfo[playerid][pBandana1o][2] = fOffsetZ;
                
PlayerInfo[playerid][pBandana1o][3] = fRotX;
                
PlayerInfo[playerid][pBandana1o][4] = fRotY;
                
PlayerInfo[playerid][pBandana1o][5] = fRotZ;
                
PlayerInfo[playerid][pBandana1o][6] = fScaleX;
                
PlayerInfo[playerid][pBandana1o][7] = fScaleY;
                
PlayerInfo[playerid][pBandana1o][8] = fScaleZ;
            }
        } 
I mean, does the for loop will browse each value of the bandana1 array ?
Will "a" get the values 18891, 18892, 18895, 18896, 18897, 18898, 18899 in this order ?

Thanks in advance.
Reply
#2

One way to find out is to print the values, which you can see in the console and logs:

Код:
new debug[50];
new bandana1[] = {18891, 18892, 18895, 18896, 18897, 18898, 18899}; 
for(a; a < sizeof(bandana1); a++) 
        { 
            if(a == modelid) 
            {
                format(debug, sizeof(debug), "---- Player Bandana ID: %d ----", pBandana1o);
                print(debug); 
                PlayerInfo[playerid][pBandana1o][0] = fOffsetX; 
                PlayerInfo[playerid][pBandana1o][1] = fOffsetY; 
                PlayerInfo[playerid][pBandana1o][2] = fOffsetZ; 
                format(debug, sizeof(debug), "Offset: x:%f y:%f z:%f", fOffsetX, fOffsetY, fOffsetZ);
                print(debug);

                PlayerInfo[playerid][pBandana1o][3] = fRotX; 
                PlayerInfo[playerid][pBandana1o][4] = fRotY; 
                PlayerInfo[playerid][pBandana1o][5] = fRotZ; 
                format(debug, sizeof(debug), "Rotation: x:%f y:%f z:%f", fRotX, fRotY, fRotZ);
                print(debug);

                PlayerInfo[playerid][pBandana1o][6] = fScaleX; 
                PlayerInfo[playerid][pBandana1o][7] = fScaleY; 
                PlayerInfo[playerid][pBandana1o][8] = fScaleZ; 
                format(debug, sizeof(debug), "Scale: x:%f y:%f z:%f", fScaleX, fScaleY, fScaleZ);
                print(debug);
            } 
        }
Reply
#3

Thanks a lot, I'll try right now.

+rep.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)