Tag mismatch
#1

Hey,I have tried to compile my script and ran into this warning:
Код:
warning 213: tag mismatch
And this is the code:
pawn Код:
gInfo[gateid][dif] = floatsub(gInfo[gateid][newRZ],gInfo[gateid][oldRZ]);
dif,newRZ,and oldRZ are all enumerated as floats,using the 'Float:' tag of course.
And I used it like this:

pawn Код:
RotateObject(gInfo[gid][gObj],gInfo[gid][oldRX],gInfo[gid][oldRY],gInfo[gid][oldRZ],gInfo[gid][dif],gInfo[gid][rSpeed]);
I would really appreciate any help of you,thanks.
Reply
#2

Well, I've been looking at this code for about 2-3 minutes trying to figure out why it's giving you a tag mismatch, and I cannot see any reason why. The Wiki documentation says that floatsub returns a float, therefore I don't see why you're getting a tag mismatch on that line.

Are you sure that is the right line? That the error is pointing to?

Also, just for sanity sakes, can I see the code where you initialize the gInfo[gateid][dif] variable?
Reply
#3

Yes,the mismatch warning shows up in line 88,and that's the exact copy of line 88. (What I've showed you before)
And yes,there you go:
pawn Код:
enum oInfo
{
    bool:Exist,
    ModelID,
    gObj,
    Float:oldX, //Created X
    Float:oldY, //Created Y
    Float:oldZ, //Created Z
    Float:newX, //X Pos after moving
    Float:newY, //Y Pos after moving
    Float:newZ, //Z Pos after moving
    Float:oldRX, // Created rotation X
    Float:oldRY, //Created rotation Y
    Float:oldRZ, //Created rotation Z
    Float:newRX, //Rotation X after moving
    Float:newRY, //Rotation Y after moving
    Float:newRZ, //Rotation Z after moving
    Radius,//Distance/radius to open automatically
    mSpeed, //Movement speed
    rSpeed, //Rotation speed
    Float:dif // Substracing later
}

new gInfo[MAX_SERVER_GATES][oInfo];

stock AddMoveableObject(modelid,Float:CX,Float:CY,Float:CZ,Float:OX,Float:OY,Float:OZ,Float:CrX,Float:CrY,Float:CrZ,Float:OrX,Float:OrY,Float:OrZ,Radius2,MovingSpeed,RotatingSpeed)
{
    gCount++;
    gateid = gCount;
    if(gTimer == -1) gTimer = SetTimer("WhatEver",10,true);
    gInfo[gateid][Exist] = true;
    gInfo[gateid][ModelID] = modelid;
    gInfo[gateid][oldX] = CX;
    gInfo[gateid][oldY] = CY;
    gInfo[gateid][oldZ] = CZ;
    gInfo[gateid][newX] = OX;
    gInfo[gateid][newY] = OY;
    gInfo[gateid][newZ] = OZ;
    gInfo[gateid][oldRX] = CrX;
    gInfo[gateid][oldRY] = CrY;
    gInfo[gateid][oldRZ] = CrZ;
    gInfo[gateid][newRX] = OrX;
    gInfo[gateid][newRY] = OrY;
    gInfo[gateid][newRZ] = OrZ;
    gInfo[gateid][Radius] = Radius2;
    gInfo[gateid][mSpeed] = MovingSpeed;
    gInfo[gateid][rSpeed] = RotatingSpeed;
    gInfo[gateid][gObj] = CreateObject(modelid,CX,CY,CZ,CrX,CrY,CrZ);
    gInfo[gateid][dif] = floatsub(gInfo[gateid][newRZ],gInfo[gateid][oldRZ]);
    return true;
}
Reply
#4

Well I'm stumped, I just compiled this fine.

pawn Код:
#include <a_samp>

enum oInfo
{
    bool:Exist,
    ModelID,
    gObj,
    Float:oldX, //Created X
    Float:oldY, //Created Y
    Float:oldZ, //Created Z
    Float:newX, //X Pos after moving
    Float:newY, //Y Pos after moving
    Float:newZ, //Z Pos after moving
    Float:oldRX, // Created rotation X
    Float:oldRY, //Created rotation Y
    Float:oldRZ, //Created rotation Z
    Float:newRX, //Rotation X after moving
    Float:newRY, //Rotation Y after moving
    Float:newRZ, //Rotation Z after moving
    Radius,//Distance/radius to open automatically
    mSpeed, //Movement speed
    rSpeed, //Rotation speed
    Float:dif // Substracing later
}

new gInfo[10][oInfo];

main()
{
    new gateid = 1;
    gInfo[gateid][dif] = floatsub(gInfo[gateid][newRZ],gInfo[gateid][oldRZ]);
}
Which is basically where you were getting the warning.

Edit: If you want to send me your script, I'll compile it and maybe be able to help out more when I see the warning myself, but with what you've given me I honestly don't see a problem with the code.
Reply
#5

Actually the code is in the RotateObject line,but I am sending you the code right now.
Reply
#6

Quote:
Originally Posted by [XST]O_x
Посмотреть сообщение
Actually the code is in the RotateObject line,but I am sending you the code right now.
Ah, I thought you meant that it was in the floatsub line, that explains a lot.

Just post the RotateObject function then and then we can figure it out
Reply
#7

No no,you got me wrong,the RotateObject function is absolutely fine,it's in one of the includes I use,the problem is in the specific combination of RotateObject and gInfo[gateid][dif],for example if I'd take the number 3 and position it instead of gInfo[gateid][dif],everything would be fine,but I really need the subtracted result for the rotation to be smooth.
Reply
#8

Quote:
Originally Posted by [XST]O_x
Посмотреть сообщение
No no,you got me wrong,the RotateObject function is absolutely fine,it's in one of the includes I use,the problem is in the specific combination of RotateObject and gInfo[gateid][dif],for example if I'd take the number 3 and position it instead of gInfo[gateid][dif],everything would be fine,but I really need the subtracted result for the rotation to be smooth.
Well then the problem is that RotateObject only accepts integers, not floats in that argument. So the fix is quite simple

pawn Код:
RotateObject(gInfo[gid][gObj],gInfo[gid][oldRX],gInfo[gid][oldRY],gInfo[gid][oldRZ],floatround(gInfo[gid][dif]),gInfo[gid][rSpeed]);
Or else store it as an integer in the first place using the same method.
Reply
#9

Wow,you rox,it works fine now,thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)