[HELP] Quit Job
#1

I tried to do in this command whwn can give /quitjob after 2 hours quit the job, but not work, why?

pawn Код:
if(strcmp(cmd, "/quitjob", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pJob] > 0)
            {
                if(PlayerInfo[playerid][pDonateRank] > 0)
                {
                    if(PlayerInfo[playerid][pContractTime] >= 3)
                    {
                        SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You already forfilled your 2 hour Contract, and quited your Job.");
                        PlayerInfo[playerid][pJob] = 0;
                        PlayerInfo[playerid][pChar] = 0;
                        PlayerInfo[playerid][pContractTime] = 0;
                    }
                    else
                    {
                        new chours = 3 - PlayerInfo[playerid][pContractTime];
                        format(string, sizeof(string), "* You still have %d hours left to forfill and end your Contract.", chours / 2);
                        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                    }
                }
                else
                {
                    if(PlayerInfo[playerid][pContractTime] >= 0)
                    {
                        SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You already forfilled your 0 hour Contract, and quited your Job.");
                        PlayerInfo[playerid][pJob] = 0;
                        PlayerInfo[playerid][pChar] = 0;
                        PlayerInfo[playerid][pContractTime] = 0;
                    }
                    else
                    {
                        new chours = 0 - PlayerInfo[playerid][pContractTime];
                        format(string, sizeof(string), "* You still have %d hours left to forfill and end your Contract.", chours / 2);
                        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "   You don't even have a Job !");
            }
        }//not connected
        return 1;
    }
Reply
#2

Try this
pawn Код:
if(strcmp(cmd, "/quitjob", true) == 0)
{
    new ContractTime = 3; //---default set to 3
    if(PlayerInfo[playerid][pJob] < 1) return SendClientMessage(playerid, COLOR_GREY, "   You don't even have a Job !"); //---return this if they don't have a job
    if(PlayerInfo[playerid][pDonateRank] > 0) ContractTime = 0; //if their donate rank is higher than 0, it sets their contract time to 0
    if(Playerinfo[playerid][pContractTime] >= ContractTime){ //--If their contract time is higher than what is needed

        SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You already forfilled your 0 hour Contract, and quited your Job.");
        PlayerInfo[playerid][pJob] = 0;
        PlayerInfo[playerid][pChar] = 0;
        PlayerInfo[playerid][pContractTime] = 0;

    } else { //---If their contract time is lower than what is needed
        new chours = 0 - PlayerInfo[playerid][pContractTime];
        format(string, sizeof(string), "* You still have %d hours left to forfill and end your Contract.", chours / 2);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
    }
    return 1;
}
All I did was re-arrange stuff to make it smaller and easier to look at. If it doesn't work, please tell me what is happening. Is no message popping up?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)