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