PDA

View Full Version : what ive done wrong?


thefatshizms
12/06/2012, 07:52 PM
what have i done wrong here?
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(48) : warning 225: unreachable code
C:\Users\iphone\Desktop\SFCNR coding\filterscripts\Car_System.pwn(48) : 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 (c) 1997-2006, ITB CompuPhase


2 Errors.

Jonny5
12/06/2012, 07:55 PM
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

thefatshizms
12/06/2012, 08:02 PM
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 (c) 1997-2006, ITB CompuPhase


1 Error.

Stevee
12/06/2012, 08:05 PM
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

Elysian`
12/06/2012, 08:10 PM
Also,
#pragma tabsize 0
Will stop all those "Loose Indentations" warnings ;).

Jonny5
12/06/2012, 08:13 PM
if that did not work
show what line is 49
and show the code above this line 49.

kaisersouse
12/06/2012, 08:19 PM
Also,
#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...

thefatshizms
12/06/2012, 08:20 PM
its good so far, the cmd works but.. when it sends you are not in checkpoint there is SERVER:Unkown cmd

iggy1
12/06/2012, 08:31 PM
If you don't want the "unknown command" error return 1 instead of 0.