Unreachable code...why?
#1

It's so frustrating...I made all that code good,why the hell doesn't work?

So,I made 377 houses on my server,I put 1000 cuz I'll make more and here's the frustrating part...If I'm near of one house,in returns that message with the ID of the house...if I'm not near of any house,it says me this "SERVER:Unknown command!",instead of the message "-1" from the last return.Why?

CMD:inrange(playerid,params[])
{
new str[10];
for(new i=1;i<=1000;i++)
{
if(IsPlayerInRangeOfPoint(playerid,1.0,house_spawn _x[i],house_spawn_y[i],house_spawn_z[i]))
{
format(str,10,"%i",i);
return SendClientMessage(playerid,-1,str);
}
}
return SendClientMessage(playerid,-1,"-1");
}
Reply
#2

What's the size of the arrays: house_spawn _x, ,house_spawn_y and ,house_spawn_z?
Reply
#3

Ohhh...thanks,man,you're a hero!) I wasn't concentrate and I forgot them 500,but then I tried with 1000,doesn't worked...and I put 1100 and works!) Probably it works with 1001 minimum,because I don't use the 0 index...thanks again! I was thinking it doesn't mater the array size in the for loop!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)