[HELP] Quit Job - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [HELP] Quit Job (
/showthread.php?tid=510859)
[HELP] Quit Job -
monster010 - 02.05.2014
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;
}
Re: [HELP] Quit Job -
Nathan_Taylor - 02.05.2014
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?