Unreachable Code
#1

Ok, I'm sorry if this is horrible. I am trying to make all of these objects transparent.. Now if I take away myobjects 1-8 the normal my object works and makes 1 object transparent....
If I keep them though I get the error code at the very bottom





Код:
#include <a_samp> //Including a_samp, without this nothing related to the tutorial would work.


new
    myObject; //Declaring a variable to store the object ID we're creating, for setting it's textures.
new
    myObject1;
new
    myObject2;
new
    myObject3;
new
    myObject4;
new
    myObject5;
new
    myObject6;
new
    myObject7;
new
    myObject8;


stock HexToInt(string[])
{
    if (string[0] == 0)
    {
        return 0;
    }
    new i;
    new cur = 1;
    new res = 0;
    for (i = strlen(string); i > 0; i--)
    {
        if (string[i-1] < 58)
        {
            res = res + cur * (string[i - 1] - 48);
        }
        else
        {
            res = res + cur * (string[i-1] - 65 + 10);
            cur = cur * 16;
        }
    }
    return res;
}

public OnFilterScriptInit()
{
    //-----323----You can create any object you want, here, I'm gonna use object ID : 4238 as it's good for banners.
    myObject = CreateObject(16775, -651.93, 455.26, 1375.84, 0, 0, 90.1, 123025);
    for(new i; i< 10; i++)
    SetObjectMaterial(myObject, i, 0, "none", "none", HexToInt("0xRRGGBB00"));
    return 1;



    //-----329-------You can create any object you want, here, I'm gonna use object ID : 4238 as it's good for banners.
    myObject1 = CreateObject(16775, -642.26, 467.70, 1375.75, 0, 0, 90.1, 123025);
    for(new i; i< 10; i++)
    SetObjectMaterial(myObject1, i, 0, "none", "none", HexToInt("0xRRGGBB00"));
    return 1;




    //-----332-------You can create any object you want, here, I'm gonna use object ID : 4238 as it's good for banners.
    myObject2 = CreateObject(16775, -630.20, 454.63, 1375.77, 0, 0, -90.40, 123025);
    for(new i; i< 10; i++)
    SetObjectMaterial(myObject2, i, 0, "none", "none", HexToInt("0xRRGGBB00"));
    return 1;




     //-----343-------You can create any object you want, here, I'm gonna use object ID : 4238 as it's good for banners.
    myObject3 = CreateObject(16775, -635.57, 443.78, 1375.70, 0, 0, -135.20, 123025);
    for(new i; i< 10; i++)
    SetObjectMaterial(myObject3, i, 0, "none", "none", HexToInt("0xRRGGBB00"));
    return 1;




     //-----345-------You can create any object you want, here, I'm gonna use object ID : 4238 as it's good for banners.
    myObject4 = CreateObject(16775, -632.92, 464.89, 1379.10, -0.3, 88.70, -46.40, 123025);
    for(new i; i< 10; i++)
    SetObjectMaterial(myObject4, i, 0, "none", "none", HexToInt("0xRRGGBB00"));
    return 1;





    //-----346-------You can create any object you want, here, I'm gonna use object ID : 4238 as it's good for banners.
    myObject5 = CreateObject(16775, -649.99, 466.0, 1379.11, 0.0, -91.4, 56.1, 123025);
    for(new i; i< 10; i++)
    SetObjectMaterial(myObject5, i, 0, "none", "none", HexToInt("0xRRGGBB00"));
    return 1;





    //-----347-------You can create any object you want, here, I'm gonna use object ID : 4238 as it's good for banners.
    myObject6 = CreateObject(16775, -647.71, 443.82, 1375.83, 0.0, 0.0, -49.80, 123025);
    for(new i; i< 10; i++)
    SetObjectMaterial(myObject6, i, 0, "none", "none", HexToInt("0xRRGGBB00"));
    return 1;





    //-----351-------You can create any object you want, here, I'm gonna use object ID : 4238 as it's good for banners.
    myObject7 = CreateObject(16775, -640.12, 431.78, 1370.035, 0.0, 0.0, -87.20, 123025);
    for(new i; i< 10; i++)
    SetObjectMaterial(myObject7, i, 0, "none", "none", HexToInt("0xRRGGBB00"));
    return 1;




    //-----358-------You can create any object you want, here, I'm gonna use object ID : 4238 as it's good for banners.
    myObject8 = CreateObject(16775, -643.04, 431.74, 1369.70, 0.0, 0.0, -88.90, 123025);
    for(new i; i< 10; i++)
    SetObjectMaterial(myObject8, i, 0, "none", "none", HexToInt("0xRRGGBB00"));
    return 1;

}






Код:
.pwn(59) : warning 225: unreachable code
.pwn(68) : warning 225: unreachable code
.pwn(77) : warning 225: unreachable code
.pwn(86) : warning 225: unreachable code
.pwn(96) : warning 225: unreachable code
.pwn(106) : warning 225: unreachable code
.pwn(116) : warning 225: unreachable code
.pwn(125) : warning 225: unreachable code
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


8 Warnings.





I know they are only warning. But it doesnt work in game with these warnings
Reply
#2

remove the return under the line SetObjectMaterial
and what do the for loop ?
Reply
#3

do I need to remove that for each one.. So remove all the return lines?
Reply
#4

remove all..
just keep the last
Reply
#5

OnFilterScriptInit can only be returned once, what you're doing is returning it several times and pretty much ending the function and the script doesn't know what to do after the first return.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)