daily pastebin goal
25%
SHARE
TWEET

Holzfäller Job Azgeda Reallife

Leon1337 Nov 5th, 2018 (edited) 86 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Holzfäller by LeonMrBonnie
  2. #define FILTERSCRIPT
  3.  
  4. //**************** INCLUDES **********************
  5. #include <a_samp>
  6. #include <zcmd>
  7. #include <sscanf2>
  8. #include <streamer>
  9. #include <foreach>
  10. //************************************************
  11. //**************** VARIABLEN *********************
  12. #define HTML_WHITE     "{FFFFFF}"
  13. #define COLOR_CYAN 0x99FFFFAA
  14.  
  15. new HolzfaellerVehicle[8];
  16.  
  17. enum JobInfo
  18. {
  19.     bool:OnDuty,
  20.     Checkpoint,
  21.     Vehicle,
  22.     OldSkin,
  23.     Step
  24. };
  25. new JobEnum[MAX_PLAYERS][JobInfo];
  26. new Float:BaumCheckpoints[][] =
  27. {
  28.     {-599.3904,-42.7168,63.5746},
  29.     {-587.9545,-44.0033,64.5544},
  30.     {-587.6785,-33.5350,64.4114},
  31.     {-597.7036,-24.4126,63.4592},
  32.     {-588.7509,-12.0514,63.2006},
  33.     {-578.6344,-17.9134,63.7586},
  34.     {-573.2007,-31.3502,64.4566},
  35.     {-576.0291,15.6816,60.8154},
  36.     {-561.5303,12.4175,62.4453},
  37.     {-569.8950,30.4021,59.7516},
  38.     {-558.5754,25.6053,61.3250},
  39.     {-543.9069,18.4923,61.0342},
  40.     {-544.3560,30.6762,59.0382},
  41.     {-561.4830,39.8395,58.9573}
  42. };
  43.  
  44.  
  45. //************************************************
  46. //**************** PUBLICS ***********************
  47. public OnFilterScriptInit()
  48. {
  49.     print("Holzfäller Job geladen!");
  50.     LoadVehicles();
  51.     CreateDynamicActor(34, -537.3700, -96.0280, 65.3129, 0.0000);
  52.     CreateDynamic3DTextLabel("{48D1CC}Holzfäller\n{FFFFFF}Drücke F um zu interagieren", COLOR_CYAN, -537.3700, -96.0280, 64.2129, 10);
  53.     return 1;
  54. }
  55.  
  56. public OnFilterScriptExit()
  57. {
  58.     return 1;
  59. }
  60.  
  61. public OnPlayerConnect(playerid)
  62. {
  63.     JobEnum[playerid][OnDuty] = false;
  64.     JobEnum[playerid][Checkpoint] = -1;
  65.     JobEnum[playerid][Vehicle] = -1;
  66.     JobEnum[playerid][Step] = -1;
  67.     JobEnum[playerid][OldSkin] = -1;
  68.     return 1;
  69. }
  70.  
  71. public OnPlayerDisconnect(playerid, reason)
  72. {
  73.     if(JobEnum[playerid][Vehicle] != -1)
  74.     {
  75.         SetVehicleToRespawn(JobEnum[playerid][Vehicle]);
  76.     }
  77.     return 1;
  78. }
  79.  
  80. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  81. {
  82.     if(dialogid == 12502)
  83.     {
  84.         if(response)
  85.         {
  86.             if(listitem == 0)
  87.             {
  88.                 if(JobEnum[playerid][OnDuty]) return SendInfoMessage(playerid, "Du hast bereits einen Auftrag angenommen.");
  89.                 JobEnum[playerid][OldSkin] = GetPlayerSkin(playerid);
  90.                 SetPlayerSkin(playerid, 34);
  91.                 JobEnum[playerid][OnDuty] = true;
  92.                 JobEnum[playerid][Step] = 0;
  93.                 SendInfoMessage(playerid, "Steig nun in einen der Trucks ein.");
  94.             }
  95.             if(listitem == 1)
  96.             {
  97.                 if(!JobEnum[playerid][OnDuty]) return SendInfoMessage(playerid, "Du hast noch keinen Auftrag angenommen.");
  98.                 JobEnum[playerid][OnDuty] = false;
  99.                 JobEnum[playerid][Step] = 0;
  100.                 SetVehicleToRespawn(JobEnum[playerid][Vehicle]);
  101.                 JobEnum[playerid][Vehicle] = -1;
  102.                 if(IsValidDynamicCP(JobEnum[playerid][Checkpoint])) DestroyDynamicCP(JobEnum[playerid][Checkpoint]);
  103.                 JobEnum[playerid][Checkpoint] = -1;
  104.                 SetPlayerSkin(playerid, JobEnum[playerid][OldSkin]);
  105.                 SendInfoMessage(playerid, "Du hast deinen Auftrag abgebrochen.");
  106.             }
  107.         }
  108.     }
  109.     if(dialogid == 12503)
  110.     {
  111.         if(response)
  112.         {
  113.             GivePlayerWeapon(playerid, 9, 1);
  114.             SetPlayerArmedWeapon(playerid, 9);
  115.             SendInfoMessage(playerid, "Du beginnst deine Tour als Holzfäller.");
  116.             SendInfoMessage(playerid, "Fahr nun zum ersten Baum.");
  117.             JobEnum[playerid][Step] = 3;
  118.             CreateBaumCheckpoint(playerid);
  119.         }
  120.         else
  121.         {
  122.             RemovePlayerFromVehicle(playerid);
  123.             SetVehicleToRespawn(JobEnum[playerid][Vehicle]);
  124.             JobEnum[playerid][Step] = -1;
  125.             JobEnum[playerid][OnDuty] = false;
  126.             SetPlayerSkin(playerid, JobEnum[playerid][OldSkin]);
  127.         }
  128.     }
  129.     return 0;
  130. }
  131.  
  132. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  133. {
  134.     if(newkeys == KEY_SECONDARY_ATTACK && IsPlayerInRangeOfPoint(playerid, 3.0, -537.3700, -96.0280, 62.5129))
  135.     {
  136.         ShowPlayerDialog(playerid, 12502, DIALOG_STYLE_LIST, "Holzfäller", "Auftrag annehmen\nAuftrag abbrechen", "Auswählen", "Schliessen");
  137.     }
  138.     return 1;
  139. }
  140.  
  141. public OnPlayerEnterDynamicCP(playerid, checkpointid)
  142. {
  143.     if(checkpointid == JobEnum[playerid][Checkpoint])
  144.     {
  145.         new str[32] = "BAUM WIRD GEFÄLLT...";
  146.         convert_encoding(str);
  147.         PlayerPlaySound(playerid, 1139, 0.0, 0.0, 0.0);
  148.         if(JobEnum[playerid][Step] == 1)
  149.         {
  150.             DestroyDynamicCP(JobEnum[playerid][Checkpoint]);
  151.             new Float:x2,Float:y2,Float:z2;
  152.             SetVehicleVelocity(JobEnum[playerid][Vehicle], 0, 0, 0);
  153.             GetPosBehindVehicle(JobEnum[playerid][Vehicle], x2,y2,z2);
  154.             JobEnum[playerid][Checkpoint] = CreateDynamicCP(x2, y2, z2, 1.5, -1, -1, playerid, 5000);
  155.             JobEnum[playerid][Step] = 2;
  156.             SendInfoMessage(playerid, "Hol nun die Kettensäge aus dem Truck.");
  157.         }
  158.         else if(JobEnum[playerid][Step] == 2)
  159.         {
  160.             if(IsPlayerInAnyVehicle(playerid)) return 1;
  161.             DestroyDynamicCP(JobEnum[playerid][Checkpoint]);
  162.             new str2[32] = "KETTENSÄGE WIRD AUSGELADEN...";
  163.             convert_encoding(str2);
  164.             TogglePlayerControllable(playerid, 0);
  165.             GameTextForPlayer(playerid, str2, 3500, 6);
  166.             SetTimerEx("KettensaegeLoaded", 3300, 0, "d", playerid);
  167.         }
  168.         else if(JobEnum[playerid][Step] == 3 || JobEnum[playerid][Step] == 5 || JobEnum[playerid][Step] == 7 || JobEnum[playerid][Step] == 9 || JobEnum[playerid][Step] == 11)
  169.         {
  170.             if(IsPlayerInAnyVehicle(playerid)) return 1;
  171.             DestroyDynamicCP(JobEnum[playerid][Checkpoint]);
  172.             GivePlayerWeapon(playerid, 9, 1);
  173.             SetPlayerArmedWeapon(playerid, 9);
  174.             PreloadAnims(playerid);
  175.             ApplyAnimation(playerid, "CHAINSAW", "WEAPON_csaw", 4.1, 1, 0, 0, 0, 5000);
  176.             GameTextForPlayer(playerid, str, 5500, 6);
  177.             SetTimerEx("AnimDone", 5300, 0, "d", playerid);
  178.         }
  179.         else if(JobEnum[playerid][Step] == 4 || JobEnum[playerid][Step] == 6 || JobEnum[playerid][Step] == 8 || JobEnum[playerid][Step] == 10 || JobEnum[playerid][Step] == 12)
  180.         {
  181.             if(IsPlayerInAnyVehicle(playerid)) return 1;
  182.             DestroyDynamicCP(JobEnum[playerid][Checkpoint]);
  183.             PreloadAnims(playerid);
  184.             ApplyAnimation(playerid, "CARRY", "liftup", 4.1, 1, 0, 0, 0, 3000);
  185.             GameTextForPlayer(playerid, "HOLZ WIRD EINGELADEN...", 3500, 6);
  186.             SetTimerEx("WoodLoaded", 3300, 0, "d", playerid);
  187.         }
  188.         else if(JobEnum[playerid][Step] == 13)
  189.         {
  190.             DestroyDynamicCP(JobEnum[playerid][Checkpoint]);
  191.             JobEnum[playerid][Checkpoint] = -1;
  192.             SetVehicleVelocity(JobEnum[playerid][Vehicle], 0, 0, 0);
  193.             SendInfoMessage(playerid, "Du hast das Holz erfolgreich abgeliefert. Deine Tour ist beendet.");
  194.             ShowPlayerDialog(playerid, 12503, DIALOG_STYLE_MSGBOX, "Tour beenden","Möchtest du weiterjobben?", "Weiter", "Aufhören");
  195.         }
  196.     }
  197.     return 1;
  198. }
  199.  
  200. forward KettensaegeLoaded(playerid);
  201. public KettensaegeLoaded(playerid)
  202. {
  203.     TogglePlayerControllable(playerid, 1);
  204.     SendInfoMessage(playerid, "Fahr nun zum ersten Baum.");
  205.     JobEnum[playerid][Step] = 3;
  206.     CreateBaumCheckpoint(playerid);
  207. }
  208.  
  209. forward WoodLoaded(playerid);
  210. public WoodLoaded(playerid)
  211. {
  212.     if(JobEnum[playerid][Step] < 12)
  213.     {
  214.         RemovePlayerWeapon(playerid, 9);
  215.         TogglePlayerControllable(playerid, 1);
  216.         RemovePlayerAttachedObject(playerid, 0);
  217.         SetPlayerSpecialAction(playerid, 0);
  218.         SendInfoMessage(playerid, "Fahre nun zum nächsten Baum.");
  219.         JobEnum[playerid][Step]++;
  220.         CreateBaumCheckpoint(playerid);
  221.     }
  222.     else
  223.     {
  224.         RemovePlayerAttachedObject(playerid, 0);
  225.         RemovePlayerWeapon(playerid, 9);
  226.         SetPlayerSpecialAction(playerid, 0);
  227.         JobEnum[playerid][Step]++;
  228.         SendInfoMessage(playerid, "Bringe nun das Holz zum Abgabepunkt.");
  229.         JobEnum[playerid][Checkpoint] = CreateDynamicCP(-452.4807,-48.7299,59.7661, 3.5, -1, -1, playerid, 1000);
  230.     }
  231. }
  232.  
  233. forward AnimDone(playerid);
  234. public AnimDone(playerid)
  235. {
  236.     SetPlayerSpecialAction(playerid, 25);
  237.     new Float:x,Float:y,Float:z;
  238.     GetPlayerPos(playerid,x,y,z);
  239.     SetPlayerAttachedObject(playerid, 0, 1463, 1, 0.2009, 0.5620, -0.0239, 7.3999, 88.6000, -1.9000, 0.6279, 0.3809, 0.6800, 0xFFFFFFFF, 0xFFFFFFFF);
  240.     SendInfoMessage(playerid, "Lade das Holz nun in deinen Truck.");
  241.     new Float:x2,Float:y2,Float:z2;
  242.     GetPosBehindVehicle(JobEnum[playerid][Vehicle], x2,y2,z2);
  243.     JobEnum[playerid][Checkpoint] = CreateDynamicCP(x2, y2, z2, 1.5, -1, -1, playerid, 5000);
  244.     JobEnum[playerid][Step]++;
  245. }
  246.  
  247. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  248. {
  249.     if(JobEnum[playerid][Step] == 0 && JobEnum[playerid][OnDuty])
  250.     {
  251.         for(new i; i<(sizeof HolzfaellerVehicle); i++)
  252.         {
  253.             if(vehicleid == HolzfaellerVehicle[i])
  254.             {
  255.                 JobEnum[playerid][Step] = 1;
  256.                 JobEnum[playerid][Vehicle] = vehicleid;
  257.                 SendInfoMessage(playerid, "Fahre nun zu den Bäumen. Begib dich zum Checkpoint.");
  258.                 JobEnum[playerid][Checkpoint] = CreateDynamicCP(-610.9353,-34.3532,62.6005, 5, -1, -1, playerid, 1000);
  259.             }
  260.         }
  261.     }
  262.     return 1;
  263. }
  264.  
  265. public OnVehicleDeath(vehicleid, killerid)
  266. {
  267.     for(new i; i<GetPlayerPoolSize(); i++)
  268.     {
  269.         if(JobEnum[i][Vehicle] == vehicleid)
  270.         {
  271.             SendInfoMessage(i, "Die Tour wurde vorzeitig beendet, weil dein Fahrzeug zerstört wurde.");
  272.             JobEnum[i][OnDuty] = false;
  273.             JobEnum[i][Step] = -1;
  274.             JobEnum[i][Vehicle] = -1;
  275.             if(IsValidDynamicCP(JobEnum[i][Checkpoint])) DestroyDynamicCP(JobEnum[i][Checkpoint]);
  276.             JobEnum[i][Checkpoint] = -1;
  277.         }
  278.     }
  279. }
  280.  
  281. public OnPlayerDeath(playerid)
  282. {
  283.     if(JobEnum[playerid][OnDuty])
  284.     {
  285.         SendInfoMessage(playerid, "Die Tour wurde vorzeitig beendet, weil du gestorben bist.");
  286.         JobEnum[playerid][OnDuty] = false;
  287.         SetVehicleToRespawn(JobEnum[playerid][Vehicle]);
  288.         JobEnum[playerid][Step] = -1;
  289.         JobEnum[playerid][Vehicle] = -1;
  290.         if(IsValidDynamicCP(JobEnum[playerid][Checkpoint])) DestroyDynamicCP(JobEnum[playerid][Checkpoint]);
  291.         JobEnum[playerid][Checkpoint] = -1;
  292.     }
  293. }
  294.  
  295. //************************************************
  296. //**************** BEFEHLE ***********************
  297.  
  298. //********************************************
  299. //*************** FUNKTIONEN *****************
  300. LoadVehicles()
  301. {
  302. HolzfaellerVehicle[0] = CreateVehicle(478, -500.1295, -69.3116, 61.4599, 0.6092, 37, 0, 300); //Walton
  303. HolzfaellerVehicle[1] = CreateVehicle(478, -491.6076, -69.2556, 61.1741, 0.0801, 37, 0, 300); //Walton
  304. HolzfaellerVehicle[2] = CreateVehicle(478, -496.0179, -69.3286, 61.3304, 0.1950, 37, 0, 300); //Walton
  305. HolzfaellerVehicle[3] = CreateVehicle(478, -479.3384, -68.0717, 60.6465, 0.4915, 37, 0, 300); //Walton
  306. HolzfaellerVehicle[4] = CreateVehicle(478, -486.6665, -69.2560, 60.9936, 0.3193, 37, 0, 300); //Walton
  307. HolzfaellerVehicle[5] = CreateVehicle(478, -483.0886, -68.1885, 60.7290, 0.4322, 37, 0, 300); //Walton
  308. HolzfaellerVehicle[6] = CreateVehicle(478, -471.5482, -68.1334, 60.2836, 0.1990, 37, 0, 300); //Walton
  309. HolzfaellerVehicle[7] = CreateVehicle(478, -475.8101, -68.0960, 60.5031, 0.2302, 37, 0, 300); //Walton 
  310. }
  311.  
  312. PreloadAnims(playerid)
  313. {
  314.     PreloadAnimLib(playerid,"BOMBER");
  315.     PreloadAnimLib(playerid,"RAPPING");
  316.     PreloadAnimLib(playerid,"SHOP");
  317.     PreloadAnimLib(playerid,"BEACH");
  318.     PreloadAnimLib(playerid,"SMOKING");
  319.     PreloadAnimLib(playerid,"FOOD");
  320.     PreloadAnimLib(playerid,"ON_LOOKERS");
  321.     PreloadAnimLib(playerid,"DEALER");
  322.     PreloadAnimLib(playerid,"CRACK");
  323.     PreloadAnimLib(playerid,"CARRY");
  324.     PreloadAnimLib(playerid,"COP_AMBIENT");
  325.     PreloadAnimLib(playerid,"PARK");
  326.     PreloadAnimLib(playerid,"INT_HOUSE");
  327.     PreloadAnimLib(playerid,"FOOD");
  328.     PreloadAnimLib(playerid,"PED");
  329. }
  330.  
  331. PreloadAnimLib(playerid, animlib[])
  332. {
  333.     ApplyAnimation(playerid,animlib,"null",0.0,0,0,0,0,0);
  334. }
  335.  
  336. SendInfoMessage(playerid, text[])
  337. {
  338.     new message[100];
  339.     format(message,sizeof(message),"[HOLZFÄLLER]: "HTML_WHITE"%s",text);
  340.     SendClientMessage(playerid, COLOR_CYAN, message);
  341.     return 1;
  342. }
  343.  
  344. CreateBaumCheckpoint(playerid)
  345. {
  346.     new cprandom = random(sizeof BaumCheckpoints);
  347.     JobEnum[playerid][Checkpoint] = CreateDynamicCP(BaumCheckpoints[cprandom][0], BaumCheckpoints[cprandom][1], BaumCheckpoints[cprandom][2], 1.35, -1, -1, playerid, 1000);
  348. }
  349.  
  350. stock GetPosBehindVehicle(vehicleid, &Float:x, &Float:y, &Float:z, Float:offset=0.5) //Credits go to MP2
  351. {
  352.     new Float:vehicleSize[3], Float:vehiclePos[3];
  353.     GetVehiclePos(vehicleid, vehiclePos[0], vehiclePos[1], vehiclePos[2]);
  354.     GetVehicleModelInfo(GetVehicleModel(vehicleid), VEHICLE_MODEL_INFO_SIZE, vehicleSize[0], vehicleSize[1], vehicleSize[2]);
  355.     GetXYBehindVehicle(vehicleid, vehiclePos[0], vehiclePos[1], (vehicleSize[1]/2)+offset);
  356.     x = vehiclePos[0];
  357.     y = vehiclePos[1];
  358.     z = vehiclePos[2];
  359.     return 1;
  360. }
  361.  
  362. GetXYBehindVehicle(vehicleid, &Float:q, &Float:w, Float:distance)//Credits go to MP2
  363. {
  364.     new Float:a;
  365.     GetVehiclePos(vehicleid, q, w, a);
  366.     GetVehicleZAngle(vehicleid, a);
  367.     q += (distance * -floatsin(-a, degrees));
  368.     w += (distance * -floatcos(-a, degrees));
  369. }
  370.  
  371. stock convert_encoding(string[])
  372. {
  373.     new original[50] = {192,193,194,196,198,199,200,201,202,203,204,205,206,207,210,211,212,214,217,218,219,220,223,224,225,226,228,230,231,232,233,234,235,236,237,238,239,242,243,244,246,249,250,251,252,209,241,191,161,176};
  374.     new fixed[50] = {128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,94,124};
  375.     new len = strlen(string);
  376.     for (new i; i < len; i++) {
  377.         for(new j;j < 50;j++) {
  378.             if(string[i] == original[j]) {
  379.                 string[i] = fixed[j];
  380.                 break;
  381.             }
  382.         }
  383.     }
  384. }
  385.  
  386. stock RemovePlayerWeapon(playerid, pweaponid)
  387. {
  388.         new plyWeapons[12];
  389.         new plyAmmo[12];
  390.  
  391.         for(new slot = 0; slot < 12; slot++)
  392.         {
  393.                 new pwep, pammo;
  394.                 GetPlayerWeaponData(playerid, slot, pwep, pammo);
  395.  
  396.                 if(pwep != pweaponid)
  397.                 {
  398.                         GetPlayerWeaponData(playerid, slot, plyWeapons[slot], plyAmmo[slot]);
  399.                 }
  400.         }
  401.  
  402.         ResetPlayerWeapons(playerid);
  403.         for(new slot = 0; slot < 12; slot++)
  404.         {
  405.                 GivePlayerWeapon(playerid, plyWeapons[slot], plyAmmo[slot]);
  406.         }
  407. }
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