25.02.2018, 20:05
so i got this condition, if you want to type /getjob but you already have that job,cmd doesnt work saying "you already got this job",the problem is,no matter if i have that job or not,i will always get the message "you already have this job"
also tried this ,not working
PHP код:
YCMD:getjob(playerid, params[], help)
{
new string[180], str[180], job;
for(new j = 1; j < MAX_JOBS; j++) {
// HERE ! if(PlayerData[playerid][Job] == j) return SendClientMessage(playerid, COLOR_WHITE, " You already have this job.");
if(PlayerToPoint(3.0, playerid, JobInfo[j][jPosX], JobInfo[j][jPosY], JobInfo[j][jPosZ]) && j != 7) {
if(PlayerData[playerid][Level] < JobInfo[j][jLevel]) {
format(string, sizeof(string), "You need level %d for this job: %s.", JobInfo[j][jLevel], JobInfo[j][jName]);
SendClientMessage(playerid, COLOR_WHITE, string);
return 1;
}
format(string, sizeof(string), " You can now work at the job %s.", JobInfo[j][jName]);
SendClientMessage(playerid, COLOR_WHITE, string);
if(j == 7) SCM(playerid, COLOR_WHITE, "a.");
else if(j == 8) SCM(playerid, COLOR_WHITE, "b.");
else if(j != 6) SCM(playerid, COLOR_WHITE, " To start working,type /work.");
PlayerData[playerid][Job] = j;
job = 1;
}
}
if(job == 0) return SendClientMessage(playerid, COLOR_WHITE, " You are not near any job.");
mysql_format(SQL, str, 128, "UPDATE `users` SET `Job`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[playerid][Job],PlayerData[playerid][ID]);
mysql_tquery(SQL, str, "", "");
return 1;
}
PHP код:
if(PlayerData[playerid][Job] == JobInfo[j][jID]) return SendClientMessage(playerid, COLOR_WHITE, " You already have this job.");