Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #define COLOR_WHITE 0xFFFFFFAA
- #define COLOR_RED 0xFF0000AA
- #define COLOR_GREEN 0x00FF00AA
- new LS_Ganton;
- new LS_Jefferson;
- new LS_PlayaDelSeville;
- new LS_VerdantBluffs;
- new MoneyPerFolder = 150;
- new MinFolders = 10;
- new MaxFolders = 30;
- enum pFJInfo__ENUM()
- {
- bool:JobStarted,
- CurrentStreetID,
- CurrentStreetName[65],
- MoneyThisRound,
- CheckForAreaTimer,
- FailTimer,
- bool:TimerStarted,
- SecondsInArea,
- bool:StreetIsFlashing
- };
- new pFJInfo[MAX_PLAYERS][pFJInfo__ENUM];
- forward CheckPlayerInArea(playerid);
- forward FailDelivery(playerid);
- public OnFilterScriptInit()
- {
- print(" ");
- print("\n ** Folder Delivery Job v1.0 - By Kwarde :: LOADING...");
- LS_Ganton = GangZoneCreate(2220.01, -1741.078, 2531.842, -1634.489);
- LS_Jefferson = GangZoneCreate(2071.699, -1381.833, 2261.841, -1223.924);
- LS_PlayaDelSeville = GangZoneCreate(2706.773, -2068.74, 2790.435, -1906.883);
- LS_VerdantBluffs = GangZoneCreate(2706.773, -2068.74, 2790.435, -1906.883);
- print("\n** Folder Delivery Job v1.0 - By Kwarde :: LOADED");
- print("** Good luck with delivering the folders");
- print(" ");
- return 1;
- }
- public OnFilterScriptExit()
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- if(IsPlayerConnected(i) && pFJInfo[i][JobStarted])
- StopPlayerJob(i);
- GangZoneDestroy(LS_Ganton);
- GangZoneDestroy(LS_Jefferson);
- GangZoneDestroy(LS_PlayaDelSeville);
- GangZoneDestroy(LS_VerdantBluffs);
- print(" ");
- print("\n ** Folder Delivery Job v1.0 - By Kwarde :: UNLOADED");
- print(" ");
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if(!strcmp(cmdtext, "/startfj", true)){
- if(pFJInfo[playerid][JobStarted]) return SendClientMessage(playerid, COLOR_RED, "FolderChief: You can only do one job at once!");
- StartPlayerJob(playerid);
- }
- if(!strcmp(cmdtext, "/stopfj", true)){
- if(!pFJInfo[playerid][JobStarted]) return SendClientMessage(playerid, COLOR_RED, "FolderChief: You didn't start a job by us yet!");
- StopPlayerJob(playerid);
- SendClientMessage(playerid, COLOR_RED, "FolderChief: Ok. You've stopped your job. You can go back at any time");
- }
- return 0;
- }
- public CheckPlayerInArea(playerid)
- {
- new pTmpName[MAX_PLAYER_NAME], string[128];
- GetPlayerName(playerid, pTmpName, MAX_PLAYER_NAME);
- if(pFJInfo[playerid][JobStarted]){
- if(pFJInfo[playerid][CurrentStreetID] == 1){
- if(IsPlayerInArea(playerid, 2220.01, -1741.078, 2531.842, -1634.489)){
- if(!pFJInfo[playerid][StreetIsFlashing]){
- GangZoneFlashForPlayer(playerid, LS_Ganton, COLOR_RED);
- pFJInfo[playerid][StreetIsFlashing] = true;
- }
- if(pFJInfo[playerid][SecondsInArea] == 0)
- SendClientMessage(playerid, COLOR_GREEN, "FolderChief: Good. Now stay here 60 seconds");
- pFJInfo[playerid][SecondsInArea]++;
- if(pFJInfo[playerid][SecondsInArea] >= 60){
- SendClientMessage(playerid, COLOR_GREEN, "FolderChief: Nicely done! You've completed your job!");
- format(string, sizeof(string), "FolderChief: You've received $%d,- for delivering folders in %s", pFJInfo[playerid][MoneyThisRound], pFJInfo[playerid][CurrentStreetName]);
- SendClientMessage(playerid, COLOR_GREEN, string);
- format(string, sizeof(string), "FolderChief: Please come back any time %s, we want you!", pTmpName);
- SendClientMessage(playerid, COLOR_GREEN, string);
- StopPlayerJob(playerid);
- }
- }
- if(!IsPlayerInArea(playerid, 2220.01, -1741.078, 2531.842, -1634.48) && pFJInfo[playerid][SecondsInArea] > 0){
- format(string, sizeof(string), "FolderChief: %s, don't leave there! Go back to your street, NOW!", pTmpName);
- SendClientMessage(playerid, COLOR_RED, string);
- pFJInfo[playerid][SecondsInArea] = 0;
- }
- if(!IsPlayerInArea(playerid, 2220.01, -1741.078, 2531.842, -1634.48) && pFJInfo[playerid][StreetIsFlashing]){
- GangZoneStopFlashForPlayer(playerid, LS_Ganton);
- pFJInfo[playerid][StreetIsFlashing] = false;
- }
- }
- else if(pFJInfo[playerid][CurrentStreetID] == 2){
- if(IsPlayerInArea(playerid, 2071.699, -1381.833, 2261.841, -1223.924)){
- if(!pFJInfo[playerid][StreetIsFlashing]){
- GangZoneFlashForPlayer(playerid, LS_Jefferson, COLOR_RED);
- pFJInfo[playerid][StreetIsFlashing] = true;
- }
- if(pFJInfo[playerid][SecondsInArea] == 0)
- SendClientMessage(playerid, COLOR_GREEN, "FolderChief: Good. Now stay here 60 seconds");
- pFJInfo[playerid][SecondsInArea]++;
- if(pFJInfo[playerid][SecondsInArea] >= 120){
- SendClientMessage(playerid, COLOR_GREEN, "FolderChief: Nicely done! You've completed your job!");
- format(string, sizeof(string), "FolderChief: You've received $%d,- for delivering folders in %s", pFJInfo[playerid][MoneyThisRound], pFJInfo[playerid][CurrentStreetName]);
- SendClientMessage(playerid, COLOR_GREEN, string);
- format(string, sizeof(string), "FolderChief: Please come back any time %s, we want you!", pTmpName);
- SendClientMessage(playerid, COLOR_GREEN, string);
- StopPlayerJob(playerid);
- }
- }
- if(!IsPlayerInArea(playerid, 2071.699, -1381.833, 2261.841, -1223.924) && pFJInfo[playerid][SecondsInArea] > 0){
- format(string, sizeof(string), "FolderChief: %s, don't leave there! Go back to your street, NOW!", pTmpName);
- SendClientMessage(playerid, COLOR_RED, string);
- pFJInfo[playerid][SecondsInArea] = 0;
- }
- if(!IsPlayerInArea(playerid, 2071.699, -1381.833, 2261.841, -1223.924) && pFJInfo[playerid][StreetIsFlashing]){
- GangZoneStopFlashForPlayer(playerid, LS_Jefferson);
- pFJInfo[playerid][StreetIsFlashing] = false;
- }
- }
- else if(pFJInfo[playerid][CurrentStreetID] == 3){
- if(IsPlayerInArea(playerid, 2706.773, -2068.74, 2790.435, -1906.883)){
- if(!pFJInfo[playerid][StreetIsFlashing]){
- GangZoneFlashForPlayer(playerid, LS_PlayaDelSeville, COLOR_RED);
- pFJInfo[playerid][StreetIsFlashing] = true;
- }
- if(pFJInfo[playerid][SecondsInArea] == 0)
- SendClientMessage(playerid, COLOR_GREEN, "FolderChief: Good. Now stay here 60 seconds");
- pFJInfo[playerid][SecondsInArea]++;
- if(pFJInfo[playerid][SecondsInArea] >= 120){
- SendClientMessage(playerid, COLOR_GREEN, "FolderChief: Nicely done! You've completed your job!");
- format(string, sizeof(string), "FolderChief: You've received $%d,- for delivering folders in %s", pFJInfo[playerid][MoneyThisRound], pFJInfo[playerid][CurrentStreetName]);
- SendClientMessage(playerid, COLOR_GREEN, string);
- format(string, sizeof(string), "FolderChief: Please come back any time %s, we want you!", pTmpName);
- SendClientMessage(playerid, COLOR_GREEN, string);
- StopPlayerJob(playerid);
- }
- }
- if(!IsPlayerInArea(playerid, 2706.773, -2068.74, 2790.435, -1906.883) && pFJInfo[playerid][SecondsInArea] > 0){
- format(string, sizeof(string), "FolderChief: %s, don't leave there! Go back to your street, NOW!", pTmpName);
- SendClientMessage(playerid, COLOR_RED, string);
- pFJInfo[playerid][SecondsInArea] = 0;
- }
- if(!IsPlayerInArea(playerid,2706.773, -2068.74, 2790.435, -1906.8838) && pFJInfo[playerid][StreetIsFlashing]){
- GangZoneStopFlashForPlayer(playerid, LS_PlayaDelSeville);
- pFJInfo[playerid][StreetIsFlashing] = false;
- }
- }
- else if(pFJInfo[playerid][CurrentStreetID] == 4){
- if(IsPlayerInArea(playerid, 2706.773, -2068.74, 2790.435, -1906.883)){
- if(!pFJInfo[playerid][StreetIsFlashing]){
- GangZoneFlashForPlayer(playerid, LS_VerdantBluffs, COLOR_RED);
- pFJInfo[playerid][StreetIsFlashing] = true;
- }
- if(pFJInfo[playerid][SecondsInArea] == 0)
- SendClientMessage(playerid, COLOR_GREEN, "FolderChief: Good. Now stay here 60 seconds");
- pFJInfo[playerid][SecondsInArea]++;
- if(pFJInfo[playerid][SecondsInArea] >= 120){
- SendClientMessage(playerid, COLOR_GREEN, "FolderChief: Nicely done! You've completed your job!");
- format(string, sizeof(string), "FolderChief: You've received $%d,- for delivering folders in %s", pFJInfo[playerid][MoneyThisRound], pFJInfo[playerid][CurrentStreetName]);
- SendClientMessage(playerid, COLOR_GREEN, string);
- format(string, sizeof(string), "FolderChief: Please come back any time %s, we want you!", pTmpName);
- SendClientMessage(playerid, COLOR_GREEN, string);
- StopPlayerJob(playerid);
- }
- }
- if(!IsPlayerInArea(playerid, 2706.773, -2068.74, 2790.435, -1906.883) && pFJInfo[playerid][SecondsInArea] > 0){
- format(string, sizeof(string), "FolderChief: %s, don't leave there! Go back to your street, NOW!", pTmpName);
- SendClientMessage(playerid, COLOR_RED, string);
- pFJInfo[playerid][SecondsInArea] = 0;
- }
- if(!IsPlayerInArea(playerid, 2706.773, -2068.74, 2790.435, -1906.883) && pFJInfo[playerid][StreetIsFlashing]){
- GangZoneStopFlashForPlayer(playerid, LS_VerdantBluffs);
- pFJInfo[playerid][StreetIsFlashing] = false;
- }
- }
- }
- return 1;
- }
- public FailDelivery(playerid)
- {
- new pTmpName[MAX_PLAYER_NAME], string[128];
- GetPlayerName(playerid, pTmpName, MAX_PLAYER_NAME);
- format(string, sizeof(string), "FolderChief: %s! Shame you! I told you to deliver the folders within 10 minutes! They are over. You won't get your money!", pTmpName);
- SendClientMessage(playerid, COLOR_RED, string);
- StopPlayerJob(playerid);
- return 1;
- }
- stock StartPlayerJob(playerid)
- {
- new pTmpName[MAX_PLAYER_NAME], RandomStreet, RandomFolders, string[128];
- GetPlayerName(playerid, pTmpName, MAX_PLAYER_NAME);
- RandomFolders = ( MinFolders + random( MaxFolders - MinFolders ) );
- RandomStreet = random(4);
- switch(RandomStreet){
- case 0:{
- pFJInfo[playerid][CurrentStreetID] = 1;
- strset(pFJInfo[playerid][CurrentStreetName], "Ganton");
- GangZoneShowForPlayer(playerid, LS_Ganton, COLOR_GREEN);
- }
- case 1:{
- pFJInfo[playerid][CurrentStreetID] = 2;
- strset(pFJInfo[playerid][CurrentStreetName], "Jefferson");
- GangZoneShowForPlayer(playerid, LS_Jefferson, COLOR_GREEN);
- }
- case 2:{
- pFJInfo[playerid][CurrentStreetID] = 3;
- strset(pFJInfo[playerid][CurrentStreetName], "Playa Del Seville");
- GangZoneShowForPlayer(playerid, LS_PlayaDelSeville, COLOR_GREEN);
- }
- case 3:{
- pFJInfo[playerid][CurrentStreetID] = 4;
- strset(pFJInfo[playerid][CurrentStreetName], "Verdant Bluffs");
- GangZoneShowForPlayer(playerid, LS_VerdantBluffs, COLOR_GREEN);
- }
- }
- pFJInfo[playerid][MoneyThisRound] = ( RandomFolders * MoneyPerFolder );
- format(string, 128, "FolderChief: Hi %s. We've got some folders to deliver for you", pTmpName);
- SendClientMessage(playerid, COLOR_WHITE, string);
- format(string, 128, "FolderChief: Here are %d folders for you, you'll get $%d,- for it", RandomFolders, pFJInfo[playerid][MoneyThisRound]);
- SendClientMessage(playerid, COLOR_WHITE, string);
- format(string, 128, "FolderChief: Go to %s and stay there 60 seconds. Then you'll get your money", pFJInfo[playerid][CurrentStreetName]);
- SendClientMessage(playerid, COLOR_WHITE, string);
- SendClientMessage(playerid, COLOR_WHITE, "FolderChief: And now, go! You've got 10 minutes to deliver it. If you don't deliver it within 10 minutes, you won't get paid!");
- SendClientMessage(playerid, COLOR_WHITE, "FolderChief: Good luck.");
- pFJInfo[playerid][CheckForAreaTimer] = SetTimerEx("CheckPlayerInArea", 1000, true, "i", playerid);
- pFJInfo[playerid][FailTimer] = SetTimerEx("FailDelivery", 600000, false, "i", playerid);
- pFJInfo[playerid][TimerStarted] = true;
- pFJInfo[playerid][JobStarted] = true;
- return 1;
- }
- stock StopPlayerJob(playerid)
- {
- return ResetPlayerJobInfo(playerid);
- }
- stock ResetPlayerJobInfo(playerid)
- {
- if(pFJInfo[playerid][TimerStarted]){
- KillTimer(pFJInfo[playerid][CheckForAreaTimer]);
- KillTimer(pFJInfo[playerid][FailTimer]);
- }
- if(pFJInfo[playerid][CurrentStreetID] == 1)
- GangZoneHideForPlayer(playerid, LS_Ganton);
- else if(pFJInfo[playerid][CurrentStreetID] == 2)
- GangZoneHideForPlayer(playerid, LS_Jefferson);
- else if(pFJInfo[playerid][CurrentStreetID] == 3)
- GangZoneHideForPlayer(playerid, LS_PlayaDelSeville);
- else if(pFJInfo[playerid][CurrentStreetID] == 4)
- GangZoneHideForPlayer(playerid, LS_VerdantBluffs);
- pFJInfo[playerid][JobStarted] = false;
- pFJInfo[playerid][CurrentStreetID] = (-1);
- pFJInfo[playerid][CurrentStreetName] = 0;
- pFJInfo[playerid][MoneyThisRound] = 0;
- pFJInfo[playerid][CheckForAreaTimer] = (-1);
- pFJInfo[playerid][FailTimer] = (-1);
- pFJInfo[playerid][TimerStarted] = false;
- pFJInfo[playerid][SecondsInArea] = 0;
- pFJInfo[playerid][StreetIsFlashing] = false;
- return 1;
- }
- stock IsPlayerInArea(playerid, Float:MinX, Float:MinY, Float:MaxX, Float:MaxY)
- {
- new Float:pX, Float:pY, Float:pZ;
- GetPlayerPos(playerid, pX, pY, pZ);
- if(pX >= MinX && pX <= MaxX && pY >= MinY && pY <= MaxY)
- return true;
- return false;
- }
- stock strset(astr[], astrtoset[])
- {
- strdel(astr, 0, strlen(astr));
- strins(astr, astrtoset, 0, strlen(astrtoset));
- }
Add Comment
Please, Sign In to add comment