SA-MP Forums Archive
what ive done wrong? - 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: what ive done wrong? (/showthread.php?tid=350494)



what ive done wrong? - thefatshizms - 12.06.2012

what have i done wrong here?
pawn Код:
CMD:robsex(playerid, params[])
{
        if(IsPlayerInRangeOfPoint(playerid, 1.0, -107.1983,-8.3455,1000.7188))
        SetTimer("rob", 10000, false);
        SendClientMessage(playerid, -1, "stay in the checkpoint for 30 secs to rob it!");
        return 1;
    {
    else
    }
        SendClientMessage(playerid, -1, "your not in checkpoint!");
        return 0;
}
    return 1;
}

C:\Users\iphone\Desktop\SFCNR coding\filterscripts\Car_System.pwn(4 : warning 225: unreachable code
C:\Users\iphone\Desktop\SFCNR coding\filterscripts\Car_System.pwn(4 : warning 217: loose indentation
C:\Users\iphone\Desktop\SFCNR coding\filterscripts\Car_System.pwn(49) : error 029: invalid expression, assumed zero
C:\Users\iphone\Desktop\SFCNR coding\filterscripts\Car_System.pwn(51) : warning 217: loose indentation
C:\Users\iphone\Desktop\SFCNR coding\filterscripts\Car_System.pwn(54) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.


Re: what ive done wrong? - Jonny5 - 12.06.2012

pawn Код:
CMD:robsex(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 1.0, -107.1983,-8.3455,1000.7188))
    {
        SetTimer("rob", 10000, false);
        SendClientMessage(playerid, -1, "stay in the checkpoint for 30 secs to rob it!");
        return 1;
    {
    else
    }
        SendClientMessage(playerid, -1, "your not in checkpoint!");
        return 0;
    }
    return 1;
}
you missed the opening bracket in your if statement

indenting the code properly helps to identify this right away


Re: what ive done wrong? - thefatshizms - 12.06.2012

thanks, but got this


C:\Users\iphone\Desktop\SFCNR coding\filterscripts\Car_System.pwn(49) : warning 225: unreachable code
C:\Users\iphone\Desktop\SFCNR coding\filterscripts\Car_System.pwn(49) : warning 217: loose indentation
C:\Users\iphone\Desktop\SFCNR coding\filterscripts\Car_System.pwn(50) : error 029: invalid expression, assumed zero
C:\Users\iphone\Desktop\SFCNR coding\filterscripts\Car_System.pwn(52) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.


Re: what ive done wrong? - Stevee - 12.06.2012

Код:
CMD:robsex(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 1.0, -107.1983,-8.3455,1000.7188))
    {
        SetTimer("rob", 10000, false);
        SendClientMessage(playerid, -1, "stay in the checkpoint for 30 secs to rob it!");
        return 1;
    }
    else
    {
        SendClientMessage(playerid, -1, "your not in checkpoint!");
        return 0;
    }
    return 1;
}
Try this


Re: what ive done wrong? - Elysian` - 12.06.2012

Also,
pawn Код:
#pragma tabsize 0
Will stop all those "Loose Indentations" warnings .


Re: what ive done wrong? - Jonny5 - 12.06.2012

if that did not work
show what line is 49
and show the code above this line 49.


Re: what ive done wrong? - kaisersouse - 12.06.2012

Quote:
Originally Posted by Windows32
Посмотреть сообщение
Also,
pawn Код:
#pragma tabsize 0
Will stop all those "Loose Indentations" warnings .
So does intending properly. Had the OP done that to begin with...it would be easier for him to sort out his bracket problem...


Re: what ive done wrong? - thefatshizms - 12.06.2012

its good so far, the cmd works but.. when it sends you are not in checkpoint there is SERVER:Unkown cmd


Re: what ive done wrong? - iggy1 - 12.06.2012

If you don't want the "unknown command" error return 1 instead of 0.