Offset And Object Loacations Problems [Just Some Error Messages! Please Help!]
#1

Hi I got my Offset function and the script compiles but i still get errors!! heres the code:
pawn Код:
if (strcmp("/saveob", cmdtext, true, 10) == 0)
    {
        new Float:rx, Float:ry, Float:rz;
        new Float:xo, Float:yo, Float:zo;
      GetObjectRot(ob, rx, ry, rz);

      GetObjectOffsetToPlayer(playerid, ob, xo, yo, zo);

    new entry[256];
        format(entry, sizeof(entry), "object offset: %f, %f, %f \n object rotation: %f, %f, %f", xo, yo, zo, rx, ry, rz);
        new File:hFile;
        hFile = fopen("ob.txt", io_write);
        fwrite(hFile, entry);
        fclose(hFile);

        return 1;
    }
    return 0;
}// end of onplayercommandtext
stock GetObjectOffsetToPlayer(playerid, objectid, Float:xoffset, Float:yoffset, Float:zoffset)
{
    new Float:px, Float:py, Float:pz, Float:ox, Float:oy, Float:oz;
    GetObjectPos(objectid, ox, oy, oz);
    GetPlayerPos(playerid, px, py, pz);

    new Float:xoffset = px - ox;
    new Float:yoffset = py - oy;
    new Float:zoffset = pz - oz;
}
Errors Are:
Код:
K:\Games\Projects\sa-mp server\filterscripts\cod4.pwn(31) : warning 219: local variable "xoffset" shadows a variable at a preceding level
K:\Games\Projects\sa-mp server\filterscripts\cod4.pwn(32) : warning 219: local variable "yoffset" shadows a variable at a preceding level
K:\Games\Projects\sa-mp server\filterscripts\cod4.pwn(33) : warning 219: local variable "zoffset" shadows a variable at a preceding level
K:\Games\Projects\sa-mp server\filterscripts\cod4.pwn(33) : warning 204: symbol is assigned a value that is never used: "zoffset"
K:\Games\Projects\sa-mp server\filterscripts\cod4.pwn(32) : warning 204: symbol is assigned a value that is never used: "yoffset"
K:\Games\Projects\sa-mp server\filterscripts\cod4.pwn(31) : warning 204: symbol is assigned a value that is never used: "xoffset"
K:\Games\Projects\sa-mp server\filterscripts\cod4.pwn(25) : warning 203: symbol is never used: "zoffset"
K:\Games\Projects\sa-mp server\filterscripts\cod4.pwn(25) : warning 203: symbol is never used: "yoffset"
K:\Games\Projects\sa-mp server\filterscripts\cod4.pwn(25) : warning 203: symbol is never used: "xoffset"
Thanks For Any Help!! =]
Reply
#2

[QUOTE='[HLF]Southclaw;412089']Hi I got my Offset function and the script compiles but i still get errors!! heres the code:
pawn Код:
if (strcmp("/saveob", cmdtext, true, 10) == 0)
    {
        new Float:rx, Float:ry, Float:rz;
        new Float:xo, Float:yo, Float:zo;
      GetObjectRot(ob, rx, ry, rz);

      GetObjectOffsetToPlayer(playerid, ob, xo, yo, zo);

    new entry[256];
        format(entry, sizeof(entry), "object offset: %f, %f, %f \n object rotation: %f, %f, %f", xo, yo, zo, rx, ry, rz);
        new File:hFile;
        hFile = fopen("ob.txt", io_write);
        fwrite(hFile, entry);
        fclose(hFile);

        return 1;
    }
    return 0;
}// end of onplayercommandtext
stock GetObjectOffsetToPlayer(playerid, objectid, Float:xoffset, Float:yoffset, Float:zoffset)
{
    new Float:px, Float:py, Float:pz, Float:ox, Float:oy, Float:oz;
    GetObjectPos(objectid, ox, oy, oz);
    GetPlayerPos(playerid, px, py, pz);

    xoffset = px - ox;
    yoffset = py - oy;
    zoffset = pz - oz;
}


i think you have to delete ( new Float: ) at the last 3. like up here
Reply
#3

hmmm You have 2 or more of the same variable. In the GetObjectOffsetToPlayer function, you have xoffset, yoffset and zoffset, and you also have it at the start of your script. Try renaming 1 of them xoffset2, yoffset2, zoffset2
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)