Advertisement
Guest User

Call of Duty 2 Release

a guest
Jun 19th, 2013
529
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 31.82 KB | None | 0 0
  1. ////////////////////////////////////////////////////////////////////////////////
  2. // Name: Call of Duty 2 [COD2]                                                //
  3. // Author: Rapha3L, Hollywood/DJTunes, JJB562                                 //
  4. // Script Version: 0.1                                                        //
  5. // Last Update: Never                                                         //
  6. // Helpers: [_MS_]BodyBuilder, CaptainPrice                                   //
  7. // Thanks to: [_MS_]BodyBuilder                                               //
  8. // Info: This is a simple base to DM Servers. Check out the updates.          //
  9. // Notice: This is an edited version of Rapha3L's TDM script.                 //
  10. ////////////////////////////////////////////////////////////////////////////////
  11. // Updates                                                                    //
  12. // ||--- 6/17/2013 Updates ---||                                              //
  13. // - Added Login & Register System.                                           //
  14. // - Login & Register System bugged.                                          //
  15. // ||--- 6/18/2013 Updates ---||                                              //
  16. // - Login & Register System bug was fixed by JJB562                          //
  17. // - Added Welcome Messages to OnPlayerConnect                                //
  18. // - Added /help as a command.                                                //
  19. // - Added /info as a command.                                                //
  20. // - Added /credits as a command.                                             //
  21. // - Added /svrinfo as a command.                                             //
  22. // ||--- 6/19/2013 Updates ---||                                              //
  23. // - Added experience to each kill you get.                                   //
  24. // - Added an AFK system.                                                     //
  25. // - Edited the /help command with new commands.                              //
  26. // - When buying pack2, it takes away 1000$                                   //
  27. // - When buying frags, it takes away 1000$                                   //
  28. // - When buying a medical kit, it takes away 500$                            //
  29. // - Players no longer spawn with money. (money earned)                       //
  30. // - Added a new scripter.                                                    //
  31. // - Players now earn experience, and it saves as you log out.                //
  32. ////////////////////////////////////////////////////////////////////////////////
  33.  
  34. //---[Includes]---//
  35.  
  36. #include <a_samp>
  37. #include <sscanf2>
  38. #include <zcmd>
  39. #include <YSI\y_ini>
  40.  
  41. //---[Login Dialogs]---//
  42. #define DIALOG_REGISTER 1
  43. #define DIALOG_LOGIN 2
  44. #define DIALOG_SUCCESS_1 3
  45. #define DIALOG_SUCCESS_2 4
  46.  
  47. #define PATH "/Users/%s.ini"
  48.  
  49. //---[Colors---//
  50. #define COL_WHITE "{FFFFFF}"
  51. #define COL_RED "{F81414}"
  52. #define COL_GREEN "{00FF22}"
  53.  
  54. #define COLOR_GREY 0xAFAFAFAA
  55. #define COLOR_GREEN 0x33AA33AA
  56. #define COLOR_RED 0xFF0000
  57. #define COLOR_YELLOW 0xFFFF00AA
  58. #define COLOR_WHITE 0xFFFFFFAA
  59. #define COLOR_BLUE 0x0000BBAA
  60. #define COLOR_LIGHTBLUE 0x33CCFFAA
  61. #define COLOR_ORANGE 0xFF9900AA
  62. #define COLOR_LIME 0x10F441AA
  63. #define COLOR_MAGENTA 0xFF00FFFF
  64. #define COLOR_NAVY 0x000080AA
  65. #define COLOR_AQUA 0xF0F8FFAA
  66. #define COLOR_CRIMSON 0xDC143CAA
  67. #define COLOR_FLBLUE 0x6495EDAA
  68. #define COLOR_BISQUE 0xFFE4C4AA
  69. #define COLOR_BLACK 0x000000AA
  70. #define COLOR_CHARTREUSE 0x7FFF00AA
  71. #define COLOR_BROWN 0XA52A2AAA
  72. #define COLOR_CORAL 0xFF7F50AA
  73. #define COLOR_GOLD 0xB8860BAA
  74. #define COLOR_GREENYELLOW 0xADFF2FAA
  75. #define COLOR_INDIGO 0x4B00B0AA
  76. #define COLOR_IVORY 0xFFFF82AA
  77. #define COLOR_LAWNGREEN 0x7CFC00AA
  78. #define COLOR_SEAGREEN 0x20B2AAAA
  79. #define COLOR_LIMEGREEN 0x32CD32AA
  80. #define COLOR_MIDNIGHTBLUE 0X191970AA
  81. #define COLOR_MAROON 0x800000AA
  82. #define COLOR_OLIVE 0x808000AA
  83. #define COLOR_ORANGERED 0xFF4500AA
  84. #define COLOR_PINK 0xFFC0CBAA
  85. #define COLOR_SPRINGGREEN 0x00FF7FAA
  86. #define COLOR_TOMATO 0xFF6347AA
  87. #define COLOR_YELLOWGREEN 0x9ACD32AA
  88. #define COLOR_MEDIUMAQUA 0x83BFBFAA
  89. #define COLOR_MEDIUMMAGENTA 0x8B008BAA
  90.  
  91. //---[Login & Register System Variables]---//
  92.  
  93. enum pInfo
  94. {
  95.     pPass,
  96.     pCash,
  97.     pAdmin,
  98.     pKills,
  99.     pDeaths,
  100.     Xp
  101. }
  102. new PlayerInfo[MAX_PLAYERS][pInfo];
  103.  
  104. //---[Login & Register System Stocks]---//
  105.  
  106. stock UserPath(playerid)
  107. {
  108.     new string[128], playername[MAX_PLAYER_NAME];
  109.     GetPlayerName(playerid,playername,sizeof(playername));
  110.     format(string,sizeof(string),PATH,playername);
  111.     return string;
  112. }
  113. stock udb_hash(buf[]) {
  114.     new length=strlen(buf);
  115.     new s1 = 1;
  116.     new s2 = 0;
  117.     new n;
  118.     for (n=0; n<length; n++)
  119.     {
  120.        s1 = (s1 + buf[n]) % 65521;
  121.        s2 = (s2 + s1)     % 65521;
  122.     }
  123.     return (s2 << 16) + s1;
  124. }
  125.  
  126. //---[Login & Register System Functions]---//
  127.  
  128. forward LoadUser_data(playerid,name[],value[]);
  129. public LoadUser_data(playerid,name[],value[])
  130. {
  131.     INI_Int("Password",PlayerInfo[playerid][pPass]);
  132.     INI_Int("Cash",PlayerInfo[playerid][pCash]);
  133.     INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
  134.     INI_Int("Kills",PlayerInfo[playerid][pKills]);
  135.     INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
  136.     return 1;
  137. }
  138. //---[AFK System]---//
  139.  
  140. new pName[24]; //Setting up the variables.
  141. new afkstr[128]; //^^
  142. new pName2[24]; //^^
  143. new str2[128]; //^^
  144. new IsAFK[MAX_PLAYERS]; //^^
  145.  
  146. //---[Random Messages Settings (Settings)---//
  147.  
  148. new RandomMSG[][] =
  149. {
  150.     "Welcome to Call of Duty 2, scripted by Hollywood (DJTunes)!",
  151.     "The release of this script is posted on SA-MP forums.",
  152.     "Please be sure to add reputation to DJTunes!"
  153. };
  154.  
  155. //---[Random Messages Settings (Foward)]---//
  156.  
  157. forward SendMSG();
  158.  
  159. //---[Random Messages Settings (Settings)---//
  160. public SendMSG()
  161. {
  162.     new randMSG = random(sizeof(RandomMSG));
  163.     SendClientMessageToAll(COLOR_GREEN, RandomMSG[randMSG]);
  164. }
  165.  
  166. //---[Random Spawns]---//
  167.  
  168. new Float:RandomSpawns[][] =
  169. {
  170.     {-1513.3469,2536.8325,55.6875,46.0863},
  171.     {-1534.5206,2543.3533,55.8359,64.1873},
  172.     {-1537.3022,2560.8057,55.8359,9.9801},
  173.     {-1537.1564,2592.4919,55.8359,347.1066},
  174.     {-1552.3397,2600.5630,55.8359,36.6137},
  175.     {-1523.5328,2608.2029,55.8359,289.7661},
  176.     {-1489.5654,2607.8162,55.8359,291.6460},
  177.     {-1479.0426,2595.0493,55.8359,39.5787},
  178.     {-1460.0007,2619.5195,58.7734,152.6931},
  179.     {-1435.4955,2608.3745,55.8359,274.4125},
  180.     {-1420.5632,2613.4656,55.8359,146.4264},
  181.     {-1414.7498,2594.2373,55.8403,51.7988},
  182.     {-1458.2444,2641.4443,55.8359,38.4703},
  183.     {-1476.6389,2661.3892,55.8359,56.9571},
  184.     {-1507.6934,2663.9001,55.8359,81.7107},
  185.     {-1528.0374,2677.3118,55.8359,171.7108},
  186.     {-1562.5850,2662.7412,55.8359,349.1795},
  187.     {-1539.6945,2623.1128,55.8359,196.7286},
  188.     {-1513.9823,2594.6506,55.8359,279.3923}
  189. };
  190.  
  191. //---[Textdraw - Server Name]---//
  192.  
  193. new Text:Textdraw1;
  194.  
  195. //---[Server Configs + Objects & Skins]---//
  196.  
  197. public OnGameModeInit()
  198. {
  199.     SetTimer("SendMSG", 120000, true);
  200.     SetGameModeText("COD2");
  201.     SendRconCommand("mapname Downturn");
  202.     UsePlayerPedAnims();
  203.     DisableInteriorEnterExits();
  204.  
  205.     Textdraw1= TextDrawCreate(1.0, 433.0, "Call of Duty 2 v0.1");
  206.     TextDrawAlignment(Textdraw1,0);
  207.     TextDrawBackgroundColor(Textdraw1,0x000000ff);
  208.     TextDrawFont(Textdraw1,2);
  209.     TextDrawLetterSize(Textdraw1,0.2999, 1.4);
  210.     TextDrawBoxColor(Textdraw1,0x00000050);
  211.     TextDrawColor(Textdraw1,0xffffffff);
  212.     TextDrawSetOutline(Textdraw1,1);
  213.     TextDrawSetProportional(Textdraw1,1);
  214.     TextDrawSetShadow(Textdraw1,1);
  215.  
  216.     for(new i; i < MAX_PLAYERS; i ++)
  217.         {
  218.         if(IsPlayerConnected(i))
  219.                 {
  220.                 TextDrawShowForPlayer(i, Textdraw1);
  221.                 }
  222.         }
  223.  
  224. //---[Skins]---//
  225.  
  226.     AddPlayerClass(18, 1958.3783, 1343.1572, 15.3746, 269.1425, 24, 9999, 25, 9999, 34, 500);
  227.     AddPlayerClass(19, 1958.3783, 1343.1572, 15.3746, 269.1425, 24, 9999, 25, 9999, 34, 500);
  228.     AddPlayerClass(17, 1958.3783, 1343.1572, 15.3746, 269.1425, 24, 9999, 25, 9999, 34, 500);
  229.     AddPlayerClass(23, 1958.3783, 1343.1572, 15.3746, 269.1425, 24, 9999, 25, 9999, 34, 500);
  230.     AddPlayerClass(29, 1958.3783, 1343.1572, 15.3746, 269.1425, 24, 9999, 25, 9999, 34, 500);
  231.     AddPlayerClass(45, 1958.3783, 1343.1572, 15.3746, 269.1425, 24, 9999, 25, 9999, 34, 500);
  232.     AddPlayerClass(78, 1958.3783, 1343.1572, 15.3746, 269.1425, 24, 9999, 25, 9999, 34, 500);
  233.     AddPlayerClass(97, 1958.3783, 1343.1572, 15.3746, 269.1425, 24, 9999, 25, 9999, 34, 500);
  234.     AddPlayerClass(101, 1958.3783, 1343.1572, 15.3746, 269.1425, 24, 9999, 25, 9999, 34, 500);
  235.     AddPlayerClass(145, 1958.3783, 1343.1572, 15.3746, 269.1425, 24, 9999, 25, 9999, 34, 500);
  236.  
  237. //---[Cars]---//
  238.  
  239.     AddStaticVehicleEx(475,-1507.6999500,2526.6999500,55.6000000,0.0000000,-1,-1,15);
  240.     AddStaticVehicleEx(542,-1522.6999500,2526.6999500,55.6000000,0.0000000,-1,-1,15);
  241.     AddStaticVehicleEx(562,-1482.6999500,2560.3000500,55.6000000,50.0000000,-1,-1,15);
  242.     AddStaticVehicleEx(562,-1485.8000500,2545.6001000,55.6000000,203.9990000,-1,-1,15);
  243.     AddStaticVehicleEx(477,-1522.5000000,2588.5000000,55.7000000,0.0000000,-1,-1,15);
  244.     AddStaticVehicleEx(477,-1502.0999800,2635.3999000,55.7000000,196.0000000,-1,-1,15);
  245.     AddStaticVehicleEx(411,-1472.1999500,2691.0000000,55.6000000,0.0000000,-1,-1,15);
  246.     AddStaticVehicleEx(411,-1445.1999500,2682.5000000,55.6000000,124.0000000,-1,-1,15);
  247.     AddStaticVehicleEx(411,-1400.0000000,2653.1999500,55.5000000,87.9970000,-1,-1,15);
  248.     AddStaticVehicleEx(411,-1400.0000000,2638.1999500,55.5000000,87.9950000,-1,-1,15);
  249.     AddStaticVehicleEx(555,-1432.4000200,2591.8999000,55.6000000,0.0000000,-1,-1,15);
  250.     AddStaticVehicleEx(555,-1446.4000200,2589.0000000,55.6000000,0.0000000,-1,-1,15);
  251.     AddStaticVehicleEx(555,-1464.1999500,2589.3000500,55.6000000,0.0000000,-1,-1,15);
  252.     AddStaticVehicleEx(536,-1563.9000200,2687.8999000,55.5000000,0.0000000,-1,-1,15);
  253.     AddStaticVehicleEx(567,-1559.8000500,2693.6999500,55.8000000,0.0000000,-1,-1,15);
  254.     AddStaticVehicleEx(535,-1596.0999800,2692.6999500,54.8000000,0.0000000,-1,-1,15);
  255.     AddStaticVehicleEx(401,-1560.0999800,2632.8000500,55.7000000,0.0000000,-1,-1,15);
  256.     AddStaticVehicleEx(506,-1532.0000000,2641.8999000,55.6000000,60.0000000,-1,-1,15);
  257.     AddStaticVehicleEx(477,-1567.9000200,2640.3999000,55.7000000,290.0000000,-1,-1,15);
  258.  
  259. //---[Objects]---//
  260.  
  261.  
  262.  
  263. //---[Drift]---//
  264.  
  265.     AddStaticVehicleEx(411,-342.8999900,1515.5999800,75.2000000,0.0000000,-1,-1,15);
  266.     AddStaticVehicleEx(411,-339.7000100,1515.5000000,75.2000000,0.0000000,-1,-1,15);
  267.     AddStaticVehicleEx(560,-330.2000100,1515.3000500,75.2000000,0.0000000,-1,-1,15);
  268.     AddStaticVehicleEx(560,-333.2000100,1515.5000000,75.2000000,0.0000000,-1,-1,15);
  269.     AddStaticVehicleEx(411,-336.2999900,1514.8000500,75.2000000,0.0000000,-1,-1,15);
  270.     AddStaticVehicleEx(560,-327.3999900,1514.9000200,75.2000000,0.0000000,-1,-1,15);
  271.     AddStaticVehicleEx(562,-324.1000100,1515.4000200,75.1000000,0.0000000,-1,-1,15);
  272.     AddStaticVehicleEx(562,-321.1000100,1515.3000500,75.1000000,0.0000000,-1,-1,15);
  273.     AddStaticVehicleEx(562,-318.0000000,1514.9000200,75.1000000,0.0000000,-1,-1,15);
  274.     CreateObject(3749,-302.2999900,1510.0000000,80.2000000,0.0000000,0.0000000,0.0000000);
  275.     CreateObject(3516,-304.0000000,1511.6999500,77.6000000,0.0000000,0.0000000,192.0000000);
  276.  
  277. //---[Parkour]---//
  278.  
  279.     CreateObject(972,1531.47973600,-1359.22656300,328.45034800,0.00000000,0.00000000,0.00000000);
  280.     CreateObject(972,1550.99121100,-1359.23681600,328.45581100,0.00000000,0.00000000,0.00000000);
  281.     CreateObject(972,1542.70861800,-1365.28625500,328.15380900,0.00000000,0.00000000,-89.38141604);
  282.     CreateObject(974,1551.05700700,-1345.10205100,331.23623700,0.00000000,0.00000000,0.00000000);
  283.     CreateObject(974,1538.19177200,-1345.07312000,331.24121100,0.00000000,0.00000000,0.00000000);
  284.     CreateObject(978,1544.50683600,-1337.02807600,329.04757700,94.53809349,0.00000000,-88.52197935);
  285.     CreateObject(978,1544.70898400,-1345.88708500,327.34652700,-245.79883682,256.97151382,14.61042378);
  286.     CreateObject(978,1544.23742700,-1324.61401400,329.04776000,94.53809349,0.00000000,-88.52197935);
  287.     CreateObject(974,1544.29467800,-1316.17517100,328.01788300,91.95972612,0.00000000,0.00000000);
  288.     CreateObject(974,1544.08886700,-1307.95434600,326.07467700,91.95972612,0.00000000,0.00000000);
  289.     CreateObject(974,1544.86120600,-1299.68432600,328.92422500,91.95972612,0.00000000,0.00000000);
  290.     CreateObject(974,1553.25988800,-1299.90087900,330.80770900,91.95972612,0.00000000,0.00000000);
  291.     CreateObject(974,1560.94299300,-1300.69543500,328.54486100,91.95972612,0.00000000,0.00000000);
  292.     CreateObject(974,1564.03942900,-1299.92248500,331.32266200,183.91950953,0.00000000,-89.38141604);
  293.     CreateObject(974,1561.32983400,-1292.13647500,326.95224000,91.95972612,0.00000000,0.00000000);
  294.     CreateObject(974,1562.18335000,-1287.30468800,324.15411400,91.95972612,0.00000000,0.00000000);
  295.     CreateObject(3258,1559.69677700,-1287.83447300,322.73663300,118.60232089,0.00000000,-88.52197935);
  296.     CreateObject(3257,1555.85412600,-1255.20996100,276.35571300,0.00000000,0.00000000,0.00000000);
  297.     CreateObject(3287,1565.30419900,-1254.09912100,288.89392100,0.00000000,0.00000000,0.00000000);
  298.     CreateObject(3287,1571.85827600,-1254.17468300,288.93530300,0.00000000,0.00000000,0.00000000);
  299.     CreateObject(3502,1537.46252400,-1282.56335400,314.28128100,0.00000000,0.00000000,0.00000000);
  300.     CreateObject(3502,1538.06433100,-1274.25805700,313.83450300,-6.01605685,0.00000000,-7.73493023);
  301.     CreateObject(3502,1539.64648400,-1267.35376000,312.58728000,-12.03211370,0.00000000,-16.32929716);
  302.     CreateObject(3502,1541.58178700,-1256.78161600,307.05413800,-85.08423258,0.00000000,-16.32929716);
  303.     CreateObject(974,1541.15478500,-1254.38464400,311.65838600,91.95972612,0.00000000,0.00000000);
  304.     CreateObject(974,1541.23645000,-1262.01538100,310.14981100,91.95972612,0.00000000,0.00000000);
  305.     CreateObject(974,1546.33313000,-1258.03479000,310.41314700,91.95972612,0.00000000,0.00000000);
  306.     CreateObject(974,1536.39111300,-1257.45532200,310.30587800,91.95972612,0.00000000,11.17267701);
  307.     CreateObject(974,1540.46557600,-1255.21789600,298.40844700,91.95972612,0.00000000,3.43774677);
  308.     CreateObject(974,1544.44763200,-1255.29968300,298.42996200,91.95972612,0.00000000,-4.29718346);
  309.     CreateObject(3257,1585.73034700,-1253.02539100,272.12976100,0.00000000,0.00000000,-88.52197935);
  310.     CreateObject(3257,1585.98681600,-1261.29406700,272.13314800,0.00000000,0.00000000,-268.14419083);
  311.     CreateObject(3631,1594.14160200,-1257.08642600,286.86883500,0.00000000,0.00000000,1.71887339);
  312.     CreateObject(3631,1604.56164600,-1256.77233900,286.85174600,0.00000000,0.00000000,1.71887339);
  313.     CreateObject(3631,1615.55175800,-1256.58337400,286.85958900,0.00000000,0.00000000,1.71887339);
  314.     CreateObject(3636,1633.98425300,-1255.84838900,276.36599700,82.50592250,0.00000000,-1.71887339);
  315.     CreateObject(3636,1650.99963400,-1256.63537600,274.60452300,82.50592250,0.00000000,-1.71887339);
  316.     CreateObject(3636,1666.38598600,-1255.20495600,272.61486800,82.50592250,0.00000000,17.18873385);
  317.     CreateObject(3636,1681.09021000,-1248.78125000,273.70929000,82.50592250,0.00000000,27.50197417);
  318.     CreateObject(3636,1694.77307100,-1239.38745100,274.84780900,82.50592250,0.00000000,39.53408786);
  319.     CreateObject(6867,1714.95483400,-1178.67041000,297.15399200,0.00000000,0.00000000,-51.56620156);
  320.     CreateObject(974,1706.98413100,-1211.47265600,277.03076200,90.24085273,0.00000000,-49.84732818);
  321.     CreateObject(974,1701.03759800,-1204.87646500,276.81738300,90.24085273,0.00000000,-49.84732818);
  322.     CreateObject(974,1693.76635700,-1197.61450200,276.82901000,90.24085273,0.00000000,-49.84732818);
  323.     CreateObject(974,1702.92028800,-1178.17627000,279.18060300,90.24085273,0.00000000,-49.84732818);
  324.     CreateObject(974,1697.31506300,-1182.87817400,279.61947600,90.24085273,0.00000000,-49.84732818);
  325.     CreateObject(974,1690.98498500,-1185.70861800,280.65783700,90.24085273,0.00000000,-49.84732818);
  326.     CreateObject(974,1707.23571800,-1118.80554200,273.88061500,90.24085273,0.00000000,-49.84732818);
  327.     CreateObject(974,1711.80139200,-1115.36169400,276.67355300,90.24085273,0.00000000,-49.84732818);
  328.     CreateObject(974,1716.70105000,-1121.03784200,278.09811400,90.24085273,0.00000000,-49.84732818);
  329.     CreateObject(974,1722.69030800,-1124.65515100,279.08462500,90.24085273,0.00000000,-49.84732818);
  330.     CreateObject(974,1727.63134800,-1129.97741700,280.64492800,90.24085273,0.00000000,-49.84732818);
  331.     CreateObject(974,1732.61572300,-1125.55322300,282.77932700,90.24085273,0.00000000,-49.84732818);
  332.     CreateObject(974,1740.99438500,-1120.95617700,280.22213700,90.24085273,0.00000000,-49.84732818);
  333.     CreateObject(974,1744.08374000,-1121.66052200,281.85693400,183.06007284,0.00000000,39.53408786);
  334.     CreateObject(974,1779.22509800,-1161.04113800,280.83062700,268.14419083,0.00000000,39.53408786);
  335.     CreateObject(3330,1804.41137700,-1187.47509800,270.03402700,-31.79915763,0.00000000,37.81521448);
  336.     CreateObject(3330,1820.63317900,-1210.19104000,233.51001000,-55.00394833,0.00000000,37.81521448);
  337.     CreateObject(3411,1879.03271500,-1241.67932100,183.44625900,0.00000000,0.00000000,-53.28501765);
  338.     CreateObject(4550,1957.40417500,-1183.40344200,126.30550400,124.61832044,0.00000000,126.33730842);
  339.  
  340. //---[Biz 1 - Config]---//
  341.  
  342.     CreatePickup(1239, 1,-1519.2203,2609.5698,55.8359, 0);
  343.     Create3DTextLabel("Biz", COLOR_GREENYELLOW, -1519.1837,2609.2742,56.3359, 20, 0);
  344.     return 1;
  345. }
  346.  
  347. //---[Server Configs #2]---//
  348.  
  349. public OnGameModeExit()
  350. {
  351.     TextDrawHideForAll(Textdraw1);
  352.     TextDrawDestroy(Textdraw1);
  353.     return 1;
  354. }
  355.  
  356. public OnPlayerRequestClass(playerid, classid)
  357. {
  358.     SetPlayerPos(playerid, 2004.7404,1913.8379,40.3516);
  359.     SetPlayerFacingAngle(playerid,264.7556);
  360.     SetPlayerTime(playerid, 0,0);
  361.     InterpolateCameraPos(playerid,2013.6698,1913.9120,35.0304,2013.6698,1913.9120,35.0304+100,10000);
  362.     InterpolateCameraLookAt(playerid,2004.7404,1913.8379,40.3516,2004.7404,1913.8379,40.3516+50,10000);
  363.     return 1;
  364. }
  365.  
  366. //---[Server Opening]---//
  367.  
  368. public OnPlayerConnect(playerid)
  369. {
  370.     if(fexist(UserPath(playerid)))
  371.     {
  372.         INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  373.         ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit");
  374.     }
  375.     else
  376.     {
  377.         ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Type your password below to register a new account.","Register","Quit");
  378.     }
  379.  
  380.     new string[78], pnome[MAX_PLAYER_NAME];
  381.     GetPlayerName(playerid, pnome, sizeof(pnome));
  382.     format(string, sizeof(string), "{1E90FF}%s {006400}(ID:%d) {B22222}Connected to Call of Duty 2.", pnome, playerid);
  383.     SendClientMessageToAll(-1, string);
  384.     TextDrawShowForPlayer(playerid, Textdraw1);
  385.     PlayAudioStreamForPlayer(playerid, "http://rapha3l.comyr.com/eldm/songs/intro.mp3");
  386.  
  387.     IsAFK[playerid] = 0;
  388. //---[OnPlayerConnect Welcome Messages]---//
  389.  
  390.     SendClientMessage(playerid, COLOR_GREEN, "Welcome to Call of Duty 2... Login screen loading.");
  391.     SendClientMessage(playerid, COLOR_GREEN, "This script has been edited by DJTunes, and includes big updates.");
  392.     SendClientMessage(playerid, COLOR_YELLOW, "This script has been released on SA-MP forums by DJTunes.");
  393.     SendClientMessage(playerid, COLOR_YELLOW, "Please type /help for a list of commands, and information.");
  394.     return 1;
  395. }
  396.  
  397.  
  398. //---[Spawn]---//
  399.  
  400. public OnPlayerSpawn(playerid)
  401. {
  402.     GivePlayerWeapon(playerid,4,1);
  403.     GivePlayerWeapon(playerid,31,9999);
  404.     GivePlayerWeapon(playerid,1,0);
  405.     new Random = random(sizeof(RandomSpawns));
  406.     SetPlayerPos(playerid, RandomSpawns[Random][0], RandomSpawns[Random][1], RandomSpawns[Random][2]);
  407.     SetPlayerFacingAngle(playerid, RandomSpawns[Random][3]);
  408.     StopAudioStreamForPlayer(playerid);
  409.     return 1;
  410. }
  411.  
  412. //---[Leaving Server]---//
  413.  
  414. public OnPlayerDisconnect(playerid, reason)
  415. {
  416.     new INI:File = INI_Open(UserPath(playerid));
  417.     INI_SetTag(File,"data");
  418.     INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
  419.     INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
  420.     INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
  421.     INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
  422.     INI_WriteInt(File,"Experience",PlayerInfo[playerid][Xp]);
  423.     INI_Close(File);
  424.  
  425.     new
  426.         string[64],
  427.         playername[MAX_PLAYER_NAME];
  428.     GetPlayerName(playerid,playername,MAX_PLAYER_NAME);
  429.     switch(reason)
  430.     {
  431.         case 0: format(string,sizeof string,"{1E90FF}%s {006400}(ID:%d) {B22222}left the battle. {006400}(Timed out)",playername);
  432.         case 1: format(string,sizeof string,"{1E90FF}%s {006400}(ID:%d) {B22222}left the battle. {006400}(Leaving)",playername);
  433.         case 2: format(string,sizeof string,"{1E90FF}%s {006400}(ID:%d) {B22222}left the battle. {006400}(Kicked/Banned)",playername);
  434.     }
  435.     return 1;
  436. }
  437.  
  438. //---[Commands]---//
  439.  
  440. //---[Server Info]---//
  441.  
  442. CMD:svrinfo(playerid, params[])
  443. {
  444.     SendClientMessage(playerid, COLOR_GREEN, "{FFFFFF}-------------------[Server Info]-------------------");
  445.     SendClientMessage(playerid, COLOR_GREEN, "{DB881A}Notice:: {FFFFFF}This script is a basic edit from Rapha3Ls TDM.");
  446.     SendClientMessage(playerid, COLOR_GREEN, "{DB881A}Owner: {FFFFFF}DJTunes");
  447.     SendClientMessage(playerid, COLOR_GREEN, "{DB881A}Scripter: {FFFFFF}DJTunes, Rapha3L, JJB562");
  448.     SendClientMessage(playerid, COLOR_GREEN, "{DB881A}Mapper: {FFFFFF}Rapha3L");
  449.     SendClientMessage(playerid, COLOR_GREEN, "{DB881A}Website: {FFFFFF}http://mafiacity-rp.net/");
  450.     SendClientMessage(playerid, COLOR_GREEN, "{FFFFFF}-------------------[Server Info]-------------------");
  451.     return 1;
  452. }
  453.  
  454.  
  455. //---[Credits]---//
  456.  
  457. CMD:credits(playerid, params[])
  458. {
  459.     SendClientMessage(playerid, COLOR_GREEN, "{FFFFFF}-------------------[Credits]-------------------");
  460.     SendClientMessage(playerid, COLOR_GREEN, "{DB881A}Notice:: {FFFFFF}This script is a basic edit from Rapha3Ls TDM.");
  461.     SendClientMessage(playerid, COLOR_GREEN, "{DB881A}Scripter(s): {FFFFFF}DJTunes, Rapha3L, JJB562.");
  462.     SendClientMessage(playerid, COLOR_GREEN, "{DB881A}Script Mapper: {FFFFFF}Rapha3L");
  463.     SendClientMessage(playerid, COLOR_GREEN, "{FFFFFF}-------------------[Credits]-------------------");
  464.     return 1;
  465. }
  466.  
  467. //---[Information]---//
  468.  
  469. CMD:info(playerid, params[])
  470. {
  471.     SendClientMessage(playerid, COLOR_GREEN, "{FFFFFF}-------------------[Information]-------------------");
  472.     SendClientMessage(playerid, COLOR_GREEN, "{DB881A}Notice:: {FFFFFF}This script is a basic edit from Rapha3Ls TDM.");
  473.     SendClientMessage(playerid, COLOR_GREEN, "{DB881A}Script Started: {FFFFFF}6/17/2013");
  474.     SendClientMessage(playerid, COLOR_GREEN, "{DB881A}Script Status: {FFFFFF}Active");
  475.     SendClientMessage(playerid, COLOR_GREEN, "{DB881A}Script Maker: {FFFFFF}DJTunes");
  476.     SendClientMessage(playerid, COLOR_GREEN, "{DB881A}Script Mapper: {FFFFFF}Rapha3L");
  477.     SendClientMessage(playerid, COLOR_GREEN, "{FFFFFF}-------------------[Information]-------------------");
  478.     return 1;
  479. }
  480.  
  481. //---[Help]---//
  482.  
  483. CMD:help(playerid, params[])
  484. {
  485.     SendClientMessage(playerid, COLOR_GREEN, "{FFFFFF}-------------------[Help Commands]-------------------");
  486.     SendClientMessage(playerid, COLOR_GREEN, "{37DB45}[COD2 Help] {FFFFFF}Loading all server commands, please stand by...");
  487.     SendClientMessage(playerid, COLOR_WHITE, "{DB881A}[COD2 Map CMDs] {FFFFFF}/runw, /drift, /parkour");
  488.     SendClientMessage(playerid, COLOR_BLUE, "{1B1BE0}[COD2 Biz CMDs] {FFFFFF}/enter, /exit, /heal, /nadepack, /pack2");
  489.     SendClientMessage(playerid, COLOR_WHITE, "{37DB45}[COD2 General CMDs] {FFFFFF}/help, /info, /credits, /svrinfo");
  490.     SendClientMessage(playerid, COLOR_WHITE, "{37DB45}[COD2 General CMDs] {FFFFFF}/kill, /afk, /back, /afklist");
  491.     SendClientMessage(playerid, COLOR_GREEN, "{FFFFFF}-------------------[Help Commands]-------------------");
  492.     return 1;
  493. }
  494.  
  495. //---[Kill]---//
  496.  
  497. CMD:kill(playerid)
  498. {
  499.     SetPlayerHealth(playerid,0.0);
  500.     new str[78], pnome[MAX_PLAYER_NAME];
  501.     GetPlayerName(playerid, pnome, sizeof(pnome));
  502.     format(str, sizeof(str), "{1E90FF}%s {006400}(ID:%d) {B22222}has done suicide. {FFA54F}/kill.", pnome, playerid);
  503.     SendClientMessageToAll(-1, str);
  504.     return 1;
  505. }
  506.  
  507. //---[AFK System]---//
  508.  
  509. command(afk, playerid, params[])
  510. {
  511.     if(IsAFK[playerid] == 0)
  512.     {
  513.         TogglePlayerControllable(playerid,0);
  514.         GetPlayerName(playerid, pName, 24);
  515.         format(afkstr, 128, "%s has gone AFK! (Away from keyboard)", pName);
  516.         IsAFK[playerid] = 1;
  517.     }
  518.     else return SendClientMessage(playerid, COLOR_BLUE, "You are already AFK!");
  519.     return 1;
  520. }
  521.  
  522. command(back, playerid, params[])
  523. {
  524.     if(IsAFK[playerid] == 1)
  525.     {
  526.         TogglePlayerControllable(playerid,1);
  527.         GetPlayerName(playerid, pName2, 24);
  528.         format(str2, 128, "%s is now back from being AFK!", pName2);
  529.         SendClientMessageToAll(COLOR_BLUE, str2);
  530.         IsAFK[playerid] = 0;
  531.     }
  532.     else return SendClientMessage(playerid, COLOR_BLUE, "You aren't AFK!");
  533.     return 1;
  534. }
  535.  
  536. command(afklist, playerid, params)
  537. {
  538.         new pString[MAX_PLAYER_NAME], pName3[MAX_PLAYER_NAME];
  539.  
  540.         for(new pID = 0; pID < MAX_PLAYERS; pID ++)
  541.         {
  542.         if(IsPlayerConnected(pID))
  543.                 {
  544.                         if(IsAFK[pID] == 1)
  545.                         {
  546.                                 SendClientMessage(playerid, 0xFFFFFFFF, "Players currently AFK:");
  547.                                 GetPlayerName(playerid, pName3, sizeof(pName3));
  548.                                 format(pString, sizeof(pString), "%s", pName3);
  549.                                 SendClientMessage(playerid, 0xFFFFFFFF, pString);
  550. }
  551.         }
  552.                 }
  553.         return 1;
  554.                         }
  555.  
  556. //---[Run Weapons Arena]---//
  557.  
  558. CMD:runw(playerid)
  559. {
  560.     SetPlayerPos(playerid, 1373.8341, 2196.1016, 14.2495);
  561.     ResetPlayerWeapons(playerid);
  562.     GivePlayerWeapon(playerid,4,1);
  563.     GivePlayerWeapon(playerid,24,9999);
  564.     GivePlayerWeapon(playerid,26,9999);
  565.     GivePlayerWeapon(playerid,28,9999);
  566.     SetPlayerHealth(playerid, 100);
  567.     SetPlayerArmour(playerid, 100);
  568.     new str[78], pnome[MAX_PLAYER_NAME];
  569.     GetPlayerName(playerid, pnome, sizeof(pnome));
  570.     format(str, sizeof(str), "{1E90FF}%s {006400}(ID:%d) {B22222}Teleported to the Arena.", pnome, playerid);
  571.     SendClientMessageToAll(-1, str);
  572.     return 1;
  573. }
  574.  
  575. //---[Drift]---//
  576.  
  577. CMD:drift(playerid)
  578. {
  579.     SetPlayerPos(playerid, -303.8535,1532.6465,75.3594);
  580.     ResetPlayerWeapons(playerid);
  581.     new str[78], pnome[MAX_PLAYER_NAME];
  582.     GetPlayerName(playerid, pnome, sizeof(pnome));
  583.     format(str, sizeof(str), "{1E90FF}%s {006400}(ID:%d) {B22222}Teleported to the Drift Zone.", pnome, playerid);
  584.     SendClientMessageToAll(-1, str);
  585.     return 1;
  586. }
  587.  
  588. //---[Parkour]---//
  589.  
  590. CMD:parkour(playerid)
  591. {
  592.     SetPlayerPos(playerid,1544.9849,-1353.7681,329.4735);
  593.     new name[128];
  594.     new string[256];
  595.     GetPlayerName(playerid,name,128);
  596.     format(string, sizeof(string), "{1E90FF}%s {006400}(ID:%d) {B22222}Teleported to the Parkour Zone.",name);
  597.     SendClientMessageToAll(0x99FFFFAA, string);
  598.     SetPlayerInterior(playerid, 0);
  599.     PlayerPlaySound(playerid, 1054, 0.0, 0.0, 0.0);
  600.     return 1;
  601. }
  602.  
  603. //---[Biz Commands]---//
  604.  
  605. CMD:enter(playerid)
  606. {
  607.     if(IsPlayerInRangeOfPoint(playerid,5.0,-1519.2583,2608.9690,55.8359))
  608.     {
  609.     SetPlayerPos(playerid, 1118.8878,-10.2737,1002.0859);
  610.     SetPlayerInterior(playerid, 12);
  611.     }
  612.     return 1;
  613. }
  614.  
  615. CMD:exit(playerid)
  616. {
  617.     if(IsPlayerInRangeOfPoint(playerid,5.0,1118.8878,-10.2737,1002.0859))
  618.     {
  619.     SetPlayerPos(playerid, -1519.2583,2608.9690,55.8359);
  620.     SetPlayerInterior(playerid, 0);
  621.     }
  622.     return 1;
  623. }
  624.  
  625. CMD:heal(playerid)
  626. {
  627.     if(IsPlayerInRangeOfPoint(playerid,5.0,1118.8878,-10.2737,1002.0859))
  628.     {
  629.     GivePlayerMoney(playerid, -500);
  630.     SetPlayerHealth(playerid, 100);
  631.     SetPlayerArmour(playerid, 100);
  632.     new str[78], pnome[MAX_PLAYER_NAME];
  633.     GetPlayerName(playerid, pnome, sizeof(pnome));
  634.     format(str, sizeof(str), "{1E90FF}%s {006400}(ID:%d) {B22222}Bought a medical kit!", pnome, playerid);
  635.     SendClientMessageToAll(-1, str);
  636.     }
  637.     return 1;
  638. }
  639.  
  640. CMD:nadepack(playerid)
  641. {
  642.     if(IsPlayerInRangeOfPoint(playerid,5.0,1118.8878,-10.2737,1002.0859))
  643.     {
  644.     GivePlayerMoney(playerid, -1000);
  645.     GivePlayerWeapon(playerid,16,10);
  646.     new str[78], pnome[MAX_PLAYER_NAME];
  647.     GetPlayerName(playerid, pnome, sizeof(pnome));
  648.     format(str, sizeof(str), "{1E90FF}%s {006400}(ID:%d) {B22222}Bought 10 frags!", pnome, playerid);
  649.     SendClientMessageToAll(-1, str);
  650.     }
  651.     return 1;
  652. }
  653.  
  654. CMD:pack2(playerid)
  655. {
  656.     if(IsPlayerInRangeOfPoint(playerid,5.0,1118.8878,-10.2737,1002.0859))
  657.     {
  658.     GivePlayerMoney(playerid, -1000);
  659.     ResetPlayerWeapons(playerid);
  660.     GivePlayerWeapon(playerid,8,1);
  661.     GivePlayerWeapon(playerid,23,1000);
  662.     GivePlayerWeapon(playerid,27,1000);
  663.     GivePlayerWeapon(playerid,33,1000);
  664.     GivePlayerWeapon(playerid,29,1000);
  665.     new str[78], pnome[MAX_PLAYER_NAME];
  666.     GetPlayerName(playerid, pnome, sizeof(pnome));
  667.     format(str, sizeof(str), "{1E90FF}%s {006400}(ID:%d) {B22222}has bought Weapons Package 2!", pnome, playerid);
  668.     SendClientMessageToAll(-1, str);
  669.     }
  670.     return 1;
  671. }
  672.  
  673. //---[Death's]---//
  674.  
  675. public OnPlayerDeath(playerid, killerid, reason)
  676. {
  677.     PlayerInfo[killerid][pKills]++;
  678.     PlayerInfo[playerid][pDeaths]++;
  679.     PlayerInfo[killerid][Xp]+= 1;
  680.     GivePlayerMoney(killerid, 100);
  681.     GivePlayerMoney(playerid, -50);
  682.     SendDeathMessage(killerid, playerid, reason);
  683.     return 1;
  684. }
  685.  
  686. //---[Login & Register System OnDialogResponse]---//
  687. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  688. {
  689.     switch( dialogid )
  690.     {
  691.         case DIALOG_REGISTER:
  692.         {
  693.             if (!response) return Kick(playerid);
  694.             if(response)
  695.             {
  696.                 if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
  697.                 new INI:File = INI_Open(UserPath(playerid));
  698.                 INI_SetTag(File,"data");
  699.                 INI_WriteInt(File,"Password",udb_hash(inputtext));
  700.                 INI_WriteInt(File,"Cash",0);
  701.                 INI_WriteInt(File,"Admin",0);
  702.                 INI_WriteInt(File,"Kills",0);
  703.                 INI_WriteInt(File,"Deaths",0);
  704.                 INI_Close(File);
  705.  
  706.                 SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
  707.                 SpawnPlayer(playerid);
  708.                 ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Great! Your Y_INI system works perfectly. Relog to save your stats!","Ok","");
  709.             }
  710.         }
  711.  
  712.         case DIALOG_LOGIN:
  713.         {
  714.             if ( !response ) return Kick ( playerid );
  715.             if( response )
  716.             {
  717.                 if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
  718.                 {
  719.                     INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  720.                     GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
  721.                     ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
  722.                 }
  723.                 else
  724.                 {
  725.                     ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
  726.                 }
  727.                 return 1;
  728.             }
  729.         }
  730.     }
  731.     return 1;
  732. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement