[Include] Job Framework - Create Jobs Easily - 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: Filterscripts (
https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (
https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] Job Framework - Create Jobs Easily (
/showthread.php?tid=662085)
Job Framework - Create Jobs Easily -
Amagida - 23.12.2018
PHP код:
JobType:DefineJobType(jTypWorkerStatus[], jTypPayment, jTypPickupID = 1239);
CreateJob(jobName[], JobType:jType, Float:jPosition_X, Float:jPosition_Y, Float:jPosition_Z);
CountJobWorkers(jobID);
GetJobPayment(jobID);
GetJobName(jobID, output[], len = sizeof(output));
GetJobWorkerStatus(jobID, output[], len = sizeof(output));
JobsCreated();
USAGE - PLAYER FUNCTIONS
PHP код:
SetPlayerJob(playerid, jobid);
GetPlayerJob(playerid);
RemovePlayerFromJob(playerid);
USAGE - CALLBACKS
PHP код:
forward OnJobCreate(jobID, Float:jPos_X, Float:jPos_Y, Float:jPos_Z); - CALLED AFTER [U]CreateJob [/U] FUNCTION
forward OnPlayerPickupJobPickup(playerid, jobID); CALLED AFTER PLAYER ENTERS IN JOB PICKUP
forward OnPlayerGetNewJob(playerid, jobID); CALLED AFTER [U]SetPlayerJob[/U] FUNCTION
forward OnPlayerRemoveFromJob(playerid, jobID); CALLED AFTER [U]RemovePlayerFromJob[/U] FUNCTION
Any advice and contribution would be appreciated.
Re: Job Framework - Create Jobs Easily -
DAKYSKYE - 23.12.2018
Cool job ! I've make a pull request, review it and make your repository(package) more user friendly.
Re: Job Framework - Create Jobs Easily -
Pottus - 25.12.2018
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.
Re: Job Framework - Create Jobs Easily -
Mugala - 27.12.2018
es raari?