Guest User

Untitled

a guest
Jun 24th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 13.59 KB | None | 0 0
  1. //Scripted by Ruben..
  2. #include <a_samp>
  3. #include <streamer>
  4. #include <F_Menu>
  5. #include <YSI>
  6. new Position;
  7. #define purple 0x800080AA
  8. #define COLOR_RED 0xFF0000AA
  9. #define RED         "{F81414}"
  10. #define LIGHTBLUE   "{00C0FF}"
  11. #define LRED        "{FFA1A1}"
  12. #define GREEN       "{6EF83C}"
  13. #define GREY        "{C3C3C3}"
  14. #define LIGHTBLUES 0x00AFFFFF
  15. #define COLOR_WHITE 0xFFFFFFFF
  16.  
  17. #define GM2 2
  18. new S1;
  19. new GameMinutes =5;
  20. new GameSeconds =59;
  21. new GameTimer;
  22. new Text:Textdraw0;
  23. new Text:Textdraw5;
  24. forward GameTime(playerid);
  25. forward One(playerid);
  26. forward Two(playerid);
  27. forward Three(playerid);
  28. forward Four(playerid);
  29. forward Five(playerid);
  30. forward GoGoGo(playerid);
  31. //
  32. new iCountdown = 4;
  33. new iStartCountdown;
  34. new bool: iTimeToExit;
  35. new iTimerToExit;
  36. new Text:Textdraw1;new Text:Textdraw2;
  37. forward GameOver(playerid);
  38. forward iTimerToStartCountdown ( ) ;
  39. forward iStartRace ( ) ;
  40. forward iExitGameMode (playerid) ;
  41. forward iStartRace ( ) ;
  42. new bool: iRaceIsStarted ;
  43. #pragma tabsize 0
  44. #define TOP5    true
  45. new
  46.     Text: text_Top5[2]
  47. ;
  48.  
  49. enum rankingEnum
  50. {
  51.     player_Score,
  52.     player_ID
  53. }
  54. main()
  55. {
  56.     print("\n----------------------------------");
  57.     print(" Marina Militare \n GM No: 22 \n Date Created: 15/02/2012");
  58.     print("----------------------------------\n");
  59. }
  60.  
  61. public OnGameModeInit()
  62. {
  63.     SetTimer("BlueTeam",360000,0);
  64.     UsePlayerPedAnims();
  65.     F_Menu_OnInit();
  66. //MENU
  67. S1 = F_CreateMenu("Aiuto - comandi", 200.0, 200.0, 300.0);
  68. F_SetMenuTitleBgColor(S1, 0xFF1400FF);
  69.         F_SetMenuSelectedItemBgColor(S1, 0xFF1400FF);
  70.         F_AddMenuItem(S1, "Comandi utente");
  71.         F_AddMenuItem(S1, "Comandi vip");
  72.         //
  73.     for(new i;i<15;++i)
  74.     {
  75.         SendClientMessageToAll(purple," ");
  76.     }
  77.     // Don't use these lines if it's a filterscript
  78.     SetGameModeText("Marina Militare");
  79.     AddPlayerClass(73, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  80.  
  81.     //TextDraw
  82.     GameTimer = SetTimer("GameTime",1000,1);
  83. //  Count1 = SetTimer("Time",1000,1);
  84.  
  85.     Textdraw0 = TextDrawCreate(586.000000, 43.000000,"3:00");
  86.     TextDrawAlignment(Textdraw0,2);
  87.     TextDrawBackgroundColor(Textdraw0,0x000000ff);
  88.     TextDrawFont(Textdraw0,3);
  89.     TextDrawLetterSize(Textdraw0,0.499999,2.000000);
  90.     TextDrawColor(Textdraw0,0xffffffff);
  91.     TextDrawSetOutline(Textdraw0,1);
  92.     TextDrawSetProportional(Textdraw0,1);
  93.     TextDrawSetShadow(Textdraw0,1);
  94.  
  95.     Textdraw5 = TextDrawCreate(306.000000, 114.000000, " ");
  96.     TextDrawBackgroundColor(Textdraw5, 255);
  97.     TextDrawFont(Textdraw5, 2);
  98.     TextDrawLetterSize(Textdraw5, 1.290000, 7.700000);
  99.     TextDrawColor(Textdraw5, -1);
  100.     TextDrawSetOutline(Textdraw5, 0);
  101.     TextDrawSetProportional(Textdraw5, 0);
  102.     TextDrawSetShadow(Textdraw5, 1);
  103.  
  104.     SetTimer("StartGame",1,0);
  105.  
  106.     text_Top5[0] = TextDrawCreate(79.000000, 135.000000, "Top 5");
  107.     TextDrawAlignment(text_Top5[0], 2);
  108.     TextDrawBackgroundColor(text_Top5[0], 255);
  109.     TextDrawFont(text_Top5[0], 1);
  110.     TextDrawLetterSize(text_Top5[0], 0.280000, 1.499999);
  111.     TextDrawColor(text_Top5[0], -1);
  112.     TextDrawSetOutline(text_Top5[0], 0);
  113.     TextDrawSetProportional(text_Top5[0], 1);
  114.     TextDrawSetShadow(text_Top5[0], 0);
  115.  
  116.     text_Top5[1] = TextDrawCreate(16.000000, 135.000000, " ");
  117.     TextDrawBackgroundColor(text_Top5[1], 255);
  118.     TextDrawFont(text_Top5[1], 1);
  119.     TextDrawLetterSize(text_Top5[1], 0.200000, 0.999999);
  120.     TextDrawColor(text_Top5[1], -1);
  121.     TextDrawSetOutline(text_Top5[1], 0);
  122.     TextDrawSetProportional(text_Top5[1], 1);
  123.     TextDrawSetShadow(text_Top5[1], 0);
  124.     TextDrawUseBox(text_Top5[1], 1);
  125.     TextDrawBoxColor(text_Top5[1], 150);
  126.     TextDrawTextSize(text_Top5[1], 143.000000, 20.000000);
  127.     SetTimer("GameOver",180000,false);
  128.     //
  129.             SetTimer ( "iTimerToStartCountdown" , 10000 , true ) ;
  130.  
  131.         if ( iTimeToExit == true ) {
  132.             iTimerToExit = SetTimer ( "iExitGameMode" , 370000 , true ) ;
  133.             iTimerToExit = false ;
  134.         }
  135.  
  136.     //Vehicles
  137.  
  138.  
  139.  
  140.     return 1;
  141. }
  142.  
  143. public OnGameModeExit()
  144. {
  145.     TextDrawDestroy(text_Top5[0]);
  146.     TextDrawDestroy(text_Top5[1]);
  147.  
  148.  
  149.  
  150.  
  151.     return 1;
  152. }
  153.  
  154. public OnPlayerRequestClass(playerid, classid)
  155. {
  156.  
  157.     SetPlayerInterior(playerid,11);
  158.     SetPlayerPos(playerid,508.7362,-87.4335,998.9609);
  159.     SetPlayerCameraPos(playerid,508.7362,-83.4335,998.9609);
  160.     SetPlayerCameraLookAt(playerid,508.7362,-87.4335,998.9609);
  161.     SetPlayerFacingAngle(playerid,0.0);
  162.     return 1;
  163. }
  164. forward BlueTeam();
  165. public BlueTeam( )
  166. {
  167.     GameTextForAll("~g~GARA~n~~r~FINITA!",2000,0);
  168.     SetTimer("GameModeExitFunc",3000,0);
  169.  
  170. }
  171. //---------------------------------
  172. public OnPlayerConnect(playerid)
  173. {
  174.     GameTextForPlayer(playerid,"~w~Mar~y~ina~n~~r~Mili~w~tare~b~!",3000,1);
  175.  
  176.     return 1;
  177. }
  178.  
  179. public OnPlayerDisconnect(playerid, reason)
  180. {
  181.     new veh;
  182.     veh = GetPlayerVehicleID(playerid);
  183.     SetVehicleToRespawn(veh);
  184.  //kujh mat kar k
  185.     return 1;
  186. }
  187. public OnPlayerSpawn(playerid)
  188. {
  189.     SetCameraBehindPlayer(playerid);
  190.     if ( iRaceIsStarted == true ) {
  191.     TogglePlayerControllable ( playerid , 1 ) ;
  192.     GameTextForPlayer ( playerid , "Gara gia' partita~r~sei in ritardo!" , 3000 , 3 ) ;
  193.     }
  194.     else {
  195.     TogglePlayerControllable ( playerid , 0 ) ;
  196.          }
  197.  
  198.     SetPlayerPos(playerid,-1352.2531,510.9414,11.1953);
  199.     SetPlayerColor(playerid,0xAFFF00FF);
  200.  
  201. TextDrawShowForPlayer(playerid, text_Top5[0]);
  202. TextDrawShowForPlayer(playerid, text_Top5[1]);
  203.  
  204.  
  205.     TextDrawShowForPlayer(playerid,Textdraw0);
  206.  
  207.     TextDrawShowForPlayer(playerid,Textdraw1);
  208.     TextDrawShowForPlayer(playerid,Textdraw2);
  209.     SetPlayerInterior(playerid,0);
  210.     return 1;
  211. }
  212. forward StartGame(playerid);
  213. public StartGame(playerid)
  214. {
  215.  
  216.     SetTimer("Count",10000,0);
  217.  
  218.     return 1;
  219. }
  220. //
  221.  
  222. public GameTime()
  223. {
  224.     if(GameSeconds || GameMinutes)
  225.     {
  226.         GameSeconds--;
  227.         if(GameSeconds <= -1)
  228.         {
  229.             GameMinutes--;
  230.             GameSeconds=59;
  231.         }
  232.         new TimeString[14];
  233.         format(TimeString,sizeof(TimeString),"%02d:%02d",GameMinutes,GameSeconds);
  234.         TextDrawSetString(Textdraw0,TimeString);
  235.     }
  236.  
  237.     return 1;
  238. }
  239.  
  240.  
  241. //
  242. public
  243.     iTimerToStartCountdown ( ) {
  244.         iStartCountdown = SetTimer ( "iStartRace" , 1000 , true ) ;
  245.         //TextDrawShowForAll(Textdraw5);
  246.         return 1;
  247. }
  248. public iExitGameMode (playerid) {
  249.     KillTimer ( iTimerToExit ) ;
  250.  
  251.  
  252.     for(new i;i<15;++i)
  253.     {
  254.         SendClientMessageToAll(purple," ");
  255.     }
  256.     SendClientMessageToAll(purple,"Dona per il nostro server su foroum-insanity.it!");
  257. }
  258. public iStartRace (  ) {
  259.     iCountdown-- ;
  260.     switch ( iCountdown ) {
  261.         case 0: {
  262.             GameTextForAll ( "~g~VIA ~r~VIA ~y~VIA!!!" , 1000 , 3 ) ;
  263.             TextDrawHideForAll(Textdraw5);
  264.             iTimeToExit = true ;
  265.             KillTimer ( iStartCountdown ) ;
  266.             iRaceIsStarted = true ;
  267.             for ( new i = 0 ; i < MAX_PLAYERS ; i++ ) {
  268.                 TogglePlayerControllable ( i , true ) ;
  269.             }
  270.         }
  271.         case 1: {
  272.             GameTextForAll ( "~b~1..." , 1000 , 3 ) ;
  273.             TextDrawSetString(Textdraw5,"~g~1");
  274.             TextDrawSetString(Textdraw5,"~g~GO ~w~!!");
  275.         }
  276.         case 2: {
  277.             GameTextForAll ( "~g~...2..." , 1000 , 3 ) ;
  278.            TextDrawSetString(Textdraw5,"~y~2");
  279.             TextDrawSetString(Textdraw5,"~g~1");
  280.         }
  281.         case 3: {
  282.             GameTextForAll ( "~r~....3...." , 1000 , 3 ) ;
  283.             TextDrawSetString(Textdraw5,"~r~3");
  284.             TextDrawSetString(Textdraw5,"~y~2");
  285.         }
  286.         //case 4: {
  287.         //TextDrawSetString(Textdraw5,"~r~3");
  288.  
  289.     //  }
  290.     }
  291.     return 1;
  292. }
  293.  
  294. public OnPlayerDeath(playerid, killerid, reason)
  295. {
  296.     new veh;
  297.     veh = GetPlayerVehicleID(playerid);
  298.     SetVehicleToRespawn(veh);
  299.     SendDeathMessage(killerid, playerid, reason);
  300.     TextDrawHideForPlayer(playerid, text_Top5[0]);
  301.     TextDrawHideForPlayer(playerid, text_Top5[1]);
  302.     return 1;
  303. }
  304.  
  305. public OnVehicleSpawn(vehicleid)
  306. {
  307.     return 1;
  308. }
  309.  
  310. public OnVehicleDeath(vehicleid, killerid)
  311. {
  312.     return 1;
  313. }
  314.  
  315. public OnPlayerText(playerid, text[])
  316. {
  317.     return 1;
  318. }
  319.  
  320. public OnPlayerCommandText(playerid, cmdtext[])
  321. {
  322.     if(!strcmp(cmdtext, "/shop", true))
  323.     {
  324.     SendClientMessage(playerid,0xff0010ff,"***In questa missione lo shop รจ disabilitato***");
  325.         return 1;
  326.     }
  327.  
  328.     if(!strcmp(cmdtext, "/aiuto", true))
  329.     {
  330.     F_ShowMenuForPlayer(S1, playerid);
  331. TogglePlayerControllable(playerid, false);
  332. return 1;
  333. }
  334.  
  335.  
  336.     return SendClientMessage(playerid,COLOR_RED,"Comando non valido, usa /aiuto per vederli tutti!");
  337. }
  338.  
  339. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  340. {
  341.     return 1;
  342. }
  343.  
  344. public OnPlayerExitVehicle(playerid, vehicleid)
  345. {
  346.     new veh;
  347.     veh = GetPlayerVehicleID(playerid);
  348.     SetVehicleToRespawn(veh);
  349.     return 1;
  350. }
  351.  
  352. public OnPlayerStateChange(playerid, newstate, oldstate)
  353. {
  354.     return 1;
  355. }
  356.  
  357. public OnPlayerEnterCheckpoint(playerid)
  358. {
  359.     return 1;
  360. }
  361.  
  362. public OnPlayerLeaveCheckpoint(playerid)
  363. {
  364.     return 1;
  365. }
  366.  
  367. public OnPlayerEnterRaceCheckpoint(playerid)
  368. {
  369.     return 1;
  370. }
  371.  
  372. public OnPlayerLeaveRaceCheckpoint(playerid)
  373. {
  374.     return 1;
  375. }
  376.  
  377. public OnRconCommand(cmd[])
  378. {
  379.     return 1;
  380. }
  381.  
  382. public OnPlayerRequestSpawn(playerid)
  383. {
  384.     return 1;
  385. }
  386.  
  387. public OnObjectMoved(objectid)
  388. {
  389.     return 1;
  390. }
  391.  
  392. public OnPlayerObjectMoved(playerid, objectid)
  393. {
  394.     return 1;
  395. }
  396.  
  397. public OnPlayerPickUpPickup(playerid, pickupid)
  398. {
  399.     return 1;
  400. }
  401.  
  402. public OnVehicleMod(playerid, vehicleid, componentid)
  403. {
  404.     return 1;
  405. }
  406.  
  407. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  408. {
  409.     return 1;
  410. }
  411.  
  412. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  413. {
  414.     return 1;
  415. }
  416.  
  417. public OnPlayerSelectedMenuRow(playerid, row)
  418. {
  419.     return 1;
  420. }
  421.  
  422. public OnPlayerExitedMenu(playerid)
  423. {
  424.     return 1;
  425. }
  426.  
  427. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  428. {
  429.     return 1;
  430. }
  431.  
  432. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  433. {
  434.  
  435.     return 1;
  436. }
  437.  
  438. public OnRconLoginAttempt(ip[], password[], success)
  439. {
  440.     return 1;
  441. }
  442.  
  443. public OnPlayerUpdate(playerid)
  444. {   new
  445.             playerScores[MAX_PLAYERS][rankingEnum],
  446.             index
  447.         ;
  448.         for(new i; i != MAX_PLAYERS; ++i)
  449.         {
  450.             if(IsPlayerConnected(i) && !IsPlayerNPC(i))
  451.             {
  452.                 playerScores[index][player_Score] = GetPlayerScore(i);
  453.                 playerScores[index++][player_ID] = i;
  454.             }
  455.         }
  456.         GetPlayerHighestScores(playerScores, 0, index);
  457.  
  458.         new
  459.             score_Text[256] = "~n~",
  460.             player_Name[20]
  461.         ;
  462.         for(new i; i < 5; ++i)
  463.         {
  464.             if(i < index)
  465.             {
  466.                 GetPlayerName(playerScores[i][player_ID], player_Name, sizeof(player_Name));
  467.                 format(score_Text, sizeof(score_Text), "%s~n~~b~%d. ~w~%s - ~r~%d", score_Text, i + 1, player_Name, playerScores[i][player_Score]);
  468.             }
  469.             else
  470.                 format(score_Text, sizeof(score_Text), "%s~n~~b~%d. ~r~N/A", score_Text, i + 1);
  471.         }
  472.         TextDrawSetString(text_Top5[1], score_Text);
  473.  
  474.     return 1;
  475. }
  476.  
  477. public OnPlayerStreamIn(playerid, forplayerid)
  478. {
  479.     return 1;
  480. }
  481.  
  482. public OnPlayerStreamOut(playerid, forplayerid)
  483. {
  484.     return 1;
  485. }
  486.  
  487. public OnVehicleStreamIn(vehicleid, forplayerid)
  488. {
  489.     return 1;
  490. }
  491.  
  492. public OnVehicleStreamOut(vehicleid, forplayerid)
  493. {
  494.     return 1;
  495. }
  496.  
  497. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  498. {
  499.     return 1;
  500. }
  501.  
  502. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  503. {
  504.     return 1;
  505. }
  506. stock GetPlayerHighestScores(array[][rankingEnum], left, right)
  507. {
  508.     new
  509.         tempLeft = left,
  510.         tempRight = right,
  511.         pivot = array[(left + right) / 2][player_Score],
  512.         tempVar
  513.     ;
  514.     while(tempLeft <= tempRight)
  515.     {
  516.         while(array[tempLeft][player_Score] > pivot) tempLeft++;
  517.         while(array[tempRight][player_Score] < pivot) tempRight--;
  518.  
  519.         if(tempLeft <= tempRight)
  520.         {
  521.             tempVar = array[tempLeft][player_Score], array[tempLeft][player_Score] = array[tempRight][player_Score], array[tempRight][player_Score] = tempVar;
  522.             tempVar = array[tempLeft][player_ID], array[tempLeft][player_ID] = array[tempRight][player_ID], array[tempRight][player_ID] = tempVar;
  523.             tempLeft++, tempRight--;
  524.         }
  525.     }
  526.     if(left < tempRight) GetPlayerHighestScores(array, left, tempRight);
  527.     if(tempLeft < right) GetPlayerHighestScores(array, tempLeft, right);
  528. }
  529.  
  530. public GameOver(playerid)
  531. {
  532.     SendRconCommand("changemode GM1");
  533.     GameTextForAll("~y~Stiamo cambiando la mode ~n~ ~w~Aspetta 5 secondi....~n~American Choppers",5000,1);
  534.     KillTimer(GameTimer);
  535.     for(new i;i<15;++i)
  536.     {
  537.         SendClientMessageToAll(purple," ");
  538.     }
  539.     TextDrawHideForPlayer(playerid,Textdraw0);
  540.     TextDrawHideForPlayer(playerid,Textdraw1);
  541.     TextDrawHideForPlayer(playerid,Textdraw2);
  542. }
  543.  
  544.  
  545. public F_OnPlayerSelectedMenuRow(playerid, menuid, row)
  546. {
  547.         if(menuid == S1)
  548.         {
  549.                 switch(row)
  550.                 {
  551.                         case 0:
  552.                         {
  553.                         SendClientMessage(playerid,COLOR_WHITE,"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-");
  554.     SendClientMessage(playerid,LIGHTBLUES," /me, /report <id> <motivo>, /shop, /register, /login, /id");
  555.     SendClientMessage(playerid,LIGHTBLUES," /admins, /premiums, /regole, /paga, /suicidio, /stats <id> (se lasci bianco spuntano le tue)");
  556.     SendClientMessage(playerid,LIGHTBLUES," /pm <id>, /orologio, /resettastats, /richlist, /top5, /lotto, /minigames");
  557.     SendClientMessage(playerid,COLOR_WHITE,"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-");
  558.                                 TogglePlayerControllable(playerid, true);
  559.                         }
  560.                         case 1:
  561.                         {
  562.                             ShowPlayerDialog(playerid,1234,DIALOG_STYLE_MSGBOX,"Premium",""#CLIGHTBLUE" Comandi premium\n\n-pc\n-pshop","Ok","");
  563.                                 TogglePlayerControllable(playerid, true);
  564.                         }
  565.                 }
  566.         }
  567. }
Add Comment
Please, Sign In to add comment