N1E7R4V

Untitled

May 18th, 2013
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 26.60 KB | None | 0 0
  1. local Player = {};
  2.  
  3. --Global draws, textures
  4. local g_draw;
  5. local g_background;
  6.  
  7. --Vasilij
  8. local vasilij = -1;
  9.  
  10. local VAS_SOUND = 15;
  11. local Vasilij_Sound;
  12.  
  13. local VAS_DRAW = 17;
  14. local Vasilij_Draw;
  15.  
  16. function NPC_Vasilij()
  17.    
  18.     vasilij = CreateNPC("Vasilij");
  19.     SpawnPlayer(vasilij);
  20.     SetPlayerAdditionalVisual(vasilij,2,2,29);
  21.     SetPlayerWorld(vasilij,"JARKENDAR.ZEN","START");
  22.     SetPlayerPos(vasilij,26027.6621, -2163.79199, -17342.998);
  23.     SetPlayerAngle(vasilij,225);
  24.     EquipArmor(vasilij,"ITAR_VLK_M");
  25.     EquipMeleeWeapon(vasilij,"ITMW_KRIEGSKEULE");
  26.     PlayAnimation(vasilij,"S_LGUARD");
  27.    
  28.     --Sound
  29.     Vasilij_Sound = {};
  30.     for i = 0, VAS_SOUND - 1 do
  31.         Vasilij_Sound[i] = -1;
  32.     end
  33.    
  34.     Vasilij_Sound[0] = CreateSound("DIA_RAOUL_TROLL_01_00.WAV"); --spojrzcie na niego
  35.     Vasilij_Sound[1] = CreateSound("DIA_RAOUL_TROLL_RECHNUNG_15_00.WAV"); -- w czym problem
  36.     Vasilij_Sound[2] = CreateSound("DIA_RAOUL_TROLL_RECHNUNG_01_02.WAV"); --gardze ludzmi, ktorzy...
  37.     Vasilij_Sound[3] = CreateSound("DIA_RAOUL_TROLL_RECHNUNG_15_04.WAV"); -- i co w tym dziwnego
  38.     Vasilij_Sound[4] = CreateSound("DIA_RAOUL_TROLL_RECHNUNG_01_01.WAV"); --znam ja takich jak ty
  39.     Vasilij_Sound[5] = CreateSound("DIA_RAOUL_TROLL_RECHNUNG_01_03.WAV"); --nie dalej jak wczoraj...
  40.     Vasilij_Sound[6] = CreateSound("DIA_RAOUL_TROLL_RECHNUNG_B_RAOUL_BLAME_01_05.WAV"); --powiedzmy ze jesli przyniesiesz mi...
  41.     Vasilij_Sound[7] = CreateSound("DIA_RAOUL_TROLL_RECHNUNG_NOPROB_15_00.WAV"); --czarnego trola? zaden problem
  42.     Vasilij_Sound[8] = CreateSound("DIA_RAOUL_TROLL_RECHNUNG_01_06.WAV"); --czys ty kiedys widzial czarnego trola
  43.     Vasilij_Sound[9] = CreateSound("DIA_RAOUL_TROLL_WEG_15_00.WAV"); --musze juz isc
  44.     Vasilij_Sound[10] = CreateSound("DIA_RAOUL_TROLL_WEG_01_01.WAV"); --tak.. spadaj
  45.     Vasilij_Sound[11] = CreateSound("DIA_RAOUL_TROLLFELL_15_00.WAV"); --mam skore czarnego trola
  46.     Vasilij_Sound[12] = CreateSound("DIA_RAOUL_TROLLFELL_01_02.WAV"); --nieprawdopodobne. co za nia chcesz
  47.     Vasilij_Sound[13] = CreateSound("DIA_RAOUL_TROLLFELL_15_03.WAV"); --dawaj wszystko co masz
  48.     Vasilij_Sound[14] = CreateSound("DIA_RAOUL_TROLLFELL_JA_01_01.WAV"); --interesy z toba to sama przyjemnosc
  49.    
  50.     --Draw
  51.     Vasilij_Draw = {};
  52.     for i = 0, VAS_DRAW - 1 do
  53.         Vasilij_Draw[i] = -1;
  54.     end
  55.    
  56.     Vasilij_Draw[0] = CreateDraw(3200,6000,"Vasilij: Spуjrzcie na niego..","Font_Old_10_White_Hi.TGA",255,255,0);
  57.     Vasilij_Draw[1] = CreateDraw(3500,6500,"Ja: W czym problem?","Font_Old_10_White_Hi.TGA",255,255,255);
  58.     Vasilij_Draw[2] = CreateDraw(600,6000,"Vasilij: Gardzк ludџmi, ktуrzy stroj№ siк jak pawie. I chwal№ siк swoimi bohaterskimi czynami.","Font_Old_10_White_Hi.TGA",255,255,0);
  59.     Vasilij_Draw[3] = CreateDraw(3200,6500,"Ja: I co w tym dziwnego?","Font_Old_10_White_Hi.TGA",255,255,255);
  60.     Vasilij_Draw[4] = CreateDraw(2500,6000,"Vasilij: Znam ja takich jak ty. Mocni tylko w gкbie..","Font_Old_10_White_Hi.TGA",255,255,0);
  61.    
  62.     Vasilij_Draw[5] = CreateDraw(500,6000,"Vasilij: Nie dalej niї wczoraj musiaіem zdzieliж w pysk jednego z chіopakуw, bo przechwalaі siк,","Font_Old_10_White_Hi.TGA",255,255,0);
  63.     Vasilij_Draw[6] = CreateDraw(1500,6200,"їe nawet z jedn№ rek№ uwi№zan№ za plecami moїe powaliж czarnego trola.","Font_Old_10_White_Hi.TGA",255,255,0);
  64.    
  65.     Vasilij_Draw[7] = CreateDraw(500,6000,"Vasilij: Hmmm, emm.. Powiedzmy, їe jeњli przyniesiesz mi skуrк czarnego trola obsypie ciк zіotem.","Font_Old_10_White_Hi.TGA",255,255,0);
  66.     Vasilij_Draw[8] = CreateDraw(3600,6200,"Co ty na to?","Font_Old_10_White_Hi.TGA",255,255,0);
  67.    
  68.     Vasilij_Draw[9] = CreateDraw(2700,6500,"Ja: Czarnego trola? Їaden problem.","Font_Old_10_White_Hi.TGA",255,255,255);
  69.     Vasilij_Draw[10] = CreateDraw(100,6000,"Czyњ ty kiedyњ widziaі czarnego trola m№dralo? Nie masz nawet pojкcia jakie to wielkie i groџne bestie.","Font_Old_10_White_Hi.TGA",255,255,0);
  70.     Vasilij_Draw[11] = CreateDraw(3500,6500,"Muszк juї iњж.","Font_Old_10_White_Hi.TGA",255,255,255);
  71.     Vasilij_Draw[12] = CreateDraw(3500,6000,"Vasilij: Tak.. Spadaj.","Font_Old_10_White_Hi.TGA",255,255,0);
  72.     Vasilij_Draw[13] = CreateDraw(3000,6500,"Ja: Mam skуrк czarnego trola.","Font_Old_10_White_Hi.TGA",255,255,255);
  73.     Vasilij_Draw[14] = CreateDraw(2500,6000,"Vasilij: Nieprawdopodobne. Co za ni№ chcesz?","Font_Old_10_White_Hi.TGA",255,255,0);
  74.     Vasilij_Draw[15] = CreateDraw(3000,6500,"Ja: Dawaj wszystko co masz.","Font_Old_10_White_Hi.TGA",255,255,255);
  75.     Vasilij_Draw[16] = CreateDraw(2500,6000,"Vasilij: Interesy z tob№ to sama przyjemnoњж.","Font_Old_10_White_Hi.TGA",255,255,0);
  76. end
  77. --End vasilij
  78.  
  79. --Troll
  80. local MIN_TROLL_DISTANCE  = 400;
  81. local MAX_TROLL_DISTANCE = 2000;
  82.  
  83. local troll_timer;
  84. local troll;
  85.  
  86. local troll_tid = -1; --target
  87. local troll_stop = true;
  88.  
  89. local troll_hittimer;
  90. local troll_instancehit = false;
  91. local troll_blow = false;
  92.  
  93. function NPC_Troll()
  94.  
  95.     troll = CreateNPC("Czarny trol");
  96.     SpawnPlayer(troll);
  97.     SetPlayerInstance(troll,"TROLL_BLACK");
  98.     SetPlayerMaxHealth(troll,2);
  99.     SetPlayerHealth(troll,2);
  100.     SetPlayerStrength(troll,1);
  101.     SetPlayerWorld(troll,"JARKENDAR.ZEN","START");
  102.     SetPlayerPos(troll,26027.6621, -2163.79199, -17342.998);
  103.     SetPlayerAngle(troll,160);
  104.    
  105.     troll_timer = SetTimer("Troll_AI",500,1);
  106. end
  107. --End troll
  108.  
  109. function CreateStructurePlayers()
  110.  
  111.     for i = 0, GetMaxSlots() - 1 do
  112.      
  113.         Player[i] = {};
  114.        
  115.         Player[i].talking = false;
  116.         Player[i].talk_timer = -1;
  117.            
  118.          --Vasilij mission
  119.         Player[i].vas_finished = false;
  120.         Player[i].vas_missionstart = false;
  121.         Player[i].vas_talk = false;
  122.         Player[i].vas_dialog = -1;
  123.         Player[i].vas_killedbytroll = false;
  124.         Player[i].vas_trollskin = false;
  125.     end
  126. end
  127.  
  128. function CreateGlobalView()
  129.  
  130.      g_draw = CreateDraw(2700,6500,"Nacisnij CTRL aby porozmawiac z NPC.","Font_Old_10_White_Hi.TGA",255,100,0);
  131.      g_texture = CreateTexture(2500,6300,5900,7000,"Frame_GMPA.TGA");
  132. end
  133.  
  134. --Clear player if is disconnected
  135. function ClearPlayer(playerid)
  136.  
  137.      Player[playerid].talking = false;
  138.      Player[playerid].talk_timer = -1;
  139.      
  140.      --Vasilij mission
  141.       Player[playerid].vas_finished = false;
  142.       Player[playerid].vas_missionstart = false;
  143.       Player[playerid].vas_talk = false;
  144.       Player[playerid].vas_dialog = -1;
  145.       Player[playerid].vas_killedbytroll = false;
  146.       Player[playerid].vas_trollskin = false;
  147. end
  148.  
  149. function DestroyAllNPC()
  150.  
  151.     DestroyNPC(vasilij);
  152.     DestroyNPC(troll);
  153. end
  154.  
  155. function OnFilterscriptInit()
  156.    
  157.     CreateStructurePlayers();
  158.     CreateGlobalView();
  159.    
  160.     --NPC
  161.     NPC_Vasilij();
  162.     NPC_Troll();
  163. end
  164.  
  165. function OnFilterscriptExit()
  166.     --Destroy
  167.     DestroyAllNPC();
  168. end
  169.  
  170. function Talking(playerid)
  171.  
  172.     if Player[playerid].vas_talk == true then
  173.    
  174.         if Player[playerid].vas_dialog == 0 then --spojrzcie na niego
  175.        
  176.             Player[playerid].vas_dialog = 1;
  177.             Player[playerid].talk_timer = SetTimerEx("Talking",1000,0,playerid);
  178.                    
  179.             PlayPlayerSound(playerid,Vasilij_Sound[1]);
  180.            
  181.             HideDraw(playerid,Vasilij_Draw[0]);
  182.             ShowDraw(playerid,Vasilij_Draw[1]);
  183.            
  184.             PlayGesticulation(playerid);
  185.            
  186.         elseif Player[playerid].vas_dialog == 1 then -- w czym problem
  187.        
  188.             Player[playerid].vas_dialog = 2;
  189.             Player[playerid].talk_timer = SetTimerEx("Talking",7300,0,playerid);
  190.                    
  191.             PlayPlayerSound(playerid,Vasilij_Sound[2]);
  192.            
  193.             HideDraw(playerid,Vasilij_Draw[1]);
  194.             ShowDraw(playerid,Vasilij_Draw[2]);
  195.            
  196.             PlayGesticulation(vasilij);
  197.            
  198.         elseif Player[playerid].vas_dialog == 2 then --gardze ludzmi, ktorzy...
  199.        
  200.             Player[playerid].vas_dialog = 3;
  201.             Player[playerid].talk_timer = SetTimerEx("Talking",1300,0,playerid);
  202.                    
  203.             PlayPlayerSound(playerid,Vasilij_Sound[3]);
  204.            
  205.             HideDraw(playerid,Vasilij_Draw[2]);
  206.             ShowDraw(playerid,Vasilij_Draw[3]);
  207.            
  208.             PlayGesticulation(playerid);
  209.            
  210.         elseif Player[playerid].vas_dialog == 3 then --i co w tym dziwnego
  211.        
  212.             Player[playerid].vas_dialog = 4;
  213.             Player[playerid].talk_timer = SetTimerEx("Talking",4000,0,playerid);
  214.                    
  215.             PlayPlayerSound(playerid,Vasilij_Sound[4]);
  216.            
  217.             HideDraw(playerid,Vasilij_Draw[3]);
  218.             ShowDraw(playerid,Vasilij_Draw[4]);
  219.            
  220.             PlayGesticulation(vasilij);
  221.            
  222.         elseif Player[playerid].vas_dialog == 4 then --znam ja takich jak ty
  223.        
  224.             Player[playerid].vas_dialog = 5;
  225.             Player[playerid].talk_timer = SetTimerEx("Talking",12500,0,playerid);
  226.                    
  227.             PlayPlayerSound(playerid,Vasilij_Sound[5]);
  228.            
  229.             HideDraw(playerid,Vasilij_Draw[4]);
  230.             ShowDraw(playerid,Vasilij_Draw[5]);
  231.             ShowDraw(playerid,Vasilij_Draw[6]);
  232.            
  233.             PlayGesticulation(vasilij);
  234.            
  235.         elseif Player[playerid].vas_dialog == 5 then --nie dalej jak wczoraj...
  236.        
  237.             Player[playerid].vas_dialog = 6;
  238.             Player[playerid].talk_timer = SetTimerEx("Talking",8500,0,playerid);
  239.                    
  240.             PlayPlayerSound(playerid,Vasilij_Sound[6]);
  241.            
  242.             HideDraw(playerid,Vasilij_Draw[5]);
  243.             HideDraw(playerid,Vasilij_Draw[6]);
  244.            
  245.             ShowDraw(playerid,Vasilij_Draw[7]);
  246.             ShowDraw(playerid,Vasilij_Draw[8]);
  247.            
  248.             PlayGesticulation(vasilij);
  249.            
  250.         elseif Player[playerid].vas_dialog == 6 then --powiedzmy ze jesli przyniesiesz mi...
  251.        
  252.             Player[playerid].vas_dialog = 7;
  253.             Player[playerid].talk_timer = SetTimerEx("Talking",2500,0,playerid);
  254.                    
  255.             PlayPlayerSound(playerid,Vasilij_Sound[7]);
  256.            
  257.             HideDraw(playerid,Vasilij_Draw[7]);
  258.             HideDraw(playerid,Vasilij_Draw[8]);
  259.            
  260.             ShowDraw(playerid,Vasilij_Draw[9]);
  261.            
  262.             PlayGesticulation(playerid);
  263.            
  264.         elseif Player[playerid].vas_dialog == 7 then --czarnego trola? zaden problem
  265.        
  266.             Player[playerid].vas_dialog = 8;
  267.             Player[playerid].talk_timer = SetTimerEx("Talking",8500,0,playerid);
  268.                    
  269.             PlayPlayerSound(playerid,Vasilij_Sound[8]);
  270.            
  271.             HideDraw(playerid,Vasilij_Draw[9]);
  272.             ShowDraw(playerid,Vasilij_Draw[10]);
  273.            
  274.             PlayGesticulation(vasilij);
  275.            
  276.         elseif Player[playerid].vas_dialog == 8 then --czys ty kiedys widzial czarnego trola
  277.        
  278.             Player[playerid].vas_dialog = 9;
  279.             Player[playerid].talk_timer = SetTimerEx("Talking",1000,0,playerid);
  280.                    
  281.             PlayPlayerSound(playerid,Vasilij_Sound[9]);
  282.            
  283.             HideDraw(playerid,Vasilij_Draw[10]);
  284.             ShowDraw(playerid,Vasilij_Draw[11]);
  285.            
  286.             PlayGesticulation(playerid);
  287.        
  288.         elseif Player[playerid].vas_dialog == 9 then --musze juz isc
  289.        
  290.             Player[playerid].vas_dialog = 10;
  291.             Player[playerid].talk_timer = SetTimerEx("Talking",2500,0,playerid);
  292.                    
  293.             PlayPlayerSound(playerid,Vasilij_Sound[10]);
  294.            
  295.             HideDraw(playerid,Vasilij_Draw[11]);
  296.             ShowDraw(playerid,Vasilij_Draw[12]);
  297.            
  298.             PlayGesticulation(vasilij);
  299.            
  300.         elseif Player[playerid].vas_dialog == 10 then --tak.. spadaj
  301.        
  302.             Player[playerid].talking = false;
  303.             Player[playerid].talk_timer = -1;
  304.      
  305.             Player[playerid].vas_talk = false;
  306.             Player[playerid].vas_dialog = 9; --musze juz isc (petla dopoki nie zdobedziemy skory czarnego trola)
  307.        
  308.             FreezePlayer(playerid,0);
  309.             HideDraw(playerid,Vasilij_Draw[12]);
  310.            
  311.             if Player[playerid].vas_missionstart == false and Player[playerid].vas_finished == false then
  312.            
  313.                 GameTextForPlayer(playerid,200,3500,"Nowa misja: Zdob№dџ dla Vasilija skуrк czarnego trola w zamian za co moїesz otrzymaж trochк zіota.","Font_Old_10_White_Hi.TGA",255,255,0,8000);
  314.                 Player[playerid].vas_missionstart = true; --idziemy zabic trola
  315.                 GiveItem(playerid,"ITWR_MAP_NEWWORLD",1);
  316.             elseif Player[playerid].vas_missionstart == true and Player[playerid].vas_finished == false then
  317.            
  318.                 GameTextForPlayer(playerid,1500,3500,"Zdob№dџ dla Vasilija skуrк czarnego trola zanim z nim porozmawiasz!","Font_Old_10_White_Hi.TGA",255,150,0,5000);
  319.             end
  320.            
  321.         --Kontynuacja, rozmowa o oddawaniu skory
  322.         elseif Player[playerid].vas_dialog == 11 then --mam skore czarnego trola
  323.        
  324.             Player[playerid].vas_dialog = 12;
  325.             Player[playerid].talk_timer = SetTimerEx("Talking",3200,0,playerid);
  326.            
  327.             PlayPlayerSound(playerid,Vasilij_Sound[12]);
  328.        
  329.             ShowDraw(playerid,Vasilij_Draw[14]);
  330.             HideDraw(playerid,Vasilij_Draw[13]);
  331.            
  332.             PlayGesticulation(vasilij);
  333.            
  334.         elseif Player[playerid].vas_dialog == 12 then --nieprawdopodone. co za nia chcesz
  335.        
  336.             Player[playerid].vas_dialog = 13;
  337.             Player[playerid].talk_timer = SetTimerEx("Talking",1800,0,playerid);
  338.            
  339.             PlayPlayerSound(playerid,Vasilij_Sound[13]);
  340.        
  341.             ShowDraw(playerid,Vasilij_Draw[15]);
  342.             HideDraw(playerid,Vasilij_Draw[14]);
  343.            
  344.             PlayGesticulation(playerid);
  345.            
  346.         elseif Player[playerid].vas_dialog == 13 then --dawaj wszystko co masz
  347.        
  348.             Player[playerid].vas_dialog = 14;
  349.             Player[playerid].talk_timer = SetTimerEx("Talking",3500,0,playerid);
  350.            
  351.             PlayPlayerSound(playerid,Vasilij_Sound[14]);
  352.        
  353.             ShowDraw(playerid,Vasilij_Draw[16]);
  354.             HideDraw(playerid,Vasilij_Draw[15]);
  355.            
  356.             PlayGesticulation(vasilij);
  357.            
  358.         elseif Player[playerid].vas_dialog == 14 then --interesy z toba to sama przyjemnosc
  359.        
  360.             Player[playerid].talking = false;
  361.             Player[playerid].talk_timer = -1;
  362.      
  363.             Player[playerid].vas_talk = false;
  364.             Player[playerid].vas_finished = true;
  365.             Player[playerid].vas_dialog = 9; --musze juz isc (petla dopoki nie zdobedziemy skory czarnego trola)
  366.            
  367.             FreezePlayer(playerid,0);
  368.             HideDraw(playerid,Vasilij_Draw[16]);
  369.            
  370.             GameTextForPlayer(playerid,500,3500,"Otrzymaіeњ 500 sztuk zіota, 20 mikstur leczniczych, ostrze, pancerz, 50 kieіbas oraz 45 piw.","Font_Old_10_White_Hi.TGA",0,255,0,8000);
  371.            
  372.             SetPlayerStrength(playerid,160);
  373.             SetPlayerSkillWeapon(playerid,1,70);
  374.            
  375.             RemoveItem(playerid,"ITAT_TROLLBLACKFUR",1);
  376.             GiveItem(playerid,"ITMI_GOLD",500);
  377.             GiveItem(playerid,"ItPo_Health_Addon_04",20);
  378.             EquipMeleeWeapon(playerid,"ITMW_2H_SPECIAL_04");
  379.             EquipArmor(playerid,"ITAR_OreBaron_Addon");
  380.             GiveItem(playerid,"ITFO_SAUSAGE",50);
  381.             GiveItem(playerid,"ITFO_BEER",45);
  382.         end
  383.     end
  384. end
  385.  
  386. function OnPlayerKey(playerid, keydown)
  387.  
  388.      if keydown == KEY_LCONTROL then
  389.      
  390.          if GetFocus(playerid) == vasilij then
  391.          
  392.             if Player[playerid].talking == false then  --if not talking with anyone
  393.            
  394.                  if Player[playerid].vas_talk == false and Player[playerid].vas_dialog == -1 then --vasilij mission
  395.                    
  396.                     Player[playerid].talking = true; --begin talk
  397.                     Player[playerid].vas_talk = true; --begin talk with Vasilij
  398.                     Player[playerid].vas_dialog = 0;
  399.                    
  400.                     SetPlayerAngle(playerid,GetAngleToPlayer(playerid,vasilij));
  401.                     FreezePlayer(playerid,1);
  402.                     SetPlayerAngle(vasilij,GetAngleToPlayer(vasilij,playerid));
  403.                    
  404.                     Player[playerid].talk_timer = SetTimerEx("Talking",2500,0,playerid);
  405.                    
  406.                     PlayPlayerSound(playerid,Vasilij_Sound[0]);
  407.                     ShowDraw(playerid,Vasilij_Draw[0]);
  408.                     HideDraw(playerid,g_draw); --global draw (npc area info)
  409.                     HideTexture(playerid,g_texture);
  410.                    
  411.                     PlayGesticulation(vasilij);
  412.                    
  413.                  elseif Player[playerid].vas_talk == false and Player[playerid].vas_dialog == 9 then
  414.                  
  415.                     Player[playerid].talking = true; --begin talk
  416.                     Player[playerid].vas_talk = true; --begin talk with Vasilij
  417.                    
  418.                     SetPlayerAngle(playerid,GetAngleToPlayer(playerid,vasilij));
  419.                     FreezePlayer(playerid,1);
  420.                     SetPlayerAngle(vasilij,GetAngleToPlayer(vasilij,playerid));
  421.                    
  422.                     HideDraw(playerid,g_draw); --global draw (npc area info)
  423.                     HideTexture(playerid,g_texture);
  424.                    
  425.                     if Player[playerid].vas_finished == false then
  426.                    
  427.                         HasItem(playerid,"ITAT_TROLLBLACKFUR",123);
  428.                         SetTimerEx("CheckTrollSkin",500,0,playerid);
  429.                     else
  430.                    
  431.                         Player[playerid].talk_timer = SetTimerEx("Talking",1000,0,playerid);
  432.            
  433.                         PlayPlayerSound(playerid,Vasilij_Sound[9]);        
  434.                         ShowDraw(playerid,Vasilij_Draw[11]);
  435.        
  436.                         PlayGesticulation(playerid);
  437.                     end
  438.                  end
  439.              end
  440.          end
  441.      end
  442. end
  443.  
  444. function OnPlayerHasItem(playerid, item_instance, amount, equipped, checkid)
  445.  
  446.     if checkid == 123 then
  447.    
  448.         if item_instance == "ITAT_TROLLBLACKFUR" then --mamy skore czarnego trola
  449.        
  450.             Player[playerid].vas_trollskin = true;
  451.         end
  452.     end
  453. end
  454.  
  455. function CheckTrollSkin(playerid)
  456.  
  457.     HideDraw(playerid,g_draw); --global draw (npc area info)
  458.     HideTexture(playerid,g_texture);
  459.  
  460.     if Player[playerid].vas_trollskin == true then --jezeli mamy skore trola
  461.    
  462.         Player[playerid].vas_dialog = 11;
  463.         Player[playerid].talk_timer = SetTimerEx("Talking",2000,0,playerid);
  464.    
  465.         PlayPlayerSound(playerid,Vasilij_Sound[11]);   
  466.         ShowDraw(playerid,Vasilij_Draw[13]);
  467.        
  468.         PlayGesticulation(playerid);
  469.        
  470.     else --jezeli nie mamy skory trola
  471.    
  472.         Player[playerid].talk_timer = SetTimerEx("Talking",1000,0,playerid);
  473.            
  474.         PlayPlayerSound(playerid,Vasilij_Sound[9]);        
  475.         ShowDraw(playerid,Vasilij_Draw[11]);
  476.        
  477.         PlayGesticulation(playerid);
  478.     end
  479. end
  480.  
  481. function OnPlayerFocus(playerid, focusid)
  482.  
  483.     if focusid == vasilij then
  484.         ShowTexture(playerid,g_texture);
  485.         ShowDraw(playerid,g_draw);
  486.        
  487.         SetPlayerEnable_OnPlayerKey(playerid,1);
  488.     else
  489.         HideDraw(playerid,g_draw);
  490.         HideTexture(playerid,g_texture);
  491.        
  492.         SetPlayerEnable_OnPlayerKey(playerid,0);
  493.     end
  494. end
  495.  
  496. function Troll_AI()
  497.    
  498.     if troll_tid == -1 then
  499.    
  500.         for i = 0, GetMaxSlots() - 1 do
  501.        
  502.             if IsPlayerConnected(i) == 1 and IsNPC(i) == 0 and GetPlayerHealth(i) > 0 and GetPlayerHealth(troll) > 0 then
  503.            
  504.                 if GetDistancePlayers(troll,i) <= MAX_TROLL_DISTANCE then
  505.                
  506.                     troll_tid = i;
  507.                     troll_stop = false;
  508.                     PlayAnimation(troll,"S_FISTRUNL");
  509.                     break;
  510.                 end
  511.             end
  512.         end
  513.     else
  514.        
  515.         if IsPlayerConnected(troll_tid) == 1 then
  516.        
  517.             local angle = GetAngleToPlayer(troll,troll_tid);
  518.            
  519.             if angle ~= GetPlayerAngle(troll) then
  520.                 SetPlayerAngle(troll,angle);
  521.             end
  522.            
  523.             local distance = GetDistancePlayers(troll,troll_tid);
  524.            
  525.             if distance <= MAX_TROLL_DISTANCE then --jezeli cel jest w zasiegu trola
  526.        
  527.                 if troll_stop == false then --jezeli biegnie
  528.            
  529.                     if distance <= MIN_TROLL_DISTANCE then --jezeli trol znajduje sie blisko celu to zatrzymujemy go
  530.                
  531.                         troll_stop = true; --stop
  532.                         PlayAnimation(troll,"S_FISTRUN");
  533.                     end
  534.                
  535.                 else --jezeli stoi
  536.                
  537.                     if distance > MIN_TROLL_DISTANCE then --jezeli trol znajduje sie daleko od celu to poruszamy go
  538.                
  539.                         troll_stop = false; --poruszamy
  540.                         PlayAnimation(troll,"S_FISTRUNL");
  541.                     end
  542.                 end
  543.                
  544.                 --Instancja hitu
  545.                 if troll_stop == true and troll_instancehit == false then --jezeli trol stoi obok celu i nie zaczal uderzac, zaczyna uderzac
  546.                
  547.                     if troll_blow == false then
  548.                         troll_instancehit = true;
  549.                         SetTimer("Troll_Hit",1000,0);
  550.                         PlayAnimation(troll,"S_FISTATTACK");
  551.                     end
  552.                 end
  553.                
  554.             else --jezeli cel nie jest w zasiegu trola, resetujemy cel
  555.                
  556.                 troll_tid = -1;
  557.                 troll_stop = true; --stop
  558.                 PlayAnimation(troll,"S_FISTRUN");
  559.             end
  560.            
  561.         else --brak gracza, gracz jest martwy lub trol jest martwy
  562.        
  563.             if troll_stop == false then --jezeli biegnie
  564.            
  565.                 troll_tid = -1;
  566.                 troll_stop = true;
  567.                 PlayAnimation(troll,"S_FISTRUN");
  568.             end
  569.         end
  570.     end
  571. end
  572.  
  573. function Troll_Hit()
  574.  
  575.     if troll_tid ~= -1 then --jezeli cel istnieje
  576.    
  577.         if troll_blow == false then
  578.        
  579.             if IsPlayerConnected(troll_tid) == 1 then --jezeli cel jest polaczony
  580.        
  581.                 local distance = GetDistancePlayers(troll,troll_tid);
  582.            
  583.                 if distance <= MIN_TROLL_DISTANCE then --jezeli trol znajduje sie obok celu
  584.                
  585.                     HitPlayer(troll,troll_tid);
  586.                     PlayAnimation(troll,"S_FISTRUN");
  587.                 end
  588.             end
  589.         end
  590.     end
  591.    
  592.     troll_instancehit = false
  593. end
  594.  
  595. --Klasy graczy
  596. function Tank(playerid)
  597.            
  598.     SetPlayerInstance(playerid,"PC_HERO");
  599.     SetPlayerAdditionalVisual(playerid,3,5,59);
  600.     SetPlayerWalk(playerid,"HumanS_Arrogance.mds");
  601.     SetPlayerMaxHealth(playerid,3800);
  602.     SetPlayerHealth(playerid,3800);
  603.     SetPlayerStrength(playerid,100);
  604.     SetPlayerSkillWeapon(playerid,0,50);
  605.     EquipArmor(playerid,"ITAR_DJG_H");
  606.     EquipMeleeWeapon(playerid,"ITMW_SCHWERT2");
  607.     GiveItem(playerid,"ItPo_Health_Addon_04",10);
  608. end
  609.      
  610. function Fighter(playerid)
  611.            
  612.     SetPlayerInstance(playerid,"PC_HERO");
  613.     SetPlayerAdditionalVisual(playerid,2,1,120);
  614.     SetPlayerWalk(playerid,"HumanS_Relaxed.mds");
  615.     SetPlayerMaxHealth(playerid,2800);
  616.     SetPlayerHealth(playerid,2800);
  617.     SetPlayerStrength(playerid,120);
  618.     SetPlayerDexterity(playerid,70);
  619.     SetPlayerSkillWeapon(playerid,0,50);
  620.     EquipArmor(playerid,"ITAR_SLD_H");
  621.     EquipMeleeWeapon(playerid,"ITMW_SCHWERT5");
  622.     GiveItem(playerid,"ItPo_Health_Addon_04",10);
  623. end
  624.      
  625. function Archer(playerid)
  626.      
  627.     SetPlayerInstance(playerid,"PC_HERO");
  628.     SetPlayerAdditionalVisual(playerid,1,0,32);
  629.     SetPlayerWalk(playerid,"HumanS_Militia.mds");
  630.     SetPlayerMaxHealth(playerid,2200);
  631.     SetPlayerHealth(playerid,2200);
  632.     SetPlayerStrength(playerid,100);
  633.     SetPlayerDexterity(playerid,120);
  634.     SetPlayerSkillWeapon(playerid,0,70);
  635.     SetPlayerSkillWeapon(playerid,2,60);
  636.     EquipArmor(playerid,"ITAR_BDT_H");
  637.     EquipMeleeWeapon(playerid,"ITMW_SCHWERT1");
  638.     EquipRangedWeapon(playerid,"ITRW_BOW_H_01");
  639.     GiveItem(playerid,"ITRW_ARROW",100);
  640.     GiveItem(playerid,"ItPo_Health_Addon_04",10);
  641.  end
  642.  
  643.  
  644. function OnPlayerChangeClass(playerid, classid)
  645.  
  646.     if IsNPC(playerid) == 0 then
  647.    
  648.         if classid == 0 then
  649.             Tank(playerid);
  650.        
  651.         elseif classid == 1 then
  652.             Fighter(playerid);
  653.        
  654.         elseif classid == 2 then
  655.             Archer(playerid);
  656.         end
  657.     end
  658. end
  659.  
  660. function OnPlayerSelectClass(playerid, classid)
  661.  
  662. end
  663.  
  664. function OnPlayerConnect(playerid)
  665.  
  666. end
  667.  
  668. function OnPlayerDisconnect(playerid, reason)
  669.  
  670.      ClearPlayer(playerid); --czyscimy wlasciwosci gracza
  671. end
  672.  
  673. function OnPlayerSpawn(playerid, classid)
  674.  
  675.     if playerid == troll then --respawn dla trola
  676.    
  677.         SetPlayerMaxHealth(troll,2);
  678.         SetPlayerHealth(troll,2);
  679.         SetPlayerWorld(troll,"JARKENDAR.ZEN","START");
  680.         SetPlayerPos(troll,26027.6621, -2163.79199, -17342.998);
  681.         SetPlayerAngle(troll,160);
  682.     end
  683.    
  684.     if IsNPC(playerid) == 0 and playerid ~= troll then
  685.    
  686.         SetPlayerInstance(playerid,"PC_HERO");
  687.        
  688.         if classid == 0 then
  689.        
  690.             Tank(playerid);
  691.            
  692.             if Player[playerid].vas_killedbytroll == false then
  693.                 SetPlayerPos(playerid,1791,-87,-890);
  694.                 SetPlayerAngle(playerid,183);
  695.             else
  696.                 SetPlayerPos(playerid,52161,7805,32576);
  697.                 SetPlayerAngle(playerid,327);
  698.             end
  699.        
  700.         elseif classid == 1 then
  701.        
  702.             Fighter(playerid);
  703.            
  704.             if Player[playerid].vas_killedbytroll == false then
  705.                 SetPlayerPos(playerid,-364,-82,-858);
  706.                 SetPlayerAngle(playerid,90);
  707.             else
  708.                 SetPlayerPos(playerid,52161,7805,32576);
  709.                 SetPlayerAngle(playerid,327);
  710.             end
  711.        
  712.         elseif classid == 2 then
  713.        
  714.             Archer(playerid);
  715.            
  716.             if Player[playerid].vas_killedbytroll == false then
  717.                 SetPlayerPos(playerid,1390,-89,331);
  718.                 SetPlayerAngle(playerid,274);
  719.             else
  720.                 SetPlayerPos(playerid,52161,7805,32576);
  721.                 SetPlayerAngle(playerid,327);
  722.             end
  723.         end
  724.        
  725.         if Player[playerid].vas_finished == true then
  726.        
  727.             SetPlayerStrength(playerid,160);
  728.             SetPlayerSkillWeapon(playerid,1,70);
  729.             EquipMeleeWeapon(playerid,"ITMW_2H_SPECIAL_04");
  730.             EquipArmor(playerid,"ITAR_OreBaron_Addon");
  731.         end
  732.     end
  733. end
  734.  
  735. function OnPlayerDeath(playerid, p_classid, killerid, k_classid)
  736.  
  737.     if playerid == troll_tid then --jezeli padniemy, trol nas juz nie bije
  738.    
  739.         troll_tid = -1;
  740.         troll_stop = true;
  741.         troll_instancehit = false;
  742.         Player[playerid].vas_killedbytroll = true; --spawn nie daleko trola
  743.         PlayAnimation(troll,"S_FISTRUN");
  744.     end
  745.    
  746.     if playerid == troll then --jezeli trol zdechnie nalezy jego AI wylaczyc
  747.    
  748.         troll_tid = -1;
  749.         troll_stop = true;
  750.         troll_instancehit = false;
  751.        
  752.         local x,y,z = GetPlayerPos(troll);
  753.        
  754.         --Drop z trola
  755.         for i = 0, 4 do
  756.        
  757.             local rand = random(15);
  758.            
  759.             if rand == 0 then
  760.                 CreateItem("ITMI_GOLD",500,x + random(200),y,z + random(200));
  761.             elseif rand == 1 then
  762.                 CreateItem("ITFO_CHEESE",80,x + random(200),y,z + random(200));
  763.             elseif rand == 2 then
  764.                 CreateItem("ITMW_1H_BLESSED_03",1,x + random(200),y,z + random(200));
  765.             elseif rand == 3 then
  766.                 CreateItem("ItBe_Addon_Prot_EdgPoi",1,x + random(200),y,z + random(200));
  767.             elseif rand == 4 then
  768.                 CreateItem("ITAR_FireArmor_Addon",1,x + random(200),y,z + random(200));
  769.             elseif rand == 5 then
  770.                 CreateItem("ITAR_PAL_M",1,x + random(200),y,z + random(200));
  771.             elseif rand == 6 then
  772.                 CreateItem("ITMI_PAN",1,x + random(200),y,z + random(200));
  773.             elseif rand == 7 then
  774.                 CreateItem("ITMI_LUTE",1,x + random(200),y,z + random(200));
  775.             elseif rand == 8 then
  776.                 CreateItem("ITSC_TRFSHADOWBEAST",10,x + random(200),y,z + random(200));
  777.             elseif rand == 9 then
  778.                 CreateItem("ITFO_BREAD",50,x + random(200),y,z + random(200));
  779.             elseif rand == 10 then
  780.                 CreateItem("ItRi_Addon_Health_02",1,x + random(200),y,z + random(200));
  781.             elseif rand == 11 then
  782.                 CreateItem("ItPo_Mana_Addon_04",10,x + random(200),y,z + random(200));
  783.             elseif rand == 12 then
  784.                 CreateItem("ITMW_2H_ORCSWORD_02",1,x + random(200),y,z + random(200));
  785.             elseif rand == 13 then
  786.                 CreateItem("ItAm_Addon_STR",1,x + random(200),y,z + random(200));
  787.             elseif rand == 14 then
  788.                 CreateItem("ITMI_JOINT",30,x + random(200),y,z + random(200));
  789.             end
  790.         end
  791.        
  792.         if killerid ~= -1 then
  793.        
  794.             Player[killerid].vas_killedbytroll = false; --normalny spawn
  795.             GameTextForPlayer(killerid,2500,3500,"Zdobyіeњ skуrк czarnego trola! Wracaj do Vasilija, aby oddaж skorк.","Font_Old_10_White_Hi.TGA",255,255,0,8000);
  796.             GiveItem(killerid,"ITAT_TROLLBLACKFUR",1);
  797.        
  798.             local message = string.format("%s %s",GetPlayerName(killerid),"zdobyі skуrк czarnego trola!");
  799.             for i = 0, GetMaxSlots() - 1 do
  800.        
  801.                 if IsPlayerConnected(i) == 1 and IsNPC(i) == 0 and i ~= killerid then
  802.                     GameTextForPlayer(i,2500,3500,message,"Font_Old_10_White_Hi.TGA",255,255,0,8000);
  803.                 end
  804.             end
  805.         end
  806.     end
  807. end
  808.    
  809. function OnPlayerHit(playerid, killerid)
  810.  
  811.     if playerid == troll then --jezeli trol zostal uderzony
  812.    
  813.         if troll_blow == false then
  814.             troll_blow = true; --przez pewien czas trol nie bedzie mogl uderzac
  815.             SetTimer("Troll_Blow",1000,0);
  816.         end
  817.    
  818.     elseif playerid == vasilij then --jezeli vasilij zostal uderzony
  819.    
  820.         HitPlayer(killerid,killerid);
  821.         SetPlayerHealth(killerid,0);
  822.         GameTextForPlayer(killerid,3000,3500,"Nie uderzaj Vasilija!","Font_Old_10_White_Hi.TGA",255,0,0,5000);
  823.        
  824.         SetPlayerHealth(vasilij,GetPlayerMaxHealth(vasilij));
  825.     end
  826. end
  827.  
  828. function Troll_Blow()
  829.  
  830.     troll_blow = false;
  831. end
  832.  
  833. function OnPlayerUnconscious(playerid, p_classid, killerid, k_classid)
  834.  
  835. end
  836.  
  837. function OnPlayerText(playerid, text)
  838.  
  839. end
  840.  
  841. function OnPlayerCommandText(playerid, cmdtext)
  842.  
  843. end
  844.  
  845. function OnPlayerChangeWorld(playerid, world)
  846.  
  847. end
  848.  
  849. function OnPlayerEnterWorld(playerid, world)
  850.  
  851. end
  852.  
  853. function OnPlayerDropItem(playerid, itemid, item_instance, amount, x, y, z)
  854.  
  855. end
  856.  
  857. function OnPlayerTakeItem(playerid, itemid, item_instance, amount, x, y, z)
  858.  
  859. end
Advertisement
Add Comment
Please, Sign In to add comment