/accept job ? How to do so? - 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: /accept job ? How to do so? (
/showthread.php?tid=327215)
/accept job ? How to do so? -
Mikeydoo - 20.03.2012
Sup , it's Mike again ! I would like to do a /accept job command like :
if IsPlayerInRangeOfPoint(playerid, pos)
Then it would be /joinjob(like drug dealer or so) with OnPlayerCommandText(playerid)
Then i would like to get like if the player typed /joinjob it would ask type accept job to join job and then give the playerjobid1 and save it on a file in filterscript which i dont know how to do so if you guys could gimme a code it would be awesome !
I thank you all !
Re: /accept job ? How to do so? -
antonio112 - 20.03.2012
Well, about the part with
/accept job command. It ain't that hard. All you have to do, is create a new variable (or you can also use PVars in this sittuations) at the /joinjob command. For instance, let's say "Drug Dealer" is job ID 2.
pawn Код:
new JobApplying[MAX_PLAYERS]; // If you want PVars, don't create this variable
// on the /joinjob command, you'd have
JobApplying[playerid] = 2 // for drug dealer job
// or, if you want PVars, use it like:
SetPVarInt(playerid, "ApplyingJob", 2); // This creats a PVar ApplyingJob and sets it to 2.
// And now, the accept job command:
YCMD:accept(player, params[], help)
{
#pragma unused help
if(strcmp(params, "job", false) == 0)
{
if(JobApplying[playerid] == 0)
return SendClientMessage(playerid, -1, "You haven't apply for any job, so you can't accept it.");
// OR if you use PVars, skip the previous step and do:
if(GetPVarInt(playerid, "ApplyingJob") < 1)
return SendClientMessage(playerid, -1, "You haven't apply for any job, so you can't accept it.");
// And now, just set the players job to its variable
PlayerInfo[playerid][Job] = JobApplying[playerid]; // For normal variables
PlayerInfo[playerid][Job] = GetPVarInt(playerid, "ApplyingJob"); // For PVars
// And don't forget to reset the variable
JobApplying[playerid] = 0; // For normal variable
DeletePVar(playerid, "ApplyingJob"); // For PVars
}
That's pretty much everything.
Re: /accept job ? How to do so? -
Mikeydoo - 20.03.2012
Oh god ! Thanks ! But isn't this in YCMD ? Can i use my job FS (which is in normal samp code) with Ycmd ?
Re: /accept job ? How to do so? -
antonio112 - 20.03.2012
Quote:
Originally Posted by Mikeydoo
Oh god ! Thanks ! But isn't this in YCMD ? Can i use my job FS (which is in normal samp code) with Ycmd ?
|
Well, I gave you an example with YCMD because I use YCMD ... but you can always modify it as you wish. Implement it to your server needs.
ps: I don't know if you can use YCMD with your filterscript ... Try it out and see for yourself.