SA-MP Forums Archive
Script problem with 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: Script problem with job (/showthread.php?tid=438296)



Script problem with job - Porgand - 19.05.2013

Hi

I have with jobs one problem.

That was getting job function
Код:
CMD:getjob(playerid, params[])
{
	new 
		grupeering = IsGroupMember(playerid),
		string[MAX_STRING],
		contract = 0
	;
	
	if(GrupiInfo[grupeering][gTyyp] == 0) return SendClientMessage(playerid, COLOR_RED, "On legal group working people can not take himself extra work.");
	if(KasutajaInfo[playerid][pContract] == 1) return SendClientMessage(playerid, COLOR_RED, "You still have a valid contract");

	if(KasutajaInfo[playerid][pDonateRank] == 1) contract = 3;
	else if(KasutajaInfo[playerid][pDonateRank] == 2) contract = 2;
	else if(KasutajaInfo[playerid][pDonateRank] == 3) contract = 1;
	else if(KasutajaInfo[playerid][pDonateRank] == 0) contract = 5;
	if(KasutajaInfo[playerid][pJob] == 1)
	{
		if(IsPlayerInRangeOfPoint(playerid, 2, 1047.0668, -310.8007, 40.0277)) 			GettingJob{playerid} = 1;	// drugdealer
		else if(IsPlayerInRangeOfPoint(playerid, 2, 2778.8459, -1416.2245, 24.7453)) 	GettingJob{playerid} = 2; 	// Car Stealer
		else if(IsPlayerInRangeOfPoint(playerid, 2, 821.4199, -1417.2638, 14.6449)) 	GettingJob{playerid} = 3; 	// Mechanic
		else if(IsPlayerInRangeOfPoint(playerid, 2, 1047.0533, -317.0048, 40.0277)) 	GettingJob{playerid} = 4; 	// Gun dealer
		else if(IsPlayerInRangeOfPoint(playerid, 2, -76.7157, -1136.4625, 1.0781)) 		GettingJob{playerid} = 5; 	// trucker
		else if(IsPlayerInRangeOfPoint(playerid, 2, 2139.5132, -1192.0488, 23.9922)) 	GettingJob{playerid} = 6; 	// Gas men
		else if(IsPlayerInRangeOfPoint(playerid, 2, 1734.2207, -1888.6696, 13.5619)) 	GettingJob{playerid} = 7; 	// Homeless
		else if(IsPlayerInRangeOfPoint(playerid, 2, 1927.4172, -1786.7755, 13.5469)) 	GettingJob{playerid} = 8;   // Sweeper
		else if(IsPlayerInRangeOfPoint(playerid, 2, 2195.7397, -1973.0189, 13.5589))	GettingJob{playerid} = 9;	// garbage man
		else if(IsPlayerInRangeOfPoint(playerid, 2, 387.4527, -1870.7225, 7.8359))		GettingJob{playerid} = 10;	// fisher
		if( GettingJob{playerid} > 1 )
		{
			SendEmoteMessage(playerid, "examines their employment contract.");
			format(string, sizeof(string), "* Jobname: %s. Contract time: %d hour.", TooInfo[GettingJob{playerid}][JobName], contract);
			SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
			SendClientMessage(playerid, COLOR_LIGHTGREEN, "* You get to leave until after the end of the contract.");
			return SendClientMessage(playerid, COLOR_LIGHTGREEN, "* If you're confident in their desire, then type / accept job.");					
		}
		return SendClientMessage(playerid, COLOR_GREY, "You are not a part of any offer of employment at the!");
	}
	return SendClientMessage(playerid, COLOR_GREY, "You already have job, use /leavejob!");
}
Leaving job CMD
Код:
CMD:leavejob(playerid, params[])
{
	if(KasutajaInfo[playerid][pContract] == 1) return SendClientMessage(playerid, COLOR_RED, "You still have a valid contract");
	KasutajaInfo[playerid][pJob] = 0;
	return SendClientMessage(playerid, COLOR_LIGHTGREEN, "* You have leaved your job.");

}
When i put with admin cmd myself sweeper job and then type in chat /info then come the info and the info say that i have sweeper job. When i type in chat /leavejob and then in chat i see that say "You have leaved your job" and that smae info is on /info CMD. Put when i go pickup icon and type /getjob then the chat say that i have already the job.

Sorry for my bad english (i'm from Sweden)