SA-MP Forums Archive
Warning loose indentation // NEED RETURN TOO - 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: Warning loose indentation // NEED RETURN TOO (/showthread.php?tid=532470)



Warning loose indentation // NEED RETURN TOO - Gogorakis - 18.08.2014

How to fix that?



BTW, I am newbie. I suck a little bit on scripting;p


Re: Warning loose indentation // NEED RETURN TOO - NewerthRoleplay - 18.08.2014

You need to indent your code properly.. This is a pretty good topic on the matter.


Re: Warning loose indentation // NEED RETURN TOO - Gogorakis - 18.08.2014

Well I am kinda confused..;/
Could you do that for me?


Re: Warning loose indentation // NEED RETURN TOO - humphrey - 18.08.2014

Post the code here, or at http://www.pastebin.com


Re: Warning loose indentation // NEED RETURN TOO - Gogorakis - 18.08.2014

Here:

http://pastebin.com/59C3EKw7


Re: Warning loose indentation // NEED RETURN TOO - LivingLikeYouDo - 18.08.2014

pawn Код:
CMD:supmobil(playerid, params[])
{
if(HasSupmobil[playerid] == 1)
{
for(new v=0; v<MAX_VEHICLES; v++)
{
if(v == SupMobil[playerid])
{
SupMobilLocked[v] = 0;
}
DestroyVehicle(SupMobil[playerid]);
HasSupmobil[playerid] = 0;
DestroyDynamic3DTextLabel(Text3D:SupMobilText[playerid]);
DestroyObject(SupMobilLicht[playerid]);
DestroyObject(SupMobilLicht2[playerid]);
SendClientMessage(playerid,COLOR_RED,"Supmobil destroyed!");
return 1;
}
if(pInfo[playerid][Adminlevel] >= 1)
{
ShowPlayerDialog(playerid, DIALOG_SUPMOBIL, DIALOG_STYLE_LIST, "Supmobil","Classic Supmobil\nComet Mobil\nQuad Mobil", "Spawnen", "Abbruch");
}
else
{
SendClientMessage(playerid,0xFF0000FF,"{FF0000}[SERVER]{BABABA}You're not authorized to use that command.");
return 1;
}
}
}
return 1;
}
}



Re: Warning loose indentation // NEED RETURN TOO - Gogorakis - 18.08.2014

Still nothing..


Re: Warning loose indentation // NEED RETURN TOO - Threshold - 18.08.2014

pawn Код:
CMD:supmobil(playerid, params[])
{
    if(!pInfo[playerid][Adminlevel]) return SendClientMessage(playerid, 0xFF0000FF, "[SERVER] {BABABA}You're not authorized to use that command.");
    if(HasSupmobil[playerid] == 1)
    {
        for(new v = 0; v < MAX_VEHICLES; v++)
        {
            if(v == SupMobil[playerid]) SupMobilLocked[v] = 0;
        }
        DestroyVehicle(SupMobil[playerid]);
        HasSupmobil[playerid] = 0;
        DestroyDynamic3DTextLabel(Text3D:SupMobilText[playerid]);
        DestroyObject(SupMobilLicht[playerid]);
        DestroyObject(SupMobilLicht2[playerid]);
        SendClientMessage(playerid, COLOR_RED, "Supmobil destroyed!");
        return 1;
    }
    ShowPlayerDialog(playerid, DIALOG_SUPMOBIL, DIALOG_STYLE_LIST, "Supmobil", "Classic Supmobil\nComet Mobil\nQuad Mobil", "Spawnen", "Abbruch");
    return 1;
}
Assumptions were made.


Re: Warning loose indentation // NEED RETURN TOO - Stinged - 18.08.2014

Quote:
Originally Posted by LivingLikeYouDo
Посмотреть сообщение
[code that has fucked up indentation even more than the main one]
What's this lol...

You had like 3 extra curly brackets and return 0 instead of 1.
pawn Код:
CMD:supmobil(playerid, params[])
{
    if(HasSupmobil[playerid] == 1)
    {
        for(new v=0; v<MAX_VEHICLES; v++)
        {
            if(v == SupMobil[playerid])
            {
                SupMobilLocked[v] = 0;
            }
            DestroyVehicle(SupMobil[playerid]);
            HasSupmobil[playerid] = 0;
            DestroyDynamic3DTextLabel(Text3D:SupMobilText[playerid]);
            DestroyObject(SupMobilLicht[playerid]);
            DestroyObject(SupMobilLicht2[playerid]);
            SendClientMessage(playerid,COLOR_RED,"Supmobil destroyed!");
            break; // You had return 1 here
        }
        if(pInfo[playerid][Adminlevel] >= 1)
        {
            ShowPlayerDialog(playerid, DIALOG_SUPMOBIL, DIALOG_STYLE_LIST, "Supmobil","Classic Supmobil\nComet Mobil\nQuad Mobil", "Spawnen", "Abbruch");
        }
        else
        {
            SendClientMessage(playerid,0xFF0000FF,"{FF0000}[SERVER]{BABABA}You're not authorized to use that command.");
            return 1;
        }
    }      
    return 1;
}



Re: Warning loose indentation // NEED RETURN TOO - Gogorakis - 18.08.2014

Ahh! Thanks guys
#FIXED