Advertisement
Guest User

Team Deadmtach - finelaq

a guest
Oct 22nd, 2013
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 21.11 KB | None | 0 0
  1. // This is a comment
  2. // This is a Team Deadmath gamemode.
  3. /*
  4.    Credits:
  5.    Login & Register System - Kushi
  6.    Gamemode - By me!
  7.    !!!! DO NOT REMOVE CREDITS plz !!!!
  8. */
  9.  
  10. #include <a_samp>
  11. #include <YSI\y_ini>
  12. #include <sscanf>
  13. #include <zcmd>
  14. #include <a_samp>
  15. #include <core>
  16. #include <float>
  17.  
  18. #pragma tabsize 0
  19.  
  20. // Dialogs:
  21. #define DIALOG_REGISTER 1
  22. #define DIALOG_LOGIN 2
  23. #define DIALOG_GUNSHOP 3
  24.  
  25. //Folder:
  26. #define FOLDER "Server Stats/Players/%s.ini"
  27.  
  28. //Colors:
  29. #define COLOR_RED 0xF21616FF
  30. #define COLOR_GREY 0xDBDBDBFF
  31. #define COLOR_YELLOW 0xF7EA31FF
  32. #define COLOR_GREEN 0x509E2CFF
  33. #define COL_WHITE "{FFFFFF}"
  34. #define COL_RED "{F81414}"
  35. #define COL_GREEN "{00FF22}"
  36. #define COL_LIGHTBLUE "{00CED1}"
  37. #define COLOR_BLUE 0x42E5EDFF
  38.  
  39. #define RUSSIAN 1
  40. #define ENGLISH 2
  41.  
  42. //Enums:
  43. enum pInfo
  44. {
  45.     pPass,
  46.     pCash,
  47.     pAdmin,
  48.     pKills,
  49.     pDeaths,
  50.     Score
  51. }
  52. new PlayerInfo[MAX_PLAYERS][pInfo];
  53. new Text:tdm;
  54.  
  55. public LoadUser_data(playerid,name[],value[])
  56. {
  57.     INI_Int("Password",PlayerInfo[playerid][pPass]);
  58.     INI_Int("Cash",PlayerInfo[playerid][pCash]);
  59.     INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
  60.     INI_Int("Kills",PlayerInfo[playerid][pKills]);
  61.     INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
  62.     INI_Int("Score",PlayerInfo[playerid][Score]);
  63.     return 1;
  64. }
  65.  
  66. // Forwards:
  67. forward LoadUser_data(playerid,name[],value[]);
  68.  
  69. main()
  70. {
  71.     print("\nTDM v0.1 Loaded...!");
  72.     print("Gamemode owner: finelaq");
  73.     print("Gamemode version: 0.1\n");
  74. }
  75.  
  76. public OnGameModeInit()
  77. {
  78.     SetGameModeText("TDM v0.1");
  79.     ShowPlayerMarkers(PLAYER_MARKERS_MODE_GLOBAL);
  80.     ShowNameTags(1);
  81.     SetNameTagDrawDistance(40.0);
  82.     EnableStuntBonusForAll(0);
  83.     DisableInteriorEnterExits();
  84.    
  85.     tdm = TextDrawCreate(340, 430, "Team Deadmatch");
  86.     TextDrawLetterSize(Text:tdm, 1, 1);
  87.     TextDrawColor(Text:tdm, -1439485014);
  88.     TextDrawUseBox(Text:tdm, 1);
  89.     TextDrawBoxColor(Text:tdm, -1347440726);
  90.     TextDrawBackgroundColor(Text:tdm, -1347440726);
  91.     TextDrawFont(Text:tdm, 1);
  92.    
  93.     AddPlayerClass(124, -632.3953,-1827.8872,26.1501,263.8289, 16, 5000, 24, 5000, 30, 5000);
  94.     AddPlayerClass(125, -632.3953,-1827.8872,26.1501,263.8289, 16, 5000, 24, 5000, 30, 5000);
  95.     AddPlayerClass(126, -632.3953,-1827.8872,26.1501,263.8289, 16, 5000, 24, 5000, 30, 5000);
  96.     AddPlayerClass(127, -632.3953,-1827.8872,26.1501,263.8289, 16, 5000, 24, 5000, 30, 5000);
  97.    
  98.    
  99.     AddPlayerClass(287,-806.8970,-2146.7820,23.6459,259.6623,16, 5000, 24, 5000, 31, 5000);
  100.     AddPlayerClass(289,-806.8970,-2146.7820,23.6459,259.6623,16, 5000, 24, 5000, 31, 5000);
  101.     AddPlayerClass(290,-806.8970,-2146.7820,23.6459,259.6623,16, 5000, 24, 5000, 31, 5000);
  102.     AddPlayerClass(291,-806.8970,-2146.7820,23.6459,259.6623,16, 5000, 24, 5000, 31, 5000);
  103.    
  104.     // Russians Cars
  105.     CreateVehicle(433,-666.9839,-1838.2065,20.9851,19.8234,43,0,50); // RUSsian Car
  106.     CreateVehicle(433,-662.4078,-1837.7744,21.7216,16.1306,43,0,50); // RUSsian Car 2
  107.     CreateVehicle(433,-658.4218,-1836.1825,22.6968,32.7560,43,0,50); // RUSsian Car 3
  108.     CreateVehicle(432,-635.4351,-1840.2036,23.3916,319.8014,43,0,50); // RUSsian Tank 1
  109.     // English Cars
  110.     CreateVehicle(432,-820.8715,-2195.9976,24.3344,22.4344,43,0,50); // english tnak
  111.     CreateVehicle(433,-837.4163,-2182.2271,24.5591,3.1204,43,0,50); // english car 1
  112.     CreateVehicle(433,-844.7979,-2180.7366,25.4523,30.3800,43,0,50); // english ccar 2
  113.     CreateVehicle(433,-852.4243,-2180.5713,26.0133,24.1338,43,0,50); // english ccar 3
  114.     return 1;
  115. }
  116.  
  117. public OnGameModeExit()
  118. {
  119.     return 1;
  120. }
  121.  
  122. public OnPlayerRequestClass(playerid, classid)
  123. {
  124.     switch ( classid )
  125.     {
  126.         case 0:
  127.         {
  128.             GameTextForPlayer( playerid, "~r~TEAM RUSSIANS", 300, 3 );
  129.             SetPlayerColor(playerid, COLOR_RED);
  130.             SetPlayerTeam(playerid, RUSSIAN);
  131.         }
  132.  
  133.         case 1:
  134.         {
  135.             GameTextForPlayer( playerid, "~r~TEAM RUSSIANS", 300, 3 );
  136.             SetPlayerColor(playerid, COLOR_RED);
  137.             SetPlayerTeam(playerid, RUSSIAN);
  138.         }
  139.  
  140.         case 2:
  141.         {
  142.             GameTextForPlayer( playerid, "~r~TEAM RUSSIANS", 300, 3 );
  143.             SetPlayerColor(playerid, COLOR_RED);
  144.             SetPlayerTeam(playerid, RUSSIAN);
  145.         }
  146.         case 3:
  147.         {
  148.             GameTextForPlayer( playerid, "~r~TEAM RUSSIANS", 300, 3 );
  149.             SetPlayerColor(playerid, COLOR_RED);
  150.             SetPlayerTeam(playerid, RUSSIAN);
  151.         }
  152.         case 4:
  153.         {
  154.             GameTextForPlayer( playerid, "~b~TEAM ENGLISH", 300, 3 );
  155.             SetPlayerColor(playerid, COLOR_BLUE);
  156.             SetPlayerTeam(playerid, ENGLISH);
  157.         }
  158.  
  159.         case 5:
  160.         {
  161.             GameTextForPlayer( playerid, "~b~TEAM ENGLISH", 300, 3 );
  162.             SetPlayerColor(playerid, COLOR_BLUE);
  163.             SetPlayerTeam(playerid, ENGLISH);
  164.         }
  165.  
  166.         case 6:
  167.         {
  168.             GameTextForPlayer( playerid, "~b~TEAM ENGLISH", 300, 3 );
  169.             SetPlayerColor(playerid, COLOR_BLUE);
  170.             SetPlayerTeam(playerid, ENGLISH);
  171.         }
  172.         case 7:
  173.         {
  174.             GameTextForPlayer( playerid, "~b~TEAM ENGLISH", 300, 3 );
  175.             SetPlayerColor(playerid, COLOR_BLUE);
  176.             SetPlayerTeam(playerid, ENGLISH);
  177.         }
  178.     }
  179.     SetPlayerPos(playerid, -672.4181,-2021.0236,24.0982);
  180.     SetPlayerFacingAngle(playerid,92.4747);
  181.     SetPlayerCameraPos(playerid, -681.2284,-2023.6765,23.5072);
  182.     SetPlayerCameraLookAt(playerid, -681.2284,-2023.6765,23.5072);
  183.     return 1;
  184. }
  185.  
  186. public OnPlayerConnect(playerid)
  187. {
  188.     new string[64], pName[MAX_PLAYER_NAME];
  189.     GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
  190.     format(string,sizeof string,"%s has connected server!",pName);
  191.     SendClientMessageToAll(0xFFFFFFAA,string);
  192.     TextDrawShowForPlayer(playerid,tdm);
  193.  
  194.     if(fexist(UserPath(playerid)))
  195.     {
  196.         INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  197.         ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"SERVER NAME",""COL_WHITE"Welcome back to TDM!,\n\nPlease type your account password:","Log-In","Quit");
  198.     }
  199.     else
  200.     {
  201.         ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"SERVER NAME",""COL_WHITE"Welcome to TDM!,\n\nPlease type your account password, to register:","Register","Quit");
  202.     }
  203.     return 1;
  204. }
  205.  
  206. public OnPlayerDisconnect(playerid, reason)
  207. {
  208.     new INI:File = INI_Open(UserPath(playerid));
  209.     INI_SetTag(File,"data");
  210.     INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
  211.     INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
  212.     INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
  213.     INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
  214.     INI_WriteInt(File,"Score",GetPlayerScore(playerid));
  215.     INI_Close(File);
  216.     TextDrawHideForPlayer(playerid,tdm);
  217.     new szString[64],name[MAX_PLAYER_NAME];
  218.     GetPlayerName(playerid, name, MAX_PLAYER_NAME);
  219.  
  220.     switch(reason)
  221.     {
  222.         case 0: format(szString, sizeof szString, "%s has left the server. (Crashed)", name);
  223.         case 1: format(szString, sizeof szString, "%s has left the server. (Left)", name);
  224.         case 2: format(szString, sizeof szString, "%s has left the server. (Kicked)", name);
  225.     }
  226.  
  227.     SendClientMessageToAll(0xC4C4C4FF, szString);
  228.     return 1;
  229. }
  230.  
  231. public OnPlayerSpawn(playerid)
  232. {
  233.     if(GetPlayerTeam(playerid) == RUSSIAN)
  234.     {
  235.         new string[64], pName[MAX_PLAYER_NAME];
  236.         GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
  237.         format(string,sizeof string,"%s has joined the team: RUSSIAN!",pName);
  238.         SendClientMessageToAll(COLOR_RED,string);
  239.     }
  240.     if(GetPlayerTeam(playerid) == ENGLISH)
  241.     {
  242.         new string[64], pName[MAX_PLAYER_NAME];
  243.         GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
  244.         format(string,sizeof string,"%s has joined the team: ENGLISH!",pName);
  245.         SendClientMessageToAll(COLOR_BLUE,string);
  246.     }
  247.     return 1;
  248. }
  249.  
  250. public OnPlayerDeath(playerid, killerid, reason)
  251. {
  252.     new cash;
  253.     new PlayerScore = GetPlayerScore(playerid);
  254.     if(killerid == INVALID_PLAYER_ID) {
  255.         ResetPlayerMoney(playerid);
  256.     } else {
  257.         cash = GetPlayerMoney(playerid);
  258.         if(cash > 0)  {
  259.             GivePlayerMoney(killerid, cash);
  260.             ResetPlayerMoney(playerid);
  261.         }
  262.     }
  263.     if ( killerid != INVALID_PLAYER_ID )
  264.     {
  265.         if ( GetPlayerTeam( killerid ) == GetPlayerTeam( playerid ) )
  266.         {
  267.             SetPlayerHealth( killerid, -1 );
  268.  
  269.             SendClientMessage( killerid, -1, "No teamkilling." );
  270.  
  271.             GivePlayerMoney( killerid, - 150000 );
  272.         }
  273.  
  274.         else
  275.         {
  276.             SendClientMessage( killerid, -1, "Nice shot!" );
  277.             SetPlayerScore(playerid,PlayerScore);
  278.         }
  279.     }
  280.  
  281.     SendDeathMessage(  killerid, playerid, reason );
  282.     PlayerInfo[playerid][pDeaths]++;
  283.     PlayerInfo[killerid][pKills]++;
  284.     return 1;
  285. }
  286.  
  287. public OnVehicleSpawn(vehicleid)
  288. {
  289.     return 1;
  290. }
  291.  
  292. public OnVehicleDeath(vehicleid, killerid)
  293. {
  294.     return 1;
  295. }
  296.  
  297. public OnPlayerText(playerid, text[])
  298. {
  299.     if(text[0] == ':')
  300.     {
  301.         new string[128];  GetPlayerName(playerid, string, sizeof(string));
  302.         format(string, sizeof(string), "[Team Radio] %s: %s", string, text[1]);
  303.         printf("%s", string);
  304.  
  305.         for(new i = 0; i < MAX_PLAYERS; i++)
  306.         {
  307.             if(IsPlayerConnected(i) && GetPlayerTeam(i) == GetPlayerTeam(playerid)) SendClientMessage(i, GetPlayerColor(playerid), string);
  308.         }
  309.         return 0;
  310.     }
  311.     return 1;
  312. }
  313.  
  314. public OnPlayerCommandText(playerid, cmdtext[])
  315. {
  316.     if (strcmp("/mycommand", cmdtext, true, 10) == 0)
  317.     {
  318.         // Do something here
  319.         return 1;
  320.     }
  321.     return 0;
  322. }
  323.  
  324. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  325. {
  326.     return 1;
  327. }
  328.  
  329. public OnPlayerExitVehicle(playerid, vehicleid)
  330. {
  331.     return 1;
  332. }
  333.  
  334. public OnPlayerStateChange(playerid, newstate, oldstate)
  335. {
  336.     return 1;
  337. }
  338.  
  339. public OnPlayerEnterCheckpoint(playerid)
  340. {
  341.     return 1;
  342. }
  343.  
  344. public OnPlayerLeaveCheckpoint(playerid)
  345. {
  346.     return 1;
  347. }
  348.  
  349. public OnPlayerEnterRaceCheckpoint(playerid)
  350. {
  351.     return 1;
  352. }
  353.  
  354. public OnPlayerLeaveRaceCheckpoint(playerid)
  355. {
  356.     return 1;
  357. }
  358.  
  359. public OnRconCommand(cmd[])
  360. {
  361.     return 1;
  362. }
  363.  
  364. public OnPlayerRequestSpawn(playerid)
  365. {
  366.     return 1;
  367. }
  368.  
  369. public OnObjectMoved(objectid)
  370. {
  371.     return 1;
  372. }
  373.  
  374. public OnPlayerObjectMoved(playerid, objectid)
  375. {
  376.     return 1;
  377. }
  378.  
  379. public OnPlayerPickUpPickup(playerid, pickupid)
  380. {
  381.     return 1;
  382. }
  383.  
  384. public OnVehicleMod(playerid, vehicleid, componentid)
  385. {
  386.     return 1;
  387. }
  388.  
  389. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  390. {
  391.     return 1;
  392. }
  393.  
  394. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  395. {
  396.     return 1;
  397. }
  398.  
  399. public OnPlayerSelectedMenuRow(playerid, row)
  400. {
  401.     return 1;
  402. }
  403.  
  404. public OnPlayerExitedMenu(playerid)
  405. {
  406.     return 1;
  407. }
  408.  
  409. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  410. {
  411.     return 1;
  412. }
  413.  
  414. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  415. {
  416.     return 1;
  417. }
  418.  
  419. public OnRconLoginAttempt(ip[], password[], success)
  420. {
  421.     return 1;
  422. }
  423.  
  424. public OnPlayerUpdate(playerid)
  425. {
  426.     return 1;
  427. }
  428.  
  429. public OnPlayerStreamIn(playerid, forplayerid)
  430. {
  431.     return 1;
  432. }
  433.  
  434. public OnPlayerStreamOut(playerid, forplayerid)
  435. {
  436.     return 1;
  437. }
  438.  
  439. public OnVehicleStreamIn(vehicleid, forplayerid)
  440. {
  441.     return 1;
  442. }
  443.  
  444. public OnVehicleStreamOut(vehicleid, forplayerid)
  445. {
  446.     return 1;
  447. }
  448.  
  449. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  450. {
  451.     switch( dialogid )
  452.     {
  453.         case DIALOG_GUNSHOP:
  454.         {
  455.              if(response)
  456.              {
  457.                  if(listitem == 0)
  458.                  {
  459.                      if(GetPlayerMoney(playerid) <500) return SendClientMessage(playerid,COLOR_RED, "You don't have the money!");
  460.                      SendClientMessage(playerid,COLOR_RED,"Thank you, for buying Knife!");
  461.                      GivePlayerWeapon(playerid,4,1);
  462.                      GivePlayerMoney(playerid,-500);
  463.                  }
  464.                  if(listitem == 1)
  465.                  {
  466.                      if(GetPlayerMoney(playerid) <1500) return SendClientMessage(playerid,COLOR_RED, "You don't have the money!");
  467.                      SendClientMessage(playerid,COLOR_RED,"Thank you, for buying Baseball bat!");
  468.                      GivePlayerWeapon(playerid,5,1);
  469.                      GivePlayerMoney(playerid,-1500);
  470.                  }
  471.                  if(listitem == 2)
  472.                  {
  473.                      if(GetPlayerMoney(playerid) <2500) return SendClientMessage(playerid,COLOR_RED, "You don't have the money!");
  474.                      SendClientMessage(playerid,COLOR_RED,"Thank you, for buying Grenade!");
  475.                      GivePlayerWeapon(playerid,16,5000);
  476.                      GivePlayerMoney(playerid,-2500);
  477.                  }
  478.                  if(listitem == 3)
  479.                  {
  480.                      if(GetPlayerMoney(playerid) <2500) return SendClientMessage(playerid,COLOR_RED, "You don't have the money!");
  481.                      SendClientMessage(playerid,COLOR_RED,"Thank you, for buying Tear Gas!");
  482.                      GivePlayerWeapon(playerid,17,5000);
  483.                      GivePlayerMoney(playerid,-2500);
  484.                  }
  485.                  if(listitem == 4)
  486.                  {
  487.                      if(GetPlayerMoney(playerid) <2500) return SendClientMessage(playerid,COLOR_RED, "You don't have the money!");
  488.                      SendClientMessage(playerid,COLOR_RED,"Thank you, for buying Molotov Cocktail!");
  489.                      GivePlayerWeapon(playerid,18,5000);
  490.                      GivePlayerMoney(playerid,-2500);
  491.                  }
  492.                  if(listitem == 5)
  493.                  {
  494.                      if(GetPlayerMoney(playerid) <3000) return SendClientMessage(playerid,COLOR_RED, "You don't have the money!");
  495.                      SendClientMessage(playerid,COLOR_RED,"Thank you, for buying 9mm!");
  496.                      GivePlayerWeapon(playerid,22,5000);
  497.                      GivePlayerMoney(playerid,-3000);
  498.                  }
  499.                  if(listitem == 6)
  500.                  {
  501.                      if(GetPlayerMoney(playerid) <5000) return SendClientMessage(playerid,COLOR_RED, "You don't have the money!");
  502.                      SendClientMessage(playerid,COLOR_RED,"Thank you, for buying Desert Eagle!");
  503.                      GivePlayerWeapon(playerid,24,5000);
  504.                      GivePlayerMoney(playerid,-5000);
  505.                  }
  506.                  if(listitem == 7)
  507.                  {
  508.                      if(GetPlayerMoney(playerid) <5000) return SendClientMessage(playerid,COLOR_RED, "You don't have the money!");
  509.                      SendClientMessage(playerid,COLOR_RED,"Thank you, for buying Shotgun!");
  510.                      GivePlayerWeapon(playerid,25,5000);
  511.                      GivePlayerMoney(playerid,-5000);
  512.                  }
  513.                  if(listitem == 8)
  514.                  {
  515.                      if(GetPlayerMoney(playerid) <5000) return SendClientMessage(playerid,COLOR_RED, "You don't have the money!");
  516.                      SendClientMessage(playerid,COLOR_RED,"Thank you, for buying Combat Shotgun!");
  517.                      GivePlayerWeapon(playerid,27,5000);
  518.                      GivePlayerMoney(playerid,-5000);
  519.                  }
  520.                  if(listitem == 9)
  521.                  {
  522.                      if(GetPlayerMoney(playerid) <2500) return SendClientMessage(playerid,COLOR_RED, "You don't have the money!");
  523.                      SendClientMessage(playerid,COLOR_RED,"Thank you, for buying MP5!");
  524.                      GivePlayerWeapon(playerid,29,5000);
  525.                      GivePlayerMoney(playerid,-2500);
  526.                  }
  527.                  if(listitem == 10)
  528.                  {
  529.                      if(GetPlayerMoney(playerid) <1000) return SendClientMessage(playerid,COLOR_RED, "You don't have the money!");
  530.                      SendClientMessage(playerid,COLOR_RED,"Thank you, for buying AK-47!");
  531.                      GivePlayerWeapon(playerid,30,5000);
  532.                      GivePlayerMoney(playerid,-1000);
  533.                  }
  534.                  if(listitem == 11)
  535.                  {
  536.                      if(GetPlayerMoney(playerid) <1000) return SendClientMessage(playerid,COLOR_RED, "You don't have the money!");
  537.                      SendClientMessage(playerid,COLOR_RED,"Thank you, for buying MP4!");
  538.                      GivePlayerWeapon(playerid,31,5000);
  539.                      GivePlayerMoney(playerid,-1000);
  540.                  }
  541.                  if(listitem == 12)
  542.                  {
  543.                      if(GetPlayerMoney(playerid) <10000) return SendClientMessage(playerid,COLOR_RED, "You don't have the money!");
  544.                      SendClientMessage(playerid,COLOR_RED,"Thank you, for buying RPG!");
  545.                      GivePlayerWeapon(playerid,35,7000);
  546.                      GivePlayerMoney(playerid,-10000);
  547.                  }
  548.              }
  549.         }
  550.         case DIALOG_REGISTER:
  551.         {
  552.             if (!response) return Kick(playerid);
  553.             if(response)
  554.             {
  555.                 if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"SERVER NAME",""COL_RED"Heres no password!\n"COL_WHITE"Try aigan! Type password to register account:","Register","Quit");               new INI:File = INI_Open(UserPath(playerid));
  556.                 INI_SetTag(File,"data");
  557.                 INI_WriteInt(File,"Password",udb_hash(inputtext));
  558.                 INI_WriteInt(File,"Cash",0);
  559.                 INI_WriteInt(File,"Admin",0);
  560.                 INI_WriteInt(File,"Kills",0);
  561.                 INI_WriteInt(File,"Deaths",0);
  562.                 INI_WriteInt(File,"Score",0);
  563.                 INI_Close(File);
  564.  
  565.                 SendClientMessage(playerid,COLOR_GREEN,"You are succesuly registred!");
  566.             }
  567.         }
  568.  
  569.         case DIALOG_LOGIN:
  570.         {
  571.             if ( !response ) return Kick ( playerid );
  572.             if( response )
  573.             {
  574.                 if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
  575.                 {
  576.                     INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  577.                     GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
  578.                     SetPlayerScore(playerid, PlayerInfo[playerid][Score]);
  579.                     SendClientMessage(playerid,COLOR_GREEN,"You are succesuly logged in!");
  580.                 }
  581.                 else
  582.                 {
  583.                     ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"SERVER NAME",""COL_RED"This is incorrect password.\n"COL_WHITE"Try aigan! Type your password:","log-In","Quit");
  584.                 }
  585.                 return 1;
  586.             }
  587.         }
  588.     }
  589.     return 1;
  590. }
  591.  
  592. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  593. {
  594.     return 1;
  595. }
  596.  
  597. COMMAND:gunshop(playerid, params[])
  598. {
  599.     ShowPlayerDialog(playerid, DIALOG_GUNSHOP, DIALOG_STYLE_LIST,"GUNSHOP 0.1","Gun 1: Knife 500$\nGun 2: Baseball Bat 1,500$\nGun 3: Grenade 2,500$\nGun 4: Tear Gas 2,500$\nGun 5: Molotov Cocktail 2,500$\nGun 6: 9mm 3,000$\nGun 7: Desert Eagle 5,000$\nGun 8: Shotgun 5,000$\nGun 9: Combat Shotgun 5,000$\nGun 10: MP5 2,500$\nGun 11: AK-47 1,000$\nGun 12: MP4 1,000$\nGun 13: RPG 10,000$\n\n\tMore Coming Soon!","Buy","Quit");
  600.     return 1;
  601. }
  602. CMD:kick(playerid, params[])
  603. {
  604.     new id, reason[128];
  605.     if(PlayerInfo[playerid][pAdmin] <= 1) return SendClientMessage(playerid, COLOR_GREY, "You don't have the rights!");
  606.     else if(sscanf(params, "us", id, reason))SendClientMessage(playerid, COLOR_GREY, "USE: /kick [Player ID] [Reason]");
  607.     else if (id==INVALID_PLAYER_ID)SendClientMessage(playerid,COLOR_GREY,"You can't kick bots!");
  608.     else {
  609.         new Name[MAX_PLAYER_NAME], KickMessage[128];
  610.         new Name2[MAX_PLAYER_NAME];
  611.         GetPlayerName(playerid, Name, sizeof(Name));
  612.         GetPlayerName(id, Name2, sizeof(Name2));
  613.         format(KickMessage, sizeof(KickMessage), "AdmCmd: Admin %s(%d) has kicked %s(%d) out of the server. Reason: %s", Name, playerid, Name2, id);
  614.         SendClientMessageToAll(COLOR_RED, KickMessage);
  615.         Kick(id);
  616.     }
  617.     return 1;
  618. }
  619.  
  620. CMD:ban(playerid, params[])
  621. {
  622.     new id, reason[128];
  623.     if(PlayerInfo[playerid][pAdmin] <= 1) return SendClientMessage(playerid, COLOR_GREY, "You don't have the rights!");
  624.     else if(sscanf(params, "us", id, reason))SendClientMessage(playerid, COLOR_GREY, "USE: /ban [Player ID] [Reason]");
  625.     else if (id==INVALID_PLAYER_ID)SendClientMessage(playerid,COLOR_GREY,"You can't ban bots");
  626.     else {
  627.         new Name[MAX_PLAYER_NAME], KickMessage[128];
  628.         new Name2[MAX_PLAYER_NAME];
  629.         GetPlayerName(playerid, Name, sizeof(Name));
  630.         GetPlayerName(id, Name2, sizeof(Name2));
  631.         format(KickMessage, sizeof(KickMessage), "AdmCmd: Admin %s(%d) blocked the %s(%d) account. Reason: %s", Name, playerid, Name2, id);
  632.         SendClientMessageToAll(COLOR_RED, KickMessage);
  633.         Ban(id);
  634.     }
  635.     return 1;
  636. }
  637. COMMAND:givecash(playerid, params[])
  638. {
  639.     new player, amount,name1[24], name2[24], string[128];
  640.     if(!sscanf(params, "ui",player,amount))
  641.     {
  642.         GetPlayerName(playerid, name1, 24);
  643.         GetPlayerName(player, name2, 24);
  644.         format(string, sizeof(string), "You gaved $%d to %s.",amount,name2);
  645.         SendClientMessage(playerid, 0xFFFF00FF, string);
  646.         format(string, sizeof(string), "AdmCmd: Admin %s gave you $%d!", name1, amount);
  647.         SendClientMessage(player, 0xFFFF00FF, string);
  648.         GivePlayerMoney(player, amount);
  649.     }
  650.     else return SendClientMessage(playerid, 0xFFFFFFFF,"Usage: /givecash [Player ID][Amount]");
  651.     return 1;
  652. }
  653.  
  654.  
  655. stock UserPath(playerid)
  656. {
  657.     new string[128],playername[MAX_PLAYER_NAME];
  658.     GetPlayerName(playerid,playername,sizeof(playername));
  659.     format(string,sizeof(string),FOLDER,playername);
  660.     return string;
  661. }
  662.  
  663. stock udb_hash(buf[]) {
  664.     new length=strlen(buf);
  665.     new s1 = 1;
  666.     new s2 = 0;
  667.     new n;
  668.     for (n=0; n<length; n++)
  669.     {
  670.        s1 = (s1 + buf[n]) % 65521;
  671.        s2 = (s2 + s1)     % 65521;
  672.     }
  673.     return (s2 << 16) + s1;
  674. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement