Advertisement
ATzeGER_

SAMP Battlefield 3 Gamemode

Nov 9th, 2012
635
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 26.63 KB | None | 0 0
  1. #include <a_samp>
  2. #include <Dini>
  3.  
  4. #define DIALOG_REGISTER 1
  5. #define DIALOG_LOGIN 2
  6. #define DIALOG_TEAM 3
  7. #define DIALOG_CLASS 4
  8. #define DIALOG_PISTOL 5
  9. #define MAX_SPAWNED_VEHICLES 6
  10.  
  11. #define rot 0xFF0000FF
  12. #define gelb 0xFFFF00FF
  13.  
  14. forward newround();
  15. forward todeszeit();
  16. forward cooldown();
  17.  
  18. enum info
  19. {
  20.     logged,
  21.     pw,
  22.     deathtime,
  23.     tot,
  24.     team,
  25.     klasse,
  26.     pistol,
  27.     skin,
  28.     gadget,
  29.     c4,
  30.     c4car,
  31.     Float:x,
  32.     Float:y,
  33.     Float:z,
  34.     Float:za,
  35.     gun,
  36.     sgun,
  37.     lkills,
  38.     ltode,
  39.     kills,
  40.     tode,
  41.     lscore,
  42.     score,
  43.     spree,
  44.     longestspree,
  45.     medickills,
  46.     pionierkills,
  47.     versorgungkills,
  48.     sniperkills,
  49.     m4kills, //medic
  50.     mp5kills, //pionier
  51.     atkills, //pionier (Rakete)
  52.     shotgunkills, //versorgung
  53.     c4kills, //versorgung
  54.     riflekills, //sniper
  55.     admin
  56. }
  57.  
  58. new pInfo[MAX_PLAYERS][info];
  59. new USKills;
  60. new RUKills;
  61. new maxscore;
  62. new bestplayer[MAX_PLAYER_NAME];
  63. new bomb[MAX_SPAWNED_VEHICLES];
  64. new c4model[MAX_SPAWNED_VEHICLES];
  65.  
  66. new Text:wontxt;
  67. new Text:losttxt;
  68. new Text:ustxt;
  69. new Text:rutxt;
  70. new Text:besttxt;
  71. new Text:playertxt;
  72. new Text:killer[MAX_PLAYERS];
  73. new Text:respawn;
  74.  
  75. main()
  76. {
  77.     print("\n----------------------------------");
  78.     print(" BF3 Fighters Gamemode by ATzeGER_ loaded.");
  79.     print("----------------------------------\n");
  80. }
  81.  
  82. public OnGameModeInit()
  83. {
  84.     UsePlayerPedAnims();
  85.     DisableInteriorEnterExits();
  86.     EnableStuntBonusForAll(0);
  87.     ShowPlayerMarkers(0);
  88.     SetGameModeText("Battlefield 3 TDM");
  89.     AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  90.     SetWorldTime(6);
  91.     SetNameTagDrawDistance(25);
  92.     AddStaticVehicleEx(470,1014.4963,1066.9143,10.9955,11.5755,43,0,30); // ushmv1
  93.     AddStaticVehicleEx(470,981.2984,1080.7491,10.8112,311.0829,43,0,30); // ushmv2
  94.     AddStaticVehicleEx(470,1007.6874,1089.0450,10.8114,353.1354,43,0,30); // ushmv3
  95.     AddStaticVehicleEx(470,1876.4500,1179.4844,10.8224,180.7683,43,0,30); // ruhmv
  96.     AddStaticVehicleEx(470,1870.7285,1150.7804,10.8242,270.0080,43,0,30); // ruhmv2
  97.     AddStaticVehicleEx(470,1843.7463,1158.4912,10.8277,270.3376,43,0,30); // ruhmv3
  98.     SetTimer("todeszeit", 1000, true);
  99.    
  100.     // TD's
  101.     wontxt = TextDrawCreate(234.000000, 119.000000, "your team won!");
  102.     TextDrawBackgroundColor(wontxt, 255);
  103.     TextDrawFont(wontxt, 2);
  104.     TextDrawLetterSize(wontxt, 0.490000, 2.399999);
  105.     TextDrawColor(wontxt, 65535);
  106.     TextDrawSetOutline(wontxt, 1);
  107.     TextDrawSetProportional(wontxt, 1);
  108.  
  109.     losttxt = TextDrawCreate(234.000000, 119.000000, "your team lost!");
  110.     TextDrawBackgroundColor(losttxt, 255);
  111.     TextDrawFont(losttxt, 2);
  112.     TextDrawLetterSize(losttxt, 0.490000, 2.399999);
  113.     TextDrawColor(losttxt, -16776961);
  114.     TextDrawSetOutline(losttxt, 1);
  115.     TextDrawSetProportional(losttxt, 1);
  116.  
  117.     ustxt = TextDrawCreate(43.000000, 320.000000, "US MARINES");
  118.     TextDrawBackgroundColor(ustxt, 255);
  119.     TextDrawFont(ustxt, 3);
  120.     TextDrawLetterSize(ustxt, 0.470000, 1.600000);
  121.     TextDrawColor(ustxt, 65535);
  122.     TextDrawSetOutline(ustxt, 1);
  123.     TextDrawSetProportional(ustxt, 1);
  124.  
  125.     rutxt = TextDrawCreate(55.000000, 320.000000, "RU Army");
  126.     TextDrawBackgroundColor(rutxt, 255);
  127.     TextDrawFont(rutxt, 3);
  128.     TextDrawLetterSize(rutxt, 0.470000, 1.600000);
  129.     TextDrawColor(rutxt, -16776961);
  130.     TextDrawSetOutline(rutxt, 1);
  131.     TextDrawSetProportional(rutxt, 1);
  132.  
  133.     besttxt = TextDrawCreate(279.000000, 140.000000, "best player:");
  134.     TextDrawBackgroundColor(besttxt, 255);
  135.     TextDrawFont(besttxt, 2);
  136.     TextDrawLetterSize(besttxt, 0.310000, 1.700000);
  137.     TextDrawColor(besttxt, 673775615);
  138.     TextDrawSetOutline(besttxt, 0);
  139.     TextDrawSetProportional(besttxt, 1);
  140.     TextDrawSetShadow(besttxt, 1);
  141.  
  142.     playertxt = TextDrawCreate(323.000000, 153.000000, "playername");
  143.     TextDrawAlignment(playertxt, 2);
  144.     TextDrawBackgroundColor(playertxt, 255);
  145.     TextDrawFont(playertxt, 2);
  146.     TextDrawLetterSize(playertxt, 0.310000, 1.700000);
  147.     TextDrawColor(playertxt, 673775615);
  148.     TextDrawSetOutline(playertxt, 0);
  149.     TextDrawSetProportional(playertxt, 1);
  150.     TextDrawSetShadow(playertxt, 1);
  151.    
  152.     respawn = TextDrawCreate(320.000000, 410.000000, "press '~k~~VEHICLE_ENTER_EXIT~' to respawn");
  153.     TextDrawAlignment(respawn, 2);
  154.     TextDrawBackgroundColor(respawn, 255);
  155.     TextDrawFont(respawn, 3);
  156.     TextDrawLetterSize(respawn, 0.450000, 1.800000);
  157.     TextDrawColor(respawn, -65281);
  158.     TextDrawSetOutline(respawn, 1);
  159.     TextDrawSetProportional(respawn, 1);
  160.     //
  161.     return 1;
  162. }
  163.  
  164. public OnGameModeExit()
  165. {
  166.     return 1;
  167. }
  168.  
  169. public OnPlayerRequestClass(playerid, classid)
  170. {
  171.     SetPlayerCameraPos(playerid, 1494.4502, 794.5917, 99.0343);
  172.     SetPlayerCameraLookAt(playerid, 1494.6826, 795.5670, 98.4995);
  173.     if(pInfo[playerid][logged] == 0) { ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Use your password to log in:", "OK", ""); }
  174.     else
  175.     {
  176.         ShowPlayerDialog(playerid, DIALOG_TEAM, DIALOG_STYLE_MSGBOX, "Select Team", "Select your Team:", "US Marines", "RU Army");
  177.     }
  178.     return 1;
  179. }
  180.  
  181. public OnPlayerConnect(playerid)
  182. {
  183.     killer[playerid] = TextDrawCreate(317.000000, 380.000000, "spielername");
  184.     pInfo[playerid][lscore] = 0;
  185.     TextDrawAlignment(killer[playerid],2);
  186.     TextDrawBackgroundColor(killer[playerid], 255);
  187.     TextDrawFont(killer[playerid], 2);
  188.     TextDrawLetterSize(killer[playerid], 0.340000, 2.700000);
  189.     TextDrawColor(killer[playerid], -16776961);
  190.     TextDrawSetOutline(killer[playerid], 1);
  191.     TextDrawSetProportional(killer[playerid], 1);
  192.     new path[100];
  193.     format(path, sizeof(path), "/account/%s", GetName(playerid));
  194.     if(!dini_Exists(path))
  195.     {
  196.         SendClientMessage(playerid, gelb,"|_______-> Welcome at Battlefield 3 <-_______|");
  197.         SendClientMessage(playerid, gelb,"You don't have an account. Please register.");
  198.         ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Register","Choose a password:","OK","");
  199.     }
  200.     else if(dini_Exists(path))
  201.     {
  202.         SendClientMessage(playerid, gelb,"|_______-> Welcome at Battlefield 3 <-_______|");
  203.         SendClientMessage(playerid, gelb,"Your account is registered. Please log in.");
  204.         ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Use your password to log in:", "OK", "");
  205.     }
  206.     SetPlayerSkillLevel(playerid, 0, 1);
  207.     return 1;
  208. }
  209.  
  210. public OnPlayerDisconnect(playerid, reason)
  211. {
  212.     if(pInfo[playerid][logged] == 1)
  213.     {
  214.         saveacc(playerid);
  215.         SendDeathMessage(INVALID_PLAYER_ID, playerid, 201);
  216.     }
  217.     return 1;
  218. }
  219.  
  220. public OnPlayerSpawn(playerid)
  221. {
  222.     TogglePlayerControllable(playerid, 1);
  223.     TextDrawHideForPlayer(playerid, killer[playerid]);
  224.     TextDrawHideForPlayer(playerid, respawn);
  225.     SetPlayerHealth(playerid, 100);
  226.     pInfo[playerid][gadget] = 5;
  227.     return 1;
  228. }
  229.  
  230. public OnPlayerDeath(playerid, killerid, reason)
  231. {
  232.     SendDeathMessage(killerid, playerid, reason);
  233.     if(killerid != INVALID_PLAYER_ID)
  234.     {
  235.         new strg[MAX_PLAYER_NAME];
  236.         format(strg, sizeof(strg), "%s", GetName(killerid));
  237.         TextDrawSetString(killer[playerid], strg);
  238.         TogglePlayerSpectating(playerid, 1);
  239.         PlayerSpectatePlayer(playerid, killerid, SPECTATE_MODE_NORMAL);
  240.     }
  241.     else if(killerid == INVALID_PLAYER_ID)
  242.     {
  243.         TextDrawSetString(killer[playerid], "SUICIDE");
  244.         SetPlayerPos(playerid, 1490, 790, 102);
  245.         SetPlayerCameraPos(playerid, 1494.4502, 794.5917, 99.0343);
  246.         SetPlayerCameraLookAt(playerid, 1494.6826, 795.5670, 98.4995);
  247.     }
  248.     TextDrawShowForPlayer(playerid, killer[playerid]);
  249.     pInfo[playerid][tode] +=1;
  250.     pInfo[playerid][ltode] +=1;
  251.     pInfo[killerid][lkills] +=1;
  252.     pInfo[killerid][kills] +=1;
  253.     pInfo[killerid][lscore] += 100;
  254.     pInfo[killerid][score] += 100;
  255.     SetPlayerScore(killerid, pInfo[killerid][lscore]);
  256.     pInfo[killerid][spree] += 1;
  257.     pInfo[playerid][tot] = 1;
  258.     pInfo[playerid][deathtime] = 10;
  259.     if(pInfo[playerid][spree] >= 3)
  260.     {
  261.         new str[125];
  262.         format(str, sizeof(str), "%s ended %s's killing spree of %i kills.", GetName(killerid), GetName(playerid), pInfo[playerid][spree]);
  263.         SendClientMessageToAll(rot, str);
  264.     }
  265.     if(pInfo[playerid][spree] > pInfo[playerid][longestspree])
  266.     {
  267.         pInfo[playerid][longestspree] = pInfo[playerid][spree];
  268.     }
  269.     pInfo[playerid][spree] = 0;
  270.     switch(pInfo[killerid][klasse])
  271.     {
  272.         case 0: { pInfo[killerid][medickills] += 1; }
  273.         case 1: { pInfo[killerid][pionierkills] += 1; }
  274.         case 2: { pInfo[killerid][versorgungkills] += 1; }
  275.         case 3: { pInfo[killerid][sniperkills] += 1; }
  276.     }
  277.     switch(GetPlayerWeapon(killerid))
  278.     {
  279.         case 31: { pInfo[killerid][m4kills] += 1; }
  280.         case 29: { pInfo[killerid][mp5kills] += 1; }
  281.         case 35: { pInfo[killerid][atkills] += 1; }
  282.         case 25: { pInfo[killerid][shotgunkills] += 1; }
  283.         case 34: { pInfo[killerid][riflekills] += 1; }
  284.     }
  285.     if(GetPlayerTeam(playerid) == 0)
  286.     {
  287.         USKills += 1;
  288.         if(USKills >= 200)
  289.         {
  290.             endround(0, 1);
  291.         }
  292.     }
  293.     else if(GetPlayerTeam(playerid) == 1)
  294.     {
  295.         RUKills += 1;
  296.         if(RUKills >= 200)
  297.         {
  298.             endround(1, 0);
  299.         }
  300.     }
  301.     return 1;
  302. }
  303.  
  304. public OnVehicleSpawn(vehicleid)
  305. {
  306.     return 1;
  307. }
  308.  
  309. public OnVehicleDeath(vehicleid, killerid)
  310. {
  311.     return 1;
  312. }
  313.  
  314. public OnPlayerText(playerid, text[])
  315. {
  316.  
  317.     return 0;
  318. }
  319.  
  320. public OnPlayerCommandText(playerid, cmdtext[])
  321. {
  322.     if(!strcmp("/carbomb", cmdtext, true))
  323.     {
  324.         if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && pInfo[playerid][c4car] == 0)
  325.         {
  326.             new vehid = GetPlayerVehicleID(playerid);
  327.             if(bomb[vehid] == 0)
  328.             {
  329.                 c4model[vehid] = CreateObject(1719, 0, 0, 0, 0, 0, 0, 250);
  330.                 AttachObjectToVehicle(c4model[vehid], vehid, 0, 0, 0.2, 0, 0, 0);
  331.                 pInfo[playerid][c4car] = vehid;
  332.                 bomb[vehid] = 1;
  333.             }
  334.         }
  335.         return 1;
  336.     }
  337.     if(!strcmp("/stats", cmdtext, true))
  338.     {
  339.         new stats1[120], stats2[120], stats3[120], stats4[120];
  340.         format(stats1, sizeof(stats1), "| Name: %s | Kills: %i | Deaths: %i | Score: %i |", GetName(playerid), pInfo[playerid][lkills], pInfo[playerid][ltode], pInfo[playerid][score]);
  341.         format(stats2, sizeof(stats2), "| Kills -> Assault: %i | Engineer: %i | Support: %i | Recon: %i |", pInfo[playerid][medickills], pInfo[playerid][pionierkills], pInfo[playerid][versorgungkills], pInfo[playerid][sniperkills]);
  342.         format(stats3, sizeof(stats3), "| Kills -> M4: %i | MP5: %i | RPG: %i | 870MCS: %i | L96: %i |", pInfo[playerid][m4kills], pInfo[playerid][mp5kills], pInfo[playerid][atkills], pInfo[playerid][shotgunkills], pInfo[playerid][riflekills]);
  343.         format(stats4, sizeof(stats4), "| Global -> Kills: %i | Deaths: %i | Score: %i | longest killing spree: %i | Adminlevel: %i |", pInfo[playerid][kills], pInfo[playerid][tode], pInfo[playerid][score], pInfo[playerid][longestspree], pInfo[playerid][admin]);
  344.         SendClientMessage(playerid, gelb, "|_______-> Battlefield 3 Stats <-_______|");
  345.         SendClientMessage(playerid, gelb, stats1);
  346.         SendClientMessage(playerid, gelb, stats2);
  347.         SendClientMessage(playerid, gelb, stats3);
  348.         SendClientMessage(playerid, gelb, stats4);
  349.         SendClientMessage(playerid, gelb, "|_______-> www.bf3fighters.com <-_______|");
  350.         return 1;
  351.     }
  352.     if(!strcmp("/admins", cmdtext, true, 6))
  353.     {
  354.         SendClientMessage(playerid, gelb, "|_______-> Battlefield 3 Admins <-_______|");
  355.         for(new i=0; i<MAX_PLAYERS; i++)
  356.         {
  357.             if(IsPlayerConnected(i))
  358.             {
  359.                 if(pInfo[i][admin] >= 1)
  360.                 {
  361.                     new adm[30];
  362.                     format(adm, sizeof(adm), "|--> %s", GetName(i));
  363.                     SendClientMessage(playerid, gelb, adm);
  364.                 }
  365.             }
  366.         }
  367.         return 1;
  368.     }
  369.     if(!strcmp("/gadgets", cmdtext, true))
  370.     {
  371.         SendClientMessage(playerid, gelb, "|_______-> Battlefield 3 Gadgets <-_______|");
  372.         SendClientMessage(playerid, gelb, "| Assault -> Medikit -> ~k~~CONVERSATION_YES~|");
  373.         SendClientMessage(playerid, gelb, "| Support -> C4 -> ~k~~CONVERSATION_YES~|");
  374.         SendClientMessage(playerid, gelb, "| Recon -> MAV -> ~k~~CONVERSATION_YES~|");
  375.         SendClientMessage(playerid, gelb, "|_______-> www.bf3fighters.com <-_______|");
  376.         return 1;
  377.     }
  378.     if(!strcmp("/change", cmdtext, true))
  379.     {
  380.         TogglePlayerControllable(playerid, 0);
  381.         SetPlayerPos(playerid, 1490, 790, 102);
  382.         SetPlayerCameraPos(playerid, 1494.4502, 794.5917, 99.0343);
  383.         SetPlayerCameraLookAt(playerid, 1494.6826, 795.5670, 98.4995);
  384.         ShowPlayerDialog(playerid, DIALOG_TEAM, DIALOG_STYLE_MSGBOX, "Select Team", "Select your Team:", "US Marines", "RU Army");
  385.         return 1;
  386.     }
  387.     if(!strcmp("/credits", cmdtext, true))
  388.     {
  389.         SendClientMessage(playerid, gelb, "|_______-> Battlefield 3 Credits <-_______|");
  390.         SendClientMessage(playerid, gelb, "| Scripting: ATzeGER_ | Mapping: ATzeGER_ |");
  391.         SendClientMessage(playerid, gelb, "| BETA testing: ATzeGER_ & Pacco |");
  392.         SendClientMessage(playerid, gelb, "| Server sponsored by 'server-free.de' |");
  393.         SendClientMessage(playerid, gelb, "|_______-> www.bf3fighters.com <-_______|");
  394.         return 1;
  395.     }
  396.     if (!strcmp("/help", cmdtext, true))
  397.     {
  398.         SendClientMessage(playerid, gelb, "|_______-> Battlefield 3 Help <-_______|");
  399.         SendClientMessage(playerid, gelb, "| statistics -> '/stats' | Credits -> '/credits' |");
  400.         SendClientMessage(playerid, gelb, "| list all available admins -> '/admins' |");
  401.         SendClientMessage(playerid, gelb, "| change team/class/pistol -> '/change' |");
  402.         SendClientMessage(playerid, gelb, "| Gadgethelp -> '/gadgets' |");
  403.         SendClientMessage(playerid, gelb, "|_______-> www.bf3fighters.com <-_______|");
  404.         return 1;
  405.     }
  406.     return SendClientMessage(playerid, rot, "This command does not exist.");
  407. }
  408.  
  409. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  410. {
  411.     return 1;
  412. }
  413.  
  414. public OnPlayerExitVehicle(playerid, vehicleid)
  415. {
  416.     return 1;
  417. }
  418.  
  419. public OnPlayerStateChange(playerid, newstate, oldstate)
  420. {
  421.     return 1;
  422. }
  423.  
  424. public OnPlayerEnterCheckpoint(playerid)
  425. {
  426.     return 1;
  427. }
  428.  
  429. public OnPlayerLeaveCheckpoint(playerid)
  430. {
  431.     return 1;
  432. }
  433.  
  434. public OnPlayerEnterRaceCheckpoint(playerid)
  435. {
  436.     return 1;
  437. }
  438.  
  439. public OnPlayerLeaveRaceCheckpoint(playerid)
  440. {
  441.     return 1;
  442. }
  443.  
  444. public OnRconCommand(cmd[])
  445. {
  446.     return 1;
  447. }
  448.  
  449. public OnPlayerRequestSpawn(playerid)
  450. {
  451.     return 1;
  452. }
  453.  
  454. public OnObjectMoved(objectid)
  455. {
  456.     return 1;
  457. }
  458.  
  459. public OnPlayerObjectMoved(playerid, objectid)
  460. {
  461.     return 1;
  462. }
  463.  
  464. public OnPlayerPickUpPickup(playerid, pickupid)
  465. {
  466.     return 1;
  467. }
  468.  
  469. public OnVehicleMod(playerid, vehicleid, componentid)
  470. {
  471.     new str[100];
  472.     format(str, sizeof(str), "%s has been banned. Reason: Tuning", GetName(playerid));
  473.     SendClientMessageToAll(rot, str);
  474.     return 1;
  475. }
  476.  
  477. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  478. {
  479.     return 1;
  480. }
  481.  
  482. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  483. {
  484.     return 1;
  485. }
  486.  
  487. public OnPlayerSelectedMenuRow(playerid, row)
  488. {
  489.     return 1;
  490. }
  491.  
  492. public OnPlayerExitedMenu(playerid)
  493. {
  494.     return 1;
  495. }
  496.  
  497. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  498. {
  499.     return 1;
  500. }
  501.  
  502. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  503. {
  504.     if(newkeys & KEY_FIRE)
  505.     {
  506.         if(pInfo[playerid][c4car] != 0)
  507.         {
  508.             new vehid = pInfo[playerid][c4car];
  509.             new Float:xx, Float:yy, Float:zz;
  510.             GetVehiclePos(pInfo[playerid][c4car], xx, yy, zz);
  511.             CreateExplosion(xx, yy, zz, 10, 35);
  512.             DestroyObject(c4model[vehid]);
  513.             pInfo[playerid][c4car] = 0;
  514.             bomb[vehid] = 0;
  515.         }
  516.     }
  517.     if(newkeys & KEY_SECONDARY_ATTACK)
  518.     {
  519.         if(pInfo[playerid][tot] == 1 && pInfo[playerid][deathtime] == 0)
  520.         {
  521.             SpawnPlayer(playerid);
  522.             pInfo[playerid][tot] = 0;
  523.             TogglePlayerSpectating(playerid, 0);
  524.         }
  525.     }
  526.     if(newkeys & KEY_NO)
  527.     {
  528.         new Float:xx, Float:yy, Float:zz;
  529.         GetObjectPos(pInfo[playerid][c4], xx, yy, zz);
  530.         CreateExplosion(xx, yy, zz, 10, 20);
  531.         DestroyObject(pInfo[playerid][c4]);
  532.     }
  533.     if(newkeys & KEY_YES)
  534.     {
  535.         if(pInfo[playerid][gadget] == 5 && pInfo[playerid][tot] == 0)
  536.         {
  537.             switch(pInfo[playerid][klasse])
  538.             {
  539.                 case 0:
  540.                 {
  541.                     SendClientMessage(playerid, gelb, "Medikit used.");
  542.                     new Float:xx, Float:yy, Float:zz;
  543.                     GetPlayerPos(playerid, xx, yy, zz);
  544.                     for(new i=0; i<MAX_PLAYERS; i++)
  545.                     {
  546.                         if(IsPlayerConnected(i) && IsPlayerInRangeOfPoint(i, 10, xx, yy, zz))
  547.                         {
  548.                             new Float:health;
  549.                             GetPlayerHealth(i, health);
  550.                             if(health <= 75)
  551.                             {
  552.                                 SetPlayerHealth(i, health+15);
  553.                                 new str[100];
  554.                                 format(str, sizeof(str), "You got healed by %s. (+15HP)", GetName(playerid));
  555.                                 SendClientMessage(i, gelb, str);
  556.                             }
  557.                         }
  558.                     }
  559.                 }
  560.                 case 2:
  561.                 {
  562.                     SendClientMessage(playerid, gelb, "C4 placed. Use ~k~~CONVERSATION_NO~ to defuse.");
  563.                     new Float:xx, Float:yy, Float:zz;
  564.                     GetPlayerPos(playerid, xx, yy, zz);
  565.                     pInfo[playerid][c4] = CreateObject(1719, xx, yy, zz, 0, 0, 0, 250);
  566.                 }
  567.                 case 3:
  568.                 {
  569.                     SendClientMessage(playerid, gelb, "MAV not available.");
  570.                 }
  571.             }
  572.         }
  573.         pInfo[playerid][gadget] = 0;
  574.     }
  575.     return 1;
  576. }
  577.  
  578. public OnRconLoginAttempt(ip[], password[], success)
  579. {
  580.     return 1;
  581. }
  582.  
  583. public OnPlayerUpdate(playerid)
  584. {
  585.     return 1;
  586. }
  587.  
  588. public OnPlayerStreamIn(playerid, forplayerid)
  589. {
  590.     return 1;
  591. }
  592.  
  593. public OnPlayerStreamOut(playerid, forplayerid)
  594. {
  595.     return 1;
  596. }
  597.  
  598. public OnVehicleStreamIn(vehicleid, forplayerid)
  599. {
  600.     return 1;
  601. }
  602.  
  603. public OnVehicleStreamOut(vehicleid, forplayerid)
  604. {
  605.     return 1;
  606. }
  607.  
  608. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  609. {
  610.     switch(dialogid)
  611.     {
  612.         case DIALOG_LOGIN:
  613.         {
  614.             if(response)
  615.             {
  616.                 new path[100];
  617.                 format(path, sizeof(path), "/account/%s", GetName(playerid));
  618.                 if(!strcmp(dini_Get(path, "Password"), inputtext, false))
  619.                 {
  620.                     pInfo[playerid][logged] = 1;
  621.                     SendClientMessage(playerid, gelb, "Logged in succesfully.");
  622.                     SendDeathMessage(INVALID_PLAYER_ID, playerid, 200);
  623.                     loadacc(playerid);
  624.                 }
  625.                 else { ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Use your password to log in.", "OK", ""); }
  626.             }
  627.             return 1;
  628.         }
  629.         case DIALOG_REGISTER:
  630.         {
  631.             if(response)
  632.             {
  633.                 if(strlen(inputtext) < 5)
  634.                 {
  635.                     SendClientMessage(playerid, rot, "[SERVER]: at least 5 characters !");
  636.                 }
  637.                 else
  638.                 {
  639.                     new path[100];
  640.                     format(path, sizeof(path), "/account/%s", GetName(playerid));
  641.                     dini_Create(path);
  642.                     dini_Set(path, "Password", inputtext);
  643.                     SendClientMessage(playerid, gelb, "Your account has been registered.");
  644.                     ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Use your password to log in.", "OK", "");
  645.                 }
  646.             }
  647.             return 1;
  648.         }
  649.         case DIALOG_TEAM:
  650.         {
  651.             if(response) // US
  652.             {
  653.                 setUS(playerid);
  654.             }
  655.             else if(!response) //RU
  656.             {
  657.                 setRU(playerid);
  658.             }
  659.             ShowPlayerDialog(playerid, DIALOG_CLASS, DIALOG_STYLE_LIST, "Choose Class", "Assault\nEngineer\nSupport\nRecon", "OK", "");
  660.         }
  661.         case DIALOG_CLASS:
  662.         {
  663.             switch(listitem)
  664.             {
  665.                 case 0: { pInfo[playerid][klasse] = 0; pInfo[playerid][gun] = 31; pInfo[playerid][sgun] = 0;} // Assault
  666.                 case 1: { pInfo[playerid][klasse] = 1; pInfo[playerid][gun] = 29; pInfo[playerid][sgun] = 35;} //Engineer
  667.                 case 2: { pInfo[playerid][klasse] = 2; pInfo[playerid][gun] = 25; pInfo[playerid][sgun] = 0;} //Support
  668.                 case 3: { pInfo[playerid][klasse] = 3; pInfo[playerid][gun] = 34; pInfo[playerid][sgun] = 0;} //Recon
  669.             }
  670.             ShowPlayerDialog(playerid, DIALOG_PISTOL, DIALOG_STYLE_LIST, "Handgun", "Desert Eagle\n9mm\n9mm (Suppressor)", "OK", "");
  671.         }
  672.         case DIALOG_PISTOL:
  673.         {
  674.             if(response)
  675.             {
  676.                 switch(listitem)
  677.                 {
  678.                     case 0: { pInfo[playerid][pistol] = 24; } // Deagle
  679.                     case 1: { pInfo[playerid][pistol] = 22; } // 9mm
  680.                     case 2: { pInfo[playerid][pistol] = 23; } // 9mm supp
  681.  
  682.                 }
  683.                 SetSpawnInfo(playerid, pInfo[playerid][team], pInfo[playerid][skin], pInfo[playerid][x], pInfo[playerid][y] , pInfo[playerid][z] , pInfo[playerid][za], pInfo[playerid][pistol], 200, pInfo[playerid][gun], 500, pInfo[playerid][sgun], 10);
  684.                 SpawnPlayer(playerid);
  685.             }
  686.         }
  687.     }
  688.     return 1;
  689. }
  690.  
  691. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  692. {
  693.     return 1;
  694. }
  695.  
  696. public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
  697. {
  698.     if(weaponid == 49)
  699.     {
  700.         SetPlayerHealth(playerid, 0);
  701.     }
  702.     if(weaponid == 34 || weaponid == 35)
  703.     {
  704.         SetPlayerHealth(playerid, 0);
  705.     }
  706.     else if(weaponid == 25)
  707.     {
  708.         new Float:health;
  709.         GetPlayerHealth(playerid, health);
  710.         SetPlayerHealth(playerid, health-75);
  711.     }
  712.     else if(weaponid == 24 || weaponid == 22 || weaponid == 23)
  713.     {
  714.         new Float:health;
  715.         GetPlayerHealth(playerid, health);
  716.         SetPlayerHealth(playerid, health-75);
  717.     }
  718.     return 1;
  719. }
  720.  
  721. public todeszeit()
  722. {
  723.     for(new p=0;p<MAX_PLAYERS;p++)
  724.     {
  725.         if(IsPlayerConnected(p))
  726.         {
  727.             if(pInfo[p][deathtime] > 0)
  728.             {
  729.                 pInfo[p][deathtime] -= 1;
  730.                 if(pInfo[p][deathtime] == 0)
  731.                 {
  732.                     TextDrawShowForPlayer(p, respawn);
  733.                 }
  734.             }
  735.             if(pInfo[p][gadget] < 5)
  736.             {
  737.                 pInfo[p][gadget] += 1;
  738.             }
  739.         }
  740.     }
  741.     return 1;
  742. }
  743.  
  744. public newround()
  745. {
  746.     for(new p=0; p<MAX_PLAYERS; p++)
  747.     {
  748.         if(IsPlayerConnected(p))
  749.         {
  750.             TextDrawHideForPlayer(p, wontxt);
  751.             TextDrawHideForPlayer(p, losttxt);
  752.             TextDrawHideForPlayer(p, besttxt);
  753.             TextDrawHideForPlayer(p, playertxt);
  754.             pInfo[p][lkills] = 0;
  755.             pInfo[p][ltode] = 0;
  756.             pInfo[p][lscore] = 0;
  757.             ShowPlayerDialog(p, DIALOG_TEAM, DIALOG_STYLE_MSGBOX, "Select Team", "Select your Team:", "US Marines", "RU Army");
  758.         }
  759.     }
  760.     maxscore = 0;
  761.     return 1;
  762. }
  763.  
  764. stock setUS(playerid)
  765. {
  766.     TextDrawHideForPlayer(playerid, rutxt);
  767.     TextDrawShowForPlayer(playerid, ustxt);
  768.     pInfo[playerid][team] = 0;
  769.     pInfo[playerid][skin] = 285;
  770.     pInfo[playerid][x] = 994.1722;
  771.     pInfo[playerid][y] = 1069.8273;
  772.     pInfo[playerid][z] = 10.8203;
  773.     pInfo[playerid][za] = 356.2719;
  774.     SetPlayerColor(playerid, 0x0000FFFF);
  775.     SetPlayerCameraPos(playerid, 970.4235, 1240.4116, 95.3527);
  776.     SetPlayerCameraLookAt(playerid, 970.9746, 1239.5732, 94.9179);
  777.     SetPlayerWorldBounds(playerid, 1797.439684947784 , 957.5556312257713, 1211.3680155903041, 864.6217242044718);
  778.     return 1;
  779. }
  780.  
  781. stock setRU(playerid)
  782. {
  783.     TextDrawHideForPlayer(playerid, ustxt);
  784.     TextDrawShowForPlayer(playerid, rutxt);
  785.     pInfo[playerid][team] = 1;
  786.     pInfo[playerid][skin] = 287;
  787.     pInfo[playerid][x] = 1894.6254;
  788.     pInfo[playerid][y] = 1180.1166;
  789.     pInfo[playerid][z] = 10.8281;
  790.     pInfo[playerid][za] = 139.5207;
  791.     SetPlayerColor(playerid, 0xFF0000FF);
  792.     SetPlayerCameraPos(playerid, 1784.3369, 1119.5081, 90.3900);
  793.     SetPlayerCameraLookAt(playerid, 1785.2416, 1119.9426, 89.6152);
  794.     SetPlayerWorldBounds(playerid, 1928.4216028496699, 1195.5227797803418, 1216.364031749908, 864.6217242044718);
  795.     return 1;
  796. }
  797.  
  798. stock endround(winner, looser)
  799. {
  800.     SetTimer("newround", 30000, false);
  801.     for(new p=0; p < MAX_PLAYERS; p++)
  802.     {
  803.         if(IsPlayerConnected(p))
  804.         {
  805.             TogglePlayerControllable(p, 0);
  806.             SetPlayerPos(p, 1490, 792, 100);
  807.             SetPlayerCameraPos(p, 1494.4502, 794.5917, 99.0343);
  808.             SetPlayerCameraLookAt(p, 1494.6826, 795.5670, 98.4995);
  809.             SendClientMessageToAll(rot, "Round finished.");
  810.             if(winner == pInfo[p][team])
  811.             {
  812.                 TextDrawShowForPlayer(p, wontxt);
  813.             }
  814.             else if(looser == pInfo[p][team])
  815.             {
  816.                 TextDrawShowForPlayer(p, losttxt);
  817.             }
  818.             TextDrawShowForPlayer(p, besttxt);
  819.             if(pInfo[p][score] > maxscore)
  820.             {
  821.                 maxscore = pInfo[p][score];
  822.                 format(bestplayer, sizeof(bestplayer), "%s", GetName(p));
  823.             }
  824.             TextDrawSetString(playertxt, bestplayer);
  825.             TextDrawShowForPlayer(p, playertxt);
  826.             //stats
  827.             new stats1[120], stats2[120], stats3[120], stats4[120];
  828.             format(stats1, sizeof(stats1), "| Name: %s | Kills: %i | Deaths: %i | Score: %i |", GetName(p), pInfo[p][lkills], pInfo[p][ltode], pInfo[p][score]);
  829.             format(stats2, sizeof(stats2), "| Kills -> Assault: %i | Engineer: %i | Support: %i | Recon: %i |", pInfo[p][medickills], pInfo[p][pionierkills], pInfo[p][versorgungkills], pInfo[p][sniperkills]);
  830.             format(stats3, sizeof(stats3), "| Kills -> M4: %i | MP5: %i | RPG: %i | 870MCS: %i | L96: %i |", pInfo[p][m4kills], pInfo[p][mp5kills], pInfo[p][atkills], pInfo[p][shotgunkills], pInfo[p][riflekills]);
  831.             format(stats4, sizeof(stats4), "| Global -> Kills: %i | Deaths: %i | Score: %i | longest killing spree: %i | Adminlevel: %i |", pInfo[p][kills], pInfo[p][tode], pInfo[p][score], pInfo[p][longestspree], pInfo[p][admin]);
  832.             SendClientMessage(p, gelb, "|_______-> Battlefield 3 Stats <-_______|");
  833.             SendClientMessage(p, gelb, stats1);
  834.             SendClientMessage(p, gelb, stats2);
  835.             SendClientMessage(p, gelb, stats3);
  836.             SendClientMessage(p, gelb, stats4);
  837.             SendClientMessage(p, gelb, "|_______-> www.bf3fighters.com <-_______|");
  838.         }
  839.     }
  840.     return 1;
  841. }
  842. stock loadacc(playerid)
  843. {
  844.     new path[100];
  845.     format(path, sizeof(path), "/account/%s", GetName(playerid));
  846.     pInfo[playerid][admin] = dini_Int(path, "Admin");
  847.     pInfo[playerid][kills] = dini_Int(path, "Kills");
  848.     pInfo[playerid][tode] = dini_Int(path, "Tode");
  849.     pInfo[playerid][score] = dini_Int(path, "Score");
  850.     pInfo[playerid][longestspree] = dini_Int(path, "longestspree");
  851.     pInfo[playerid][medickills] = dini_Int(path, "medickills");
  852.     pInfo[playerid][pionierkills] = dini_Int(path, "pionierkills");
  853.     pInfo[playerid][versorgungkills] = dini_Int(path, "versorgungkills");
  854.     pInfo[playerid][sniperkills] = dini_Int(path, "sniperkills");
  855.     pInfo[playerid][m4kills] = dini_Int(path, "m4kills");
  856.     pInfo[playerid][mp5kills] = dini_Int(path, "mp5kills");
  857.     pInfo[playerid][atkills] = dini_Int(path, "atkills");
  858.     pInfo[playerid][shotgunkills] = dini_Int(path, "shotgunkills");
  859.     pInfo[playerid][c4kills] = dini_Int(path, "c4kills");
  860.     pInfo[playerid][riflekills] = dini_Int(path, "riflekills");
  861. }
  862.  
  863. stock saveacc(playerid)
  864. {
  865.     if(pInfo[playerid][logged] == 1)
  866.     {
  867.         new path[100];
  868.         format(path, sizeof(path), "/account/%s", GetName(playerid));
  869.         dini_IntSet(path, "Admin", pInfo[playerid][admin]);
  870.         dini_IntSet(path, "Kills", pInfo[playerid][kills]);
  871.         dini_IntSet(path, "Tode", pInfo[playerid][tode]);
  872.         dini_IntSet(path, "Score", pInfo[playerid][score]);
  873.         dini_IntSet(path, "longestspree", pInfo[playerid][longestspree]);
  874.         dini_IntSet(path, "medickills", pInfo[playerid][medickills]);
  875.         dini_IntSet(path, "pionierkills", pInfo[playerid][pionierkills]);
  876.         dini_IntSet(path, "versorgungkills", pInfo[playerid][versorgungkills]);
  877.         dini_IntSet(path, "sniperkills", pInfo[playerid][sniperkills]);
  878.         dini_IntSet(path, "m4kills", pInfo[playerid][m4kills]);
  879.         dini_IntSet(path, "mp5kills", pInfo[playerid][mp5kills]);
  880.         dini_IntSet(path, "atkills", pInfo[playerid][atkills]);
  881.         dini_IntSet(path, "shotgunkills", pInfo[playerid][shotgunkills]);
  882.         dini_IntSet(path, "c4kills", pInfo[playerid][c4kills]);
  883.         dini_IntSet(path, "riflekills", pInfo[playerid][riflekills]);
  884.     }
  885.     return 1;
  886. }
  887.  
  888. stock GetName(playerid)
  889. {
  890.     new name[MAX_PLAYER_NAME];
  891.     GetPlayerName(playerid, name, MAX_PLAYER_NAME);
  892.     return name;
  893. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement