SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Includes

Reply
 
Thread Tools Display Modes
Old 23/12/2018, 11:24 AM   #1
Amagida
Little Clucker
 
Join Date: Oct 2017
Posts: 29
Reputation: 14
Default Job Framework - Create Jobs Easily

Job Framework - GITHUB

USAGE - GLOBAL FUNCTIONS

PHP Code:
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 Code:
SetPlayerJob(playeridjobid);
GetPlayerJob(playerid);
RemovePlayerFromJob(playerid); 
USAGE - CALLBACKS

PHP Code:
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.
Amagida is offline   Reply With Quote
Old 23/12/2018, 11:51 AM   #2
DAKYSKYE
Banned
 
Join Date: Jul 2018
Location: Rustavi, Georgia.
Posts: 34
Reputation: 0
Default Re: Job Framework - Create Jobs Easily

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

Last edited by DAKYSKYE; 28/12/2018 at 02:41 PM.
DAKYSKYE is offline   Reply With Quote
Old 25/12/2018, 02:13 AM   #3
Pottus
High-roller
 
Pottus's Avatar
 
Join Date: Jun 2012
Posts: 4,856
Reputation: 1292
Default Re: Job Framework - Create Jobs Easily

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.

Code:
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.
Code:
#include <YSI\y_iterate>
No array validation checks.
Code:
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.

Code:
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.
Pottus is offline   Reply With Quote
Old 27/12/2018, 03:40 AM   #4
Mugala
Gangsta
 
Mugala's Avatar
 
Join Date: Nov 2012
Location: Georgia, Tbilisi
Posts: 859
Reputation: 43
Default Re: Job Framework - Create Jobs Easily

es raari?
__________________
here to help
Mugala is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Include] entrance.inc - Create interiors easily 1sbedx Includes 4 10/05/2018 11:09 PM
[Include] rTurret - Easily create interactive turrets! Corekt Includes 25 18/07/2015 08:52 PM
[Include] >>> San Andreas Telecom - Create a phone system easily <<< ACI Includes 12 15/02/2014 05:09 PM
[Include] k_target - Create a target easily [0.3Z] kadaradam Includes 5 25/01/2014 07:24 PM
[Include] CreateVehicleForPlayer - Use Names to create vehicles, Easily. iPLEOMAX Includes 29 28/06/2012 10:59 AM


All times are GMT. The time now is 01:54 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.