SA-MP Forums Archive
error - 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: error (/showthread.php?tid=454487)



error - aboa - 29.07.2013

I got this error
pawn Код:
C:\Users\gtfytgfy\Desktop\A-RP\gamemodes\A-RP.pwn(27291) : warning 219: local variable "object" shadows a variable at a preceding level
pawn Код:
if(!strcmp(params, "object", true, 5))
    {
        new object;
        if(sscanf(params, "s[128]ii", params, idx, object)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /gedit object [gateid] [objectid]");
        if(!GateInfo[idx][gModel]) return SendClientMessage(playerid, COLOR_GREY, "Invalid gate id.");
        GateInfo[idx][gModel] = object;
        DestroyDynamicObject(GateInfo[idx][gGate]);
        GateInfo[idx][gGate] = CreateDynamicObject(GateInfo[idx][gModel], GateInfo[idx][gCX], GateInfo[idx][gCY], GateInfo[idx][gCZ], GateInfo[idx][gCRX], GateInfo[idx][gCRY], GateInfo[idx][gCRZ]);
        format(string, sizeof(string), " You have set gate ID %d's object ID to %d.", idx, object);
        SendClientMessage(playerid, COLOR_WHITE, string);
    }



Re: error - dEcooR - 29.07.2013

you should change name some of this two..


Код:
if(!strcmp(params, "object", true, 5))
{
      new object;

if(!strcmp(params, "editobject", true, 5))
{
      new objectid;



Re: error - Scottas - 29.07.2013

That's beacause you've already declared variable 'object' (in global scope probably), you need to change this ones name to something else:
pawn Код:
if(!strcmp(params, "object", true, 5))
    {
        new _gates;
        if(sscanf(params, "s[128]ii", params, idx, _gates)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /gedit object [gateid] [objectid]");
        if(!GateInfo[idx][gModel]) return SendClientMessage(playerid, COLOR_GREY, "Invalid gate id.");
        GateInfo[idx][gModel] = _gates;
        DestroyDynamicObject(GateInfo[idx][gGate]);
        GateInfo[idx][gGate] = CreateDynamicObject(GateInfo[idx][gModel], GateInfo[idx][gCX], GateInfo[idx][gCY], GateInfo[idx][gCZ], GateInfo[idx][gCRX], GateInfo[idx][gCRY], GateInfo[idx][gCRZ]);
        format(string, sizeof(string), " You have set gate ID %d's object ID to %d.", idx, _gates);
        SendClientMessage(playerid, COLOR_WHITE, string);
    }