[Include] Job Framework - Create Jobs Easily
#1

Job Framework - GITHUB

USAGE - GLOBAL FUNCTIONS
PHP код:
JobType:DefineJobType(jTypWorkerStatus[], jTypPaymentjTypPickupID 1239);
CreateJob(jobName[], JobType:jTypeFloat:jPosition_XFloat:jPosition_YFloat:jPosition_Z);
CountJobWorkers(jobID);
GetJobPayment(jobID);
GetJobName(jobIDoutput[], len sizeof(output));
GetJobWorkerStatus(jobIDoutput[], len sizeof(output));
JobsCreated(); 
USAGE - PLAYER FUNCTIONS
PHP код:
SetPlayerJob(playeridjobid);
GetPlayerJob(playerid);
RemovePlayerFromJob(playerid); 
USAGE - CALLBACKS
PHP код:
forward OnJobCreate(jobIDFloat:jPos_XFloat:jPos_YFloat:jPos_Z); - CALLED AFTER [U]CreateJob [/U] FUNCTION
forward OnPlayerPickupJobPickup(playeridjobID); CALLED AFTER PLAYER ENTERS IN JOB PICKUP
forward OnPlayerGetNewJob
(playeridjobID); CALLED AFTER [U]SetPlayerJob[/U] FUNCTION
forward OnPlayerRemoveFromJob(playeridjobID); CALLED AFTER [U]RemovePlayerFromJob[/U] FUNCTION 
Any advice and contribution would be appreciated.
Reply
#2

Cool job ! I've make a pull request, review it and make your repository(package) more user friendly.
Reply
#3

Each of these callbacks are useless. Why would anyone ever need these? The user triggers these callbacks by calling functions so why would anyone need to use a callback? It just adds extra layers of convulsion.

Код:
forward OnJobCreate(jobID, Float:jPos_X, Float:jPos_Y, Float:jPos_Z); - CALLED AFTER CreateJob  FUNCTION 
forward OnPlayerGetNewJob(playerid, jobID); CALLED AFTER SetPlayerJob FUNCTION 
forward OnPlayerRemoveFromJob(playerid, jobID); CALLED AFTER RemovePlayerFromJob FUNCTION
You included it so why don't you use your own iterators? This leads to the next point where this helps big time.
Код:
#include <YSI\y_iterate>
No array validation checks.
Код:
stock GetJobPayment(jobID)
{
	return VAR__typeJob[VAR__Job[jobID][jobType]][JTYPpayment];
}
If you are going to use an enum use it! Write out as many entries as possible and avoid directly referencing array indexes. Yes you can do this but it gets ugly real fast.

Код:
enum main_job
{
	//Back-end
	jName[MAX_JOB_NAME],
	JobType:jobType,
	Float:jPosition[3],

	//Front-end
	jPickup
}
There is just so much substance lacking with this framework I don't know where to start.
Reply
#4

es raari?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)