loose indentation. appreciate any help please
#1

hello guys made my first proper command lol i know its pathetic gota start somewhere
it seems to be ok sort of.. but got this indentation error where the else then starts

C:\Users\Jess\Desktop\Pads GM\gamemodes\NBRP.pwn(10075) : warning 217: loose indentation
C:\Users\Jess\Desktop\Pads GM\gamemodes\NBRP.pwn(1007 : warning 217: loose indentation
C:\Users\Jess\Desktop\Pads GM\gamemodes\NBRP.pwn(10082) : error 010: invalid function or declaration // its return0
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.

heres the command

CMD:0penlocker(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid,1.0,403.8266,-2088.7598,7.8359) || IsPlayerInRangeOfPoint(playerid,1.0,398.7553,-2088.7490,7.8359))
{
if(PlayerInfo[playerid][pDonator] >= 1)
{
GivePlayerValidAdminWeapon(playerid, 27, 99999);
GivePlayerValidAdminWeapon(playerid, 29, 99999);
GivePlayerValidAdminWeapon(playerid, 31, 99999);
}
else return SendClientMessage(playerid, COLOR_GREY, "You are not near to the locker");//error here 10075
}
else return SendClientMessage(playerid,COLOR_GREY,"You are not a VIP");
{//Fishplace at the bigwheel
return 1;
}
}
return 0;
}

http://pastebin.com/KnuAv1pA
Reply
#2

http://pastebin.com/wA6EgrEz

you dont need return 0 thats why it was throwing out the error
Reply
#3

thanks for the quick reply getting this one now

C:\Users\Jess\Desktop\Pads GM\gamemodes\NBRP.pwn(10075) : warning 217: loose indentation
C:\Users\Jess\Desktop\Pads GM\gamemodes\NBRP.pwn(10078 ) : warning 217: loose indentation
C:\Users\Jess\Desktop\Pads GM\gamemodes\NBRP.pwn(10080) : error 054: unmatched closing brace ("}")
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.





this is what i got.. 10075 is the first ((else return)) 10080 is the finish }


http://pastebin.com/jPS1ySxb
Reply
#4

pawn Код:
CMD:openlocker(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid,3.0,278.4005,-175.9992,999.6060))
    {
        if(PlayerInfo[playerid][pDonator] >= 3)
        {
          GivePlayerValidAdminWeapon(playerid, 27, 99999);
          GivePlayerValidAdminWeapon(playerid, 29, 99999);
          GivePlayerValidAdminWeapon(playerid, 31, 99999);
        }
        else return SendClientMessage(playerid, COLOR_GREY, "You are not near the locker");
     }else return SendClientMessage(playerid,COLOR_GREY,"You are not a VIP");
}
Reply
#5

thanks battlezone but nope that one didnt work buddy thanks tho it did help abit, but i need to return 1 and thats the last loose indentation
http://pastebin.com/jtmHmkYC
Reply
#6

pawn Код:
CMD:openlocker(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid,3.0,278.4005,-175.9992,999.6060))
    {
        if(PlayerInfo[playerid][pDonator] >= 3)
        {
          GivePlayerValidAdminWeapon(playerid, 27, 99999);
          GivePlayerValidAdminWeapon(playerid, 29, 99999);
          GivePlayerValidAdminWeapon(playerid, 31, 99999);
        }
        else return SendClientMessage(playerid, COLOR_GREY, "You are not near the locker");
    } else return SendClientMessage(playerid, COLOR_GREY, "You Are Not Vip.");
    return 1;
}
there we go got it cheers fellas +rep'd both of you for the help
Reply
#7

Better use the command like this:
pawn Код:
CMD:openlocker(playerid, params[])
{
    if(!IsPlayerInRangeOfPoint(playerid,3.0,278.4005,-175.9992,999.6060)) return SendClientMessage(playerid, COLOR_GREY, "You are not near the locker");
    if(PlayerInfo[playerid][pDonator] < 3) return SendClientMessage(playerid,COLOR_GREY,"You are not a VIP");
    GivePlayerValidAdminWeapon(playerid, 27, 99999);
    GivePlayerValidAdminWeapon(playerid, 29, 99999);
    GivePlayerValidAdminWeapon(playerid, 31, 99999);
    return 1;
}
Reply
#8

Quote:
Originally Posted by Juvanii
Посмотреть сообщение
Better use the command like this:
pawn Код:
CMD:openlocker(playerid, params[])
{
    if(!IsPlayerInRangeOfPoint(playerid,3.0,278.4005,-175.9992,999.6060)) return SendClientMessage(playerid, COLOR_GREY, "You are not near the locker");
    if(PlayerInfo[playerid][pDonator] < 3) return SendClientMessage(playerid,COLOR_GREY,"You are not a VIP");
    GivePlayerValidAdminWeapon(playerid, 27, 99999);
    GivePlayerValidAdminWeapon(playerid, 29, 99999);
    GivePlayerValidAdminWeapon(playerid, 31, 99999);
    return 1;
}
whys that bud does it execute better or something? mine compiled with no problems with the one i had before looks messy tho lol Edit:would the client messages be correct as in, will he/she recive the right message if hes not the pdonator rank or will it just say your not at the locker?
Reply
#9

It will send the message first if you put it first.

This will send the donator message first, while Juvanii's sends the locker one first:
pawn Код:
CMD:openlocker(playerid, params[])
{
    if(PlayerInfo[playerid][pDonator] < 3) return SendClientMessage(playerid,COLOR_GREY,"You are not a VIP");
    if(!IsPlayerInRangeOfPoint(playerid,3.0,278.4005,-175.9992,999.6060)) return SendClientMessage(playerid, COLOR_GREY, "You are not near the locker");
    GivePlayerValidAdminWeapon(playerid, 27, 99999);
    GivePlayerValidAdminWeapon(playerid, 29, 99999);
    GivePlayerValidAdminWeapon(playerid, 31, 99999);
    return 1;
}
I doubt it increases performance at all but I'm not really sure.
Reply
#10

Quote:
Originally Posted by Lukka_Vercetti
Посмотреть сообщение
whys that bud does it execute better or something? mine compiled with no problems
I use this method in scripting cuz it takes less lines and also it's not complex with a huge amount of brackets that cause the loose indentation problems. use any method you want, i'm just giving u an easy way to script.

Quote:
Originally Posted by Lukka_Vercetti
Посмотреть сообщение
would the client messages be correct as in, will he/she recive the right message if hes not the pdonator rank or will it just say your not at the locker?
If you make the first line is 'donating check', it will check first if the player is donater or not! if 'yes' it will check if he's at the point. if 'no' it will send the error message "you're not a vip"
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)