SHARE
TWEET

Job

a guest Jan 21st, 2020 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <a_samp>
  2. #include <sscanf2>
  3. #include <streamer>
  4. #include <zcmd>
  5.  
  6. #define JOB_NAME1 "Courier"
  7. #define JOB_VEHICLE1 456
  8. new PlayerJob[MAX_PLAYERS];
  9. new JobCp[MAX_PLAYERS];
  10. new JobVehicle[MAX_PLAYERS];
  11. new JobWorking[MAX_PLAYERS];
  12.  
  13.  
  14. public OnFilterScriptInit()
  15. {
  16.        
  17.         print("\n--------------------------------------");
  18.         print(" JobWorking Script Loaded!");
  19.         print("--------------------------------------\n");
  20.  
  21.         CreateObject(19055, -2731.95459, -306.40820, 6.79880, 0.00000, 0.00000, -49.62000);
  22.         CreateVehicle(402, -2735.8835, -295.5635, 6.6630, 49.0800, -1, -1, 100);
  23.         CreateVehicle(495, -2739.5168, -298.3458, 7.0660, 51.9000, -1, -1, 100);   
  24.         return 1;
  25. }
  26.  
  27. public OnFilterScriptExit()
  28. {
  29.         print("\n--------------------------------------");
  30.         print(" JobWorking Script Unloaded!");
  31.         print("--------------------------------------\n");
  32.    return 1;
  33. }
  34.  
  35.  
  36. public OnPlayerConnect(playerid)
  37. {
  38.     JobVehicle[playerid] = 0;
  39.     JobCp[playerid] = 0;
  40.     PlayerJob[playerid] = 0;
  41.     JobWorking[playerid] = 0;
  42.     return 1;
  43. }
  44.  
  45. public OnPlayerDisconnect(playerid, reason)
  46. {
  47.     if(JobWorking[playerid] == 1) FailJob(playerid, "Deconectare");
  48.     return 1;
  49. }
  50.  
  51. public OnPlayerSpawn(playerid)
  52. {
  53.     if(JobWorking[playerid] == 1) FailJob(playerid, "Ai fost respawnat !");
  54. return 1;
  55. }
  56.  
  57. public OnPlayerDeath(playerid, killerid, reason)
  58. {
  59.    if(JobWorking[playerid] == 1) FailJob(playerid, "Ai murit!");
  60. return 1;
  61. }
  62.  
  63. CMD:getjob(playerid)
  64. {
  65.    
  66.     if(PlayerJob[playerid] != 0) return SendClientMessage(playerid, 0x06FFB3FF, "Ai deja un job!");
  67.     if(!IsPlayerInRangeOfPoint(playerid, 5.0,-2788.1003, -295.5852, 6.352)
  68.       return SendClientMessage(playerid, 0xF60202FF, "Nu esti in zona unui job!");
  69.  
  70.     PlayerJob[playerid] = 1;
  71.     SendClientMessage(playerid,0x07B2F7FF, "Noul tau job este "#JOB_NAME1". Folosete comanda /startwork pentru a incepe munca!");
  72.     return 1;
  73. }
  74.  
  75. CMD:quitjob(playerid)
  76. {
  77.    
  78. if(PlayerJob[playerid] != 0) return SendClientMessage(playerid, 0xD20F2DFF, "Nu ai un job!");
  79. if(JobWorking[playerid] == 1) FailJob(playerid, "Ai renuntat la job!");
  80. SendClientMessage(playerid, 0x0F0FD2FF, "Ti-ai dat demisia!");
  81. return 1;
  82. }
  83.  
  84. CMD:startwork(playerid)
  85. {
  86.    
  87.     if(PlayerJob[playerid] != 0) return SendClientMessage(playerid, 0xD20F2DFF, "Nu ai un job!");
  88.  
  89.     if(!IsPlayerInRangeOfPoint(playerid, 2.0, -2783.9023, -281.8239, 6.2069))
  90.     {
  91.         SendClientMessage(playerid, 0x0AE498FF, "Nu esti in locatia potrivita!");
  92.         return 1;
  93.     }
  94.     JobVehicle[playerid] = CreateVehicle(456, -2781.1589, -282.0042, 6.9304, 0.0000, -1, -1, 100);
  95.     PutPlayerInVehicle(playerid, JOB_VEHICLE1, 0);
  96.     JobWorking[playerid] = 1;
  97.     JobCp[playerid] = 1;
  98.     return 1;
  99. }
  100.  
  101. forward FailJob(playerid, reason[]);
  102. public FailJob(playerid, reason[])
  103. {
  104. new string[256];
  105. format(string, sizeof(string), "Munca ta a esuat! Motiv %s,", reason);
  106. SendClientMessage(playerid, 0x521111FF, string);
  107. DestroyVehicle(JobVehicle[playerid]);
  108. JobVehicle[playerid] = 0;
  109. JobWorking[playerid] = 0;
  110. DisablePlayerCheckpoint(playerid);
  111. JobCp[playerid] = 0;
  112. PlayerJob[playerid] = 0;
  113.   return 1;
  114. }
  115.  
  116.  
  117. forward FinalJob(playerid);
  118. public FinalJob(playerid)
  119. {
  120. DestroyVehicle(JobVehicle[playerid]);
  121. JobVehicle[playerid] = 0;
  122. JobWorking[playerid] = 0;
  123. DisablePlayerCheckpoint(playerid);
  124. JobCp[playerid] = 0;
  125. PlayerJob[playerid] = 0;
  126. return 1;
  127.  
  128. }
  129.  
  130.  
  131. public OnPlayerStateChange(playerid, newstate, oldstate)
  132. {
  133. if(newstate == PLAYER_STATE_ONFOOT) FailJob(playerid, "Deoarece te-ai dat jos din masina,job-ul a esuat!");
  134. return 1;
  135. }
  136.  
  137. public OnPlayerEnterCheckpoint(playerid)
  138. {
  139.     new string[256];
  140.     switch(JobCp[playerid])
  141.     {
  142.         case 1: DisablePlayerCheckpoint(playerid), SetPlayerCheckpoint(playerid, -2787.7009, -326.3154, 6.1146, 7.0),
  143.         JobCp[playerid] ++;
  144.         case 2: DisablePlayerCheckpoint(playerid), SetPlayerCheckpoint(playerid, -0.8400, -17.5200, 3.5400, 7.0), JobCp[playerid] ++;
  145.         case 3: DisablePlayerCheckpoint(playerid),SetPlayerCheckpoint(playerid, -1858.0089, 1398.5632, 6.3920, 7.0), JobCp[playerid] ++;
  146.         case 4: DisablePlayerCheckpoint(playerid),SetPlayerCheckpoint(playerid, -1523.4014, 495.0647, 6.4082, 7.0), JobCp[playerid] ++;
  147.         case 5: DisablePlayerCheckpoint(playerid),SetPlayerCheckpoint(playerid, -2126.6016, 208.5466, 34.5315, 7.0), JobCp[playerid] ++;
  148.         case 6: DisablePlayerCheckpoint(playerid),SetPlayerCheckpoint(playerid, -2780.6438, -320.0563, 6.1670, 7.0), JobCp[playerid] ++;
  149.         case 7:
  150.         {
  151.         DisablePlayerCheckpoint(playerid);
  152.         new money = 25000 + random(20000);
  153.         format(string, sizeof(string), "Ai terminat munca si ai primit $%d !", money);
  154.         SendClientMessage(playerid, 0x0F59DAFF, string);
  155.         GivePlayerMoney(playerid, money);
  156.         FinalJob(playerid);
  157.         }
  158.     }
  159.     return 1;
  160. }
  161.  
  162. stock GetName(playerid)
  163. {
  164. new name[MAX_PLAYER_NAME];
  165. GetPlayerName(playerid, name, sizeof(name));
  166. return name;
  167. }
  168.  
  169.  
  170. CMD:bonus(playerid, params[])
  171. {
  172.  
  173.     if(!IsPlayerInRangeOfPoint(playerid, 5.0,-2731.1892,-306.7589,7.1875)) return SendClientMessage(playerid, 0x919191FF, "Nu esti unde trebuie!");
  174.     new string[128], rand = 100000 + random(100000);
  175.     format(string, sizeof(string),"Felicitari, %s! Ai castigat $%d", GetName(playerid), rand);
  176.     SendClientMessage(playerid, 0x99FFFF,string);
  177.     GivePlayerMoney(playerid, rand);
  178.     return 1;
  179. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top