[HELP] command /quit
#1

Hello I have for job command /quit and when player type that command his job contract is set to 0 only if he has done 5 hours of job. But the problem is I have 0 jobcontract and I type /quit and it says you are done 0 of 5 hours of job contract if you know what I mean? Thanks, and I'm set player job contract in code where he get a job? Thanks again.


pawn Код:
CMD:quit(playerid,params[])
{
    if(gPlayerLogged[playerid] != 1)
    {
        SCM(playerid,COLOR_GRAD2,"{FFFFFF}[{F81414}G-Protect{FFFFFF}] {C3C3C3}You are not logged in!");
        return 1;
    }
    if(PlayerInfo[playerid][Job] == 0) return SCM(playerid,COLOR_GRAD2,"{F81414}(Odbijeno!) {C3C3C3}You can't quit when you have no job!");
    if(PlayerInfo[playerid][JobContract] < 5) return SCMF(playerid,SVIJETLOPLAVA,"You can't quit, you are done %d hours of 5 job contract !",PlayerInfo[playerid][JobContract]);
    PlayerInfo[playerid][Job] = 0;
    PlayerInfo[playerid][JobContract] = 0;
    SCM(playerid,COLOR_YELLOW,"*You are quit from job.");
    return 1;
}
Reply
#2

Isn't it when you type /(q)uit you leave the game? or if it's a command it will not? (not sure)
Reply
#3

The /quit is same as /q ---> It will quit you from the game so you cannot use it as a command!>
Reply
#4

I wonder how he tested this?

pawn Код:
CMD:quit(playerid,params[])
{
    if(gPlayerLogged[playerid] != 1) return SCM(playerid,COLOR_GRAD2, "{FFFFFF}[{F81414}G-Protect{FFFFFF}] {C3C3C3}You are not logged in!");
    if(!PlayerInfo[playerid][Job]) return SCM(playerid, COLOR_GRAD2, "{F81414}(Odbijeno!) {C3C3C3}You can't quit when you have no job!");
    if(0 < PlayerInfo[playerid][JobContract] < 5) return SCMF(playerid, SVIJETLOPLAVA,"You can't quit, you have only done %d hours of the 5-hour job contract!",PlayerInfo[playerid][JobContract]);
    PlayerInfo[playerid][Job] = 0;
    PlayerInfo[playerid][JobContract] = 0;
    SCM(playerid, COLOR_YELLOW, "* You have quit from job.");
    return 1;
}
Yes, you need to change the CMD:quit to something else.
Reply
#5

I just give example beacuse original command was on croatian language. What in that command cause my problem? Thanks
Reply
#6

The code above fixes the problem, you just need to change the name of the command.

The problem was here:
pawn Код:
if(PlayerInfo[playerid][JobContract] < 5) return SCMF(playerid,SVIJETLOPLAVA,"You can't quit, you are done %d hours of 5 job contract !",PlayerInfo[playerid][JobContract]);
If PlayerInfo[playerid][JobContract] == 0, then 0 is less than 5 (0 < 5). So you will get that error message.
So I made it:
pawn Код:
if(0 < PlayerInfo[playerid][JobContract] < 5)
If PlayerInfo[playerid][JobContract] is between 0 and 5, then send the message.
Reply
#7

Quote:
Originally Posted by BenzoAMG
Посмотреть сообщение
pawn Код:
if(0 < PlayerInfo[playerid][JobContract] < 5)
If PlayerInfo[playerid][JobContract] is between 0 and 5
The above code is between 1 and 4. For including 0 and 5, it should be:
pawn Код:
if (0 <= PlayerInfo[playerid][JobContract] <= 5)
Reply
#8

Yes, but he wants to exclude 0, and if someone decides to cancel the mission before starting it (aka equals 5), then they can do it. Hence 0 < JobContract < 5.
Reply
#9

i suggest to use CMD:quitjob instead of CMD:quit
Reply
#10

Quote:
Originally Posted by Luca12
Посмотреть сообщение
I just give example beacuse original command was on croatian language. What in that command cause my problem? Thanks
I suggest you to read before replying youssef
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)