SA-MP Forums Archive
WTH? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: WTH? (/showthread.php?tid=167797)



WTH? - Nonameman - 13.08.2010

Hey Guys!

I have a warning in my script:
Код:
(69) : warning 217: loose indentation
Here is the the function:
pawn Код:
case 17:
            {
                 new
                    vehiclemodel = random(212)+400,
                    Float:pPos[4],
                    vId;
                while(!IsValidVehicleID(vehiclemodel)) vehiclemodel = random(212)+400;//Line 69
                if(IsPlayerInAnyVehicle(playerid)) DestroyVehicle(GetPlayerVehicleID(playerid));
                GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
                GetPlayerFacingAngle(playerid, pPos[3]);
                vId = CreateVehicle(vehiclemodel, pPos[0], pPos[1], pPos[2], pPos[3], random(127), random(127), 60*1000);
                PutPlayerInVehicle(playerid, vId, 0);
            }
I cannot see the problem with it, no indentation loose, and when I make the line 69 to comment, the compiler still writes this warning..


Re: WTH? - Luis- - 13.08.2010

pawn Код:
case 17:
            {
                new
                vehiclemodel = random(212)+400,
                Float:pPos[4],
                vId;
                while(!IsValidVehicleID(vehiclemodel)) vehiclemodel = random(212)+400;//Line 69
                if(IsPlayerInAnyVehicle(playerid)) DestroyVehicle(GetPlayerVehicleID(playerid));
                GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
                GetPlayerFacingAngle(playerid, pPos[3]);
                vId = CreateVehicle(vehiclemodel, pPos[0], pPos[1], pPos[2], pPos[3], random(127), random(127), 60*1000);
                PutPlayerInVehicle(playerid, vId, 0);
            }
Try that

pawn Код:
case 17:
            {
                new vehiclemodel = random(212)+400, Float:pPos[4], vId;
                while(!IsValidVehicleID(vehiclemodel)) vehiclemodel = random(212)+400;//Line 69
                if(IsPlayerInAnyVehicle(playerid)) DestroyVehicle(GetPlayerVehicleID(playerid));
                GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
                GetPlayerFacingAngle(playerid, pPos[3]);
                vId = CreateVehicle(vehiclemodel, pPos[0], pPos[1], pPos[2], pPos[3], random(127), random(127), 60*1000);
                PutPlayerInVehicle(playerid, vId, 0);
            }
Or that


Re: WTH? - Nonameman - 13.08.2010

Quote:
Originally Posted by Luis the Lobster
Посмотреть сообщение
pawn Код:
case 17:
            {
                new
                vehiclemodel = random(212)+400,
                Float:pPos[4],
                vId;
                while(!IsValidVehicleID(vehiclemodel)) vehiclemodel = random(212)+400;//Line 69
                if(IsPlayerInAnyVehicle(playerid)) DestroyVehicle(GetPlayerVehicleID(playerid));
                GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
                GetPlayerFacingAngle(playerid, pPos[3]);
                vId = CreateVehicle(vehiclemodel, pPos[0], pPos[1], pPos[2], pPos[3], random(127), random(127), 60*1000);
                PutPlayerInVehicle(playerid, vId, 0);
            }
Try that

pawn Код:
case 17:
            {
                new vehiclemodel = random(212)+400, Float:pPos[4], vId;
                while(!IsValidVehicleID(vehiclemodel)) vehiclemodel = random(212)+400;//Line 69
                if(IsPlayerInAnyVehicle(playerid)) DestroyVehicle(GetPlayerVehicleID(playerid));
                GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
                GetPlayerFacingAngle(playerid, pPos[3]);
                vId = CreateVehicle(vehiclemodel, pPos[0], pPos[1], pPos[2], pPos[3], random(127), random(127), 60*1000);
                PutPlayerInVehicle(playerid, vId, 0);
            }
Or that
Thanks, the problem was that there was a space before "new".


Re: WTH? - ikey07 - 13.08.2010

pawn Код:
case 17:
{
    new vehiclemodel = random(212)+400;
    new Float:pPos[4];
    new vId;
    while(!IsValidVehicleID(vehiclemodel))
    {
        vehiclemodel = random(212)+400;
    }
    if(IsPlayerInAnyVehicle(playerid))
    {
        DestroyVehicle(GetPlayerVehicleID(playerid));
    }
    GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
    GetPlayerFacingAngle(playerid, pPos[3]);
    vId = CreateVehicle(vehiclemodel, pPos[0], pPos[1], pPos[2], pPos[3], random(127), random(127), 60*1000);
    PutPlayerInVehicle(playerid, vId, 0);
}
Why peoples like mess in their scripts, this one looks more clean


Re: WTH? - Nonameman - 13.08.2010

Quote:
Originally Posted by ikey07
Посмотреть сообщение
pawn Код:
case 17:
{
    new vehiclemodel = random(212)+400;
    new Float:pPos[4];
    new vId;
    while(!IsValidVehicleID(vehiclemodel))
    {
        vehiclemodel = random(212)+400;
    }
    if(IsPlayerInAnyVehicle(playerid))
    {
        DestroyVehicle(GetPlayerVehicleID(playerid));
    }
    GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
    GetPlayerFacingAngle(playerid, pPos[3]);
    vId = CreateVehicle(vehiclemodel, pPos[0], pPos[1], pPos[2], pPos[3], random(127), random(127), 60*1000);
    PutPlayerInVehicle(playerid, vId, 0);
}
Why peoples like mess in their scripts, this one looks more clean
Cuz it's shorter, and u just have to write "new" 1 time


Re: WTH? - ikey07 - 13.08.2010

shorter and easly way to not understand in the end what you have writed.

all these Brecets {}{} is not made only to make script longer.

sry, off-topic


Re: WTH? - Nonameman - 13.08.2010

Quote:
Originally Posted by ikey07
Посмотреть сообщение
shorter and easly way to not understand in the end what you have writed.

all these Brecets {}{} is not made only to make script longer.

sry, off-topic
Yea, ur right, I use brecets too, but for 2 or more lines


Re: WTH? - Nonameman - 14.08.2010

Quote:
Originally Posted by ******
Посмотреть сообщение
You should still indent, even if you don't use braces:



Anyway, unless your functions are badly named, that code won't work.
Why do You think that this won't work?


Re: WTH? - DiddyBop - 14.08.2010

Quote:
Originally Posted by Nonameman
Посмотреть сообщение
Why do You think that this won't work?
He's ******. Just listen to him. hes like.. epic


Re: WTH? - Mike_Peterson - 14.08.2010

WTH! i got a warning in my script! loosing identitation...
l0l is there an easier error/warning then this one?
i dont think so :P