SAMP /quitjob
#1

My quitjob doesnt work.
It always says "You dont have a job"
Код:
CMD:quitjob(playerid, params[])
{
	if(PlayerInfo[playerid][pJob] < 0)
	{
	    PlayerInfo[playerid][pJob] = 0;
	    SendClientMessage(playerid, COLOR_RED, "<!>You have quited your job!");
	    return 1;
	}
	else
	{
	    SendClientMessage(playerid, COLOR_RED, "<!>You dont even have a job!");
	}
	return 1;
}
0 should be default = no job
Reply
#2

The problem is in the system where the job was assigned.
Reply
#3

Let me show you how it looks.

This is my /join command. It's like joining a job etc. it works fully
Код:
CMD:join(playerid, params[])
{
	if(PlayerInfo[playerid][pJob] > 1)
	{
		if(IsPlayerInRangeOfPoint(playerid, 5.00, -1790.9364,1428.6631,7.1875))
		{
		    PlayerInfo[playerid][pJob] = 1;
		    SendClientMessage(playerid, COLOR_RED, "<!>Gradulations. You became Drug Dealer!");
		    return 1;
		}
		if(IsPlayerInRangeOfPoint(playerid, 5.00, -1713.6594,20.9223,3.5731))
		{
		    PlayerInfo[playerid][pJob] = 2;
		    return 1;
		}
	}
	else
	{
	    SendClientMessage(playerid, COLOR_RED, "<!>You already have a job! Type /quitjob to quit your job!");
	}
	return 1;
}
Reply
#4

Please learn the difference between a < b (a is less than b) and a > b (a is greater than b). You say that 'no job' equals 0, yet you have it the other way round in both of your commands.
Reply
#5

Less than 0?
pawn Код:
CMD:quitjob(playerid, params[])
{
    if(PlayerInfo[playerid][pJob] = 1)
    {
        PlayerInfo[playerid][pJob] = 0;
        SendClientMessage(playerid, COLOR_RED, "<!>You have quited your job!");
        return 1;
    }
    else
    {
        SendClientMessage(playerid, COLOR_RED, "<!>You dont even have a job!");
    }
    return 1;
}
Reply
#6

Do it like:
Код:
CMD:quitjob(playerid, params[])
{
	if(PlayerInfo[playerid][pJob] > 0)
	{
	    PlayerInfo[playerid][pJob] = 0;
	    SendClientMessage(playerid, COLOR_RED, "<!>You have quited your job!");
	    return 1;
	}
	else
	{
	    SendClientMessage(playerid, COLOR_RED, "<!>You dont even have a job!");
	}
	return 1;
}
pJob can't be less than 0 since you have 0 and 1 job ids
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)