Exception
#1

Hello,
I like to make a exception for the arms and drug dealer job where only families member can join those jobs. Though i don't know where to look after.
Here is the code

Код:
jobsOnPickupPickup(playerid, pickupid) {
	new title[128];
	dialogstr[0] = 0;
	for(new i=0;i<sizeof(JobPickups);i++) {
		if(JobPickups[i][EJobPickupID] == pickupid) {
			format(dialogstr,sizeof(dialogstr),"{FFFFFF}Would you like to join the %s Job? Press \"{FF0000}Accept{FFFFFF}\" to accept, or \"{FF0000}Reject{FFFFFF}\" to reject",JobPickups[i][EJobName]);
			format(title,sizeof(title),"{00BFFF}%s Job Offer",JobPickups[i][EJobName]);
			new remaining = CanTakeJob(playerid);
			if(remaining != 0) {
				format(title, sizeof(title), "You must wait {FF6347}%d{FFFFFF} minute(s) for your job contract to finish!", remaining/60);
				SendClientMessage(playerid, X11_WHITE, title);
				return 0;
			}
			SetPVarInt(playerid, "JobOffer", i);
			ShowPlayerDialog(playerid, _:EJobs_JobOffer, DIALOG_STYLE_MSGBOX, title, dialogstr, "Accept", "Reject");
			movePlayerBack(playerid, 3.0);
		}
	}
	return 1;
}
but i guess if i put this code
Код:
	} else if(GetPVarInt(playerid, "Family") == 0) {
		SendClientMessage(playerid, X11_TOMATO_2, "You must be in a family.");
		return 1;
	}
in that code it wont work.

These are the pickups

Код:
new JobPickups[][EJobInfo] = { 
	{"Trash Cleaner",359.68, 180.25, 1008.38, 3, 1,  0, Text3D:0,2322.636474, -2077.395263, 13.321226, 0},
	{"Drug Dealer",2143.82, -1674.08, 15.09,0 ,0 ,0 , Text3D:0,2168.98, -1679.85, -15.09, 1},
	{"Arms Dealer",2666.66, -1108.06, 69.39,0 ,0 ,0 , Text3D:0,2666.66, -1108.06, 69.39, 1},
	{"Taxi Driver", 359.47, 184.91, 1008.38, 3, 1, 0 ,Text3D:0, 1763.25, -1900.96, 13.56, 0},
	{"Mercenary", 757.99, 5.37, 1000.70, 5,0, 0, Text3D:0,2232.48, -1726.69, 13.55, 1},
	{"Mechanic",358.99, 167.42, 1008.38, 3, 1, 0, Text3D:0, 1637.53, -1103.15, 23.91, 0},
	{"Smuggler",2196.027832, -2236.349121, 13.546875, 0, 0, 0, Text3D:0,2187.762695, -2273.814208, 13.546875,1},
	{"Lawyer",358.99, 163.11, 1008.38, 3, 1, 0, Text3D:0,358.62, 163.11, 1008.38,0},
	{"Pizza Man",2100.7856, -1804.1826, 13.5546, 0, 0, 0, Text3D:0,2100.7856, -1804.1826, 13.5546,0},
	{"Crafter",1900.399780, -1769.010864, 13.557812, 0, 0, 0, Text3D:0,1900.399780, -1769.010864, 13.557812,1}
};
Reply
#2

pawn Код:
// on top of the function, before the loop:
if ((pickupid == JobPickups[1][EJobPickupID] || pickupid == JobPickups[1][EJobPickupID]) && !GetPVarInt(playerid, "Family")) return SendClientMessage(playerid, X11_TOMATO_2, "You must be in a family.");
Reply
#3

Hmm
The code you gave me only works with the Drug Dealer job and not arms dealer.
Reply
#4

Sorry, replace:
pawn Код:
(pickupid == JobPickups[1][EJobPickupID] || pickupid == JobPickups[1][EJobPickupID])
with:
pawn Код:
(pickupid == JobPickups[1][EJobPickupID] || pickupid == JobPickups[2][EJobPickupID])
Reply
#5

Oh i knew something was wrong
Anyways may i ask where the
Quote:

JobPickups[1]

and
Quote:

JobPickups[2][

comes from?
Reply
#6

From JobPickups array. The second row is Drug Dealer (indexes start from 0 so 1) and the third row is Arms Dealer (index 2).
Reply
#7

Thanks Konstantinos!
Reply
#8

Delete ( Double post.)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)