09.03.2019, 10:28
Hi, take a look at this,
EDIT: Also, why do you start loop from 1? You are skipping first spot (0)
PHP код:
CMD:getjob(playerid, params[]){
if(PlayerInfo[playerid][pJob] != 0){
SendClientMessage(playerid, COLOR_GREY, "You already have a job");
return 1;
}
for(new i = 1; i <= MAX_JOBS; i++)
{
if(!IsPlayerInRangeOfPoint(playerid, 3.0, JobInfo[i][jPosX], JobInfo[i][jPosY], JobInfo[i][jPosZ])){
continue;
}
// Code if you are in range of a job goes here
// Now give a value to PlayerInfo[playerid][pJob] different from 0, because we found a job
break; // Break the loop once found the job you were looking for
}
// If after the loop we didnt find a job, and so PlayerInfo[playerid][pJob] is equal to 0 (or the value you use to say "no job found") we can do
if(PlayerInfo[playerid][pJob] == 0){
SendClientMessage(playerid, COLOR_GREY, "You aren't in range of any job point");
return 1;
}
return 1;
}