Help return 0;
#1

stock IsPlayerInRangeOfAnyHouse(playerid, Float:Range)
{
for(new houseid = 0; houseid < MAX_HOUSES; houseid ++)
{
if(IsPlayerInRangeOfPoint(playerid, Range, House[houseid][hExtPosX], House[houseid][hExtPosY], House[houseid][hExtPosZ]));//
{
return houseid;
}
}
return 0;
}
Why must return 0; in this scipt?
Reply
#2

You shouldn't do this actually because 0 is still a valid houseid. Return an invalid value such -1 to determinate if a house wasn't found.
Reply
#3

it will be used in an if statement to check whether the player is in range of any house or not. if it is it will return the house id and if it isn't it will return 0. although it can be a housed as well refer to Konstantinos' post

EDIT: Konstantinos was fast
Reply
#4

Okay,thanks all
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)