getjob cmd help
#4

Hi, take a look at this,

PHP код:
CMD:getjob(playeridparams[]){
    if(
PlayerInfo[playerid][pJob] != 0){
        
SendClientMessage(playeridCOLOR_GREY"You already have a job");
        return 
1;
    }
    for(new 
1<= MAX_JOBSi++)
    {
        if(!
IsPlayerInRangeOfPoint(playerid3.0JobInfo[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(playeridCOLOR_GREY"You aren't in range of any job point");
        return 
1;
    }
    return 
1;

EDIT: Also, why do you start loop from 1? You are skipping first spot (0)
Reply


Messages In This Thread
getjob cmd help - by bosmania - 08.03.2019, 15:21
Re: getjob cmd help - by TheToretto - 08.03.2019, 15:38
Re: getjob cmd help - by bosmania - 09.03.2019, 08:46
Re: getjob cmd help - by v1k1nG - 09.03.2019, 10:28
Re: getjob cmd help - by bosmania - 09.03.2019, 10:37
Re: getjob cmd help - by v1k1nG - 09.03.2019, 10:39
Re: getjob cmd help - by TheToretto - 09.03.2019, 10:41
Re: getjob cmd help - by v1k1nG - 09.03.2019, 10:51
Re: getjob cmd help - by bosmania - 09.03.2019, 11:02
Re: getjob cmd help - by v1k1nG - 09.03.2019, 11:06
Re: getjob cmd help - by bosmania - 09.03.2019, 11:08
Re: getjob cmd help - by TheToretto - 09.03.2019, 11:09
Re: getjob cmd help - by bosmania - 09.03.2019, 11:15
Re: getjob cmd help - by v1k1nG - 09.03.2019, 15:02
Re: getjob cmd help - by TheToretto - 09.03.2019, 15:04
Re: getjob cmd help - by v1k1nG - 09.03.2019, 15:12
Re: getjob cmd help - by TheToretto - 09.03.2019, 17:12
Re: getjob cmd help - by v1k1nG - 09.03.2019, 18:26

Forum Jump:


Users browsing this thread: 1 Guest(s)