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



Help here - N0FeaR - 06.05.2012

Код:
C:\Users\Robins\Desktop\Rebound Roleplay server\pawno\include\/CRP/Publics/AttachObjectCorrectly.pwn(2) : warning 219: local variable "object" shadows a variable at a preceding level
code
pawn Код:
forward AttachObjectCorrectly(playerid, object);
public AttachObjectCorrectly(playerid, object)
{
    if(object == 1550)
    {
        SetPlayerAttachedObject(playerid, 3,1550,3,0.1,0.1,-0.1,0.0,270.0,0.0);
    }
    else if(object == 373)
    {
        SetPlayerAttachedObject(playerid, 3,373,1,0.3,-0.0,-0.1,70.0,25.0,35.0);
    }
    else if(object == 2992)
    {
        SetPlayerAttachedObject(playerid, 3,2992,2,0.2,0.0,0.0,0.0,90.0,0.0);
    }
    else if(object == 3265)
    {
        SetPlayerAttachedObject(playerid, 3,3265,1,-0.5,0.0,0.0,0.0,90.0,180.0);
    }
    else if(object == 1575)
    {
        SetPlayerAttachedObject(playerid, 3,1575,6,0.0,0.0,0.0,0.0,90.0,0.0);
    }
    else if(object == 1210)
    {
        SetPlayerAttachedObject(playerid, 3,1210,5,0.3,0.1,0.0,0.0,270.0,0.0);
    }
    else if(object == 3026)
    {
        SetPlayerAttachedObject(playerid, 3,3026,1,-0.1,-0.0,0.0,0.0,0.0,0.0);
    }
    else if(object == 2054)
    {
        SetPlayerAttachedObject(playerid, 3,2054,2,0.1,0.0,-0.0,0.0,90.0,180.0);
    }
    else if(object == 2053)
    {
        SetPlayerAttachedObject(playerid, 3,2053,2,0.1,0.0,0.0,0.0,90.0,0.0);
    }
    else if(object == 2052)
    {
        SetPlayerAttachedObject(playerid, 3,2052,2,0.1,0.0,0.0,0.0,90.0,0.0);
    }
    else return SendClientMessage(playerid, COLOR_GREY,"[DEBUG]: Unkown Object, Contact a developer!");
    return 1;
}



Re: Help here - ReneG - 06.05.2012

Ermmm, you have "object" define before this function is called.


Re: Help here - 2KY - 06.05.2012

You have

pawn Код:
new object;
Somewhere in your script, you can either change your script around, or modify the function you're creating. I also recommend using a switch statement rather than a bunch of if statements.

pawn Код:
switch ( object )
{
case 1550:
{
}
// ect.
}