Help return 0; - 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: Help return 0; (
/showthread.php?tid=631594)
Help return 0; -
PhamHoang - 01.04.2017
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?
Re: Help return 0; -
Konstantinos - 01.04.2017
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.
Re: Help return 0; -
coool - 01.04.2017
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
Re: Help return 0; -
PhamHoang - 01.04.2017
Okay,thanks all