condition
#1

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"

PHP код:
YCMD:getjob(playeridparams[], help
{
    new 
string[180], str[180], job;
    for(new 
1MAX_JOBSj++) {
// HERE !        if(PlayerData[playerid][Job] == j) return SendClientMessage(playerid, COLOR_WHITE, " You already have this job.");
        
if(PlayerToPoint(3.0playeridJobInfo[j][jPosX], JobInfo[j][jPosY], JobInfo[j][jPosZ]) && != 7) {
            if(
PlayerData[playerid][Level] < JobInfo[j][jLevel]) {
                
format(stringsizeof(string), "You need level %d for this job: %s.",  JobInfo[j][jLevel], JobInfo[j][jName]);
                
SendClientMessage(playeridCOLOR_WHITEstring);
                return 
1;
            }
            
format(stringsizeof(string), " You can now work at the job %s."JobInfo[j][jName]);
            
SendClientMessage(playeridCOLOR_WHITEstring);
            
            if(
== 7SCM(playeridCOLOR_WHITE"a.");
            else if(
== 8SCM(playeridCOLOR_WHITE"b.");    
            else if(
!= 6SCM(playeridCOLOR_WHITE" To start working,type /work.");
            
            
PlayerData[playerid][Job] = j;
            
job 1;
        }
    }
    if(
job == 0) return SendClientMessage(playeridCOLOR_WHITE" You are not near any job.");
    
mysql_format(SQLstr128"UPDATE `users` SET `Job`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[playerid][Job],PlayerData[playerid][ID]);
    
mysql_tquery(SQLstr"""");
    return 
1;

also tried this ,not working
PHP код:
        if(PlayerData[playerid][Job] == JobInfo[j][jID]) return SendClientMessage(playeridCOLOR_WHITE" You already have this job."); 
Reply
#2

Your codes little bit confusing , you are doing a few things i wonder why you done it. as why you have return 1 after conditional if , i think that wouldn't help you in your issue but still making defects. plus, you can't enter a string into a variable with sign "=", i think its only working for numbers.
Код:
PlayerData[playerid][Job] = j;
try to use this format instead
Код:
format(PlayerData[playerid][Job], 50, "%s", j);
And don't use the normal format "sizeof" one , because it doesn't accept arrays in.
Reply
#3

solved,moved
PHP код:
if(PlayerData[playerid][Job] == j
under
PHP код:
                SendClientMessage(playeridCOLOR_WHITEstring);
                return 
1;
            } 
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)