Advertisement
Guest User

Notime

a guest
Jan 8th, 2010
4,197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 51.42 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. #define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
  4. #define RED         0xE60000FF
  5. #define GREEN       0x21DD00FF
  6. #define COLOR_YELLOW 0xFFFF00AA
  7.  
  8. new PlayerDualWatching[MAX_PLAYERS];
  9. new InventationSent[MAX_PLAYERS];
  10. new Inventation[MAX_PLAYERS];
  11. new DualRoom1price;
  12. new DualRoom1;
  13. new DualRoom2price;
  14. new DualRoom2;
  15. new DualRoom3price;
  16. new DualRoom3;
  17. new DualRoom4price;
  18. new DualRoom4;
  19. new WeaponDualRoom1;
  20. new WeaponDualRoom2;
  21. new WeaponDualRoom3;
  22. new WeaponDualRoom4;
  23. new InDual[MAX_PLAYERS];
  24. new Inventationprice[MAX_PLAYERS];
  25. forward inventationremove(playerid);
  26. forward CountDown(playerid, seconds);
  27.  
  28. public CountDown(playerid, seconds)
  29. {
  30.     new string[256];
  31.     if(seconds > 0)
  32.     {
  33.         new Float:X, Float:Y, Float:Z;
  34.         GetPlayerPos(playerid, X, Y, Z);
  35.         PlayerPlaySound(playerid, 1056, X, Y, Z);
  36.         format(string, sizeof(string), "~R~%d", seconds);
  37.         GameTextForPlayer(playerid, string, 1000, 3);
  38.         seconds = seconds -1;
  39.         SetTimerEx("CountDown", 1000, 0, "ii", playerid, seconds);
  40.         return 1;
  41.     }
  42.     if(seconds == 0)
  43.     {
  44.         new Float:X, Float:Y, Float:Z;
  45.         GetPlayerPos(playerid, X, Y, Z);
  46.         PlayerPlaySound(playerid, 1057, X, Y, Z);
  47.         GameTextForPlayer(playerid, "~G~Start!!!", 1000, 3);
  48.         TogglePlayerControllable(playerid, 1);
  49.         return 1;
  50.     }
  51.     return 1;
  52. }
  53.  
  54. public inventationremove(playerid)
  55. {
  56.     if(InDual[playerid] == 0)
  57.     {
  58.         SendClientMessage(playerid, RED, "30 seconds passed after your duel inventation without a response");
  59.         SendClientMessage(InventationSent[playerid], RED, "30 seconds passed after your dual inventation without a response");
  60.         Inventation[InventationSent[playerid]] = -1;
  61.         InventationSent[playerid] = -1;
  62.         if(DualRoom1 == playerid)
  63.         {
  64.             DualRoom1 = -1;
  65.         }
  66.         if(DualRoom2 == playerid)
  67.         {
  68.             DualRoom2 = -1;
  69.         }
  70.         if(DualRoom3 == playerid)
  71.         {
  72.             DualRoom3 = -1;
  73.         }
  74.         if(DualRoom3 == playerid)
  75.         {
  76.             DualRoom4 = -1;
  77.         }
  78.         return 1;
  79.     }
  80.     return 1;
  81. }
  82.  
  83. public OnFilterScriptInit()
  84. {
  85.     print("\n--------------------------------------");
  86.     print("Notime Duel system");
  87.     print("--------------------------------------\n");
  88.    
  89.     DualRoom1 = -1;
  90.     DualRoom2 = -1;
  91.     DualRoom3 = -1;
  92.     DualRoom4 = -1;
  93.    
  94.     CreateObject(3095, 1745.2294921875, -2835.8447265625, 5, 0, 0, 0);
  95.     CreateObject(3095, 1736.2451171875, -2835.8447265625, 5, 0, 0, 0);
  96.     CreateObject(3095, 1745.2294921875, -2844.833984375, 5, 0, 0, 0);
  97.     CreateObject(3095, 1736.2451171875, -2844.833984375, 5, 0, 0, 0);
  98.     CreateObject(3095, 1745.2294921875, -2853.8239746094, 5, 0, 0, 0);
  99.     CreateObject(3095, 1736.2451171875, -2853.8239746094, 5, 0, 0, 0);
  100.     CreateObject(3095, 1727.2551269531, -2835.8447265625, 5, 0, 0, 0);
  101.     CreateObject(3095, 1727.2551269531, -2844.833984375, 5, 0, 0, 0);
  102.     CreateObject(3095, 1727.2551269531, -2853.8232421875, 5, 0, 0, 0);
  103.     CreateObject(3095, 1745.2294921875, -2862.8132324219, 5, 0, 0, 0);
  104.     CreateObject(3095, 1736.2451171875, -2862.8132324219, 5, 0, 0, 0);
  105.     CreateObject(3095, 1727.2548828125, -2862.8132324219, 5, 0, 0, 0);
  106.     CreateObject(3095, 1718.2648925781, -2835.8447265625, 5, 0, 0, 0);
  107.     CreateObject(3095, 1718.2648925781, -2844.833984375, 5, 0, 0, 0);
  108.     CreateObject(3095, 1718.2648925781, -2853.8232421875, 5, 0, 0, 0);
  109.     CreateObject(3095, 1718.2648925781, -2862.8125, 5, 0, 0, 0);
  110.     CreateObject(3401, 1742.7684326172, -2859.9912109375, 7.9004049301147, 0, 0, 0);
  111.     CreateObject(994, 1742.6313476563, -2852.4506835938, 5.5881395339966, 0, 0, 0);
  112.     CreateObject(994, 1736.0305175781, -2852.4506835938, 5.5881395339966, 0, 0, 0);
  113.     CreateObject(3095, 1749.6668701172, -2835.8447265625, 9.5, 0, 90, 0);
  114.     CreateObject(3095, 1749.666015625, -2862.8134765625, 9.5, 0, 90, 0);
  115.     CreateObject(3095, 1749.666015625, -2853.8232421875, 9.5, 0, 90, 0);
  116.     CreateObject(3095, 1749.666015625, -2844.833984375, 9.5, 0, 90, 0);
  117.     CreateObject(994, 1734.8913574219, -2866.2641601563, 5.555365562439, 0, 0, 90);
  118.     CreateObject(994, 1734.890625, -2859.5632324219, 5.555365562439, 0, 0, 90);
  119.     CreateObject(3401, 1742.7684326172, -2838.2465820313, 7.9004049301147, 0, 0, 0);
  120.     CreateObject(994, 1742.630859375, -2845.4501953125, 5.5881395339966, 0, 0, 0);
  121.     CreateObject(994, 1736.0302734375, -2845.4501953125, 5.5881395339966, 0, 0, 0);
  122.     CreateObject(994, 1734.890625, -2838.0625, 5.555365562439, 0, 0, 90);
  123.     CreateObject(994, 1734.890625, -2844.8625488281, 5.555365562439, 0, 0, 90);
  124.     CreateObject(3095, 1745.2294921875, -2830.8447265625, 9.5, 0, 90, 270);
  125.     CreateObject(3095, 1736.2451171875, -2830.8447265625, 9.5, 0, 90, 270);
  126.     CreateObject(3095, 1718.2648925781, -2830.8447265625, 9.5, 0, 90, 270);
  127.     CreateObject(3095, 1727.2551269531, -2830.8447265625, 9.5, 0, 90, 270);
  128.     CreateObject(3095, 1713.2648925781, -2862.8125, 9.5, 0, 90, 0);
  129.     CreateObject(3095, 1713.2646484375, -2835.8447265625, 9.5, 0, 90, 0);
  130.     CreateObject(3095, 1713.2646484375, -2844.833984375, 9.5, 0, 90, 0);
  131.     CreateObject(3095, 1713.2646484375, -2853.8232421875, 9.5, 0, 90, 0);
  132.     CreateObject(3095, 1718.2648925781, -2866.8125, 9.5, 0, 90, 270);
  133.     CreateObject(3095, 1727.2548828125, -2866.8125, 9.5, 0, 90, 270);
  134.     CreateObject(3095, 1736.2451171875, -2866.8125, 9.5, 0, 90, 270);
  135.     CreateObject(3095, 1745.2294921875, -2866.8125, 9.5, 0, 90, 270);
  136.     CreateObject(3095, 1745.2294921875, -2835.8447265625, 10.199999809265, 0, 0, 0);
  137.     CreateObject(3095, 1736.2451171875, -2835.8447265625, 10.199999809265, 0, 0, 0);
  138.     CreateObject(3095, 1745.2294921875, -2844.833984375, 10.199999809265, 0, 0, 0);
  139.     CreateObject(3095, 1736.2451171875, -2844.833984375, 10.199999809265, 0, 0, 0);
  140.     CreateObject(3095, 1745.2294921875, -2853.8232421875, 10.199999809265, 0, 0, 0);
  141.     CreateObject(3095, 1745.2294921875, -2862.8125, 10.199999809265, 0, 0, 0);
  142.     CreateObject(3095, 1736.2451171875, -2853.8232421875, 10.199999809265, 0, 0, 0);
  143.     CreateObject(3095, 1736.2451171875, -2862.8125, 10.199999809265, 0, 0, 0);
  144.     CreateObject(3401, 1720.767578125, -2838.24609375, 7.9004049301147, 0, 0, 0);
  145.     CreateObject(994, 1728.2906494141, -2838.0625, 5.555365562439, 0, 0, 90);
  146.     CreateObject(994, 1728.2906494141, -2844.8623046875, 5.555365562439, 0, 0, 90);
  147.     CreateObject(994, 1714.0302734375, -2845.4501953125, 5.5881395339966, 0, 0, 0);
  148.     CreateObject(994, 1720.7302246094, -2845.4501953125, 5.5881395339966, 0, 0, 0);
  149.     CreateObject(3401, 1720.767578125, -2859.9912109375, 7.9004049301147, 0, 0, 0);
  150.     CreateObject(994, 1728.2906494141, -2866.263671875, 5.555365562439, 0, 0, 90);
  151.     CreateObject(994, 1728.2906494141, -2859.5625, 5.555365562439, 0, 0, 90);
  152.     CreateObject(994, 1714.0302734375, -2852.4501953125, 5.5881395339966, 0, 0, 0);
  153.     CreateObject(994, 1720.7294921875, -2852.4501953125, 5.5881395339966, 0, 0, 0);
  154.     CreateObject(3095, 1727.2548828125, -2862.8125, 10.199999809265, 0, 0, 0);
  155.     CreateObject(3095, 1718.2646484375, -2862.8125, 10.199999809265, 0, 0, 0);
  156.     CreateObject(3095, 1727.2548828125, -2853.8232421875, 10.199999809265, 0, 0, 0);
  157.     CreateObject(3095, 1718.2646484375, -2853.8232421875, 10.199999809265, 0, 0, 0);
  158.     CreateObject(3095, 1727.2548828125, -2844.833984375, 10.199999809265, 0, 0, 0);
  159.     CreateObject(3095, 1718.2646484375, -2844.833984375, 10.199999809265, 0, 0, 0);
  160.     CreateObject(3095, 1727.2548828125, -2835.8447265625, 10.199999809265, 0, 0, 0);
  161.     CreateObject(3095, 1718.2646484375, -2835.8447265625, 10.199999809265, 0, 0, 0);
  162.     return 1;
  163. }
  164.  
  165. public OnPlayerConnect(playerid)
  166. {
  167.     PlayerDualWatching[playerid] = 0;
  168.     InventationSent[playerid] = -1;
  169.     Inventation[playerid] = -1;
  170.     InDual[playerid] = 0;
  171.     Inventationprice[playerid] = 0;
  172.     return 1;
  173. }
  174.  
  175. public OnPlayerDisconnect(playerid, reason)
  176. {
  177.     PlayerDualWatching[playerid] = 0;
  178.     InventationSent[playerid] = -1;
  179.     Inventation[playerid] = -1;
  180.     InDual[playerid] = 0;
  181.     Inventationprice[playerid] = 0;
  182.     return 1;
  183. }
  184.  
  185. public OnPlayerDeath(playerid, killerid, reason)
  186. {
  187.     if(InDual[playerid] == 1)
  188.     {
  189.         new string[256];
  190.         new killername[MAX_PLAYER_NAME];
  191.         new playername[MAX_PLAYER_NAME];
  192.         GetPlayerName(killerid, killername, sizeof(killername));
  193.         GetPlayerName(playerid, playername, sizeof(playername));
  194.         if(DualRoom1 == playerid || DualRoom1 == killerid)
  195.         {
  196.             Inventation[playerid] = -1;
  197.             InventationSent[playerid] = -1;
  198.             Inventation[killerid] = -1;
  199.             InventationSent[killerid] = -1;
  200.             InDual[playerid] = 0;
  201.             InDual[killerid] = 0;
  202.             format(string, sizeof(string), "%s defeated %s in a duel and wins $%d", killername, playername, DualRoom1price);
  203.             SendClientMessageToAll(GREEN, string);
  204.             GivePlayerMoney(killerid, (DualRoom1price*2));
  205.             SpawnPlayer(killerid);
  206.             SendDeathMessage(killerid, playerid, reason);
  207.             DualRoom1 = -1;
  208.             return 1;
  209.         }
  210.         if(DualRoom2 == playerid || DualRoom2 == killerid)
  211.         {
  212.             Inventation[playerid] = -1;
  213.             InventationSent[playerid] = -1;
  214.             Inventation[killerid] = -1;
  215.             InventationSent[killerid] = -1;
  216.             InDual[playerid] = 0;
  217.             InDual[killerid] = 0;
  218.             format(string, sizeof(string), "%s defeated %s in a duel and wins $%d", killername, playername, DualRoom2price);
  219.             SendClientMessageToAll(GREEN, string);
  220.             GivePlayerMoney(killerid, (DualRoom2price*2));
  221.             SpawnPlayer(killerid);
  222.             SendDeathMessage(killerid, playerid, reason);
  223.             DualRoom2 = -1;
  224.             return 1;
  225.         }
  226.         if(DualRoom3 == playerid || DualRoom3 == killerid)
  227.         {
  228.             Inventation[playerid] = -1;
  229.             InventationSent[playerid] = -1;
  230.             Inventation[killerid] = -1;
  231.             InventationSent[killerid] = -1;
  232.             InDual[playerid] = 0;
  233.             InDual[killerid] = 0;
  234.             format(string, sizeof(string), "%s defeated %s in a duel and wins $%d", killername, playername, DualRoom3price);
  235.             SendClientMessageToAll(GREEN, string);
  236.             GivePlayerMoney(killerid, (DualRoom3price*2));
  237.             SpawnPlayer(killerid);
  238.             SendDeathMessage(killerid, playerid, reason);
  239.             DualRoom3 = -1;
  240.             return 1;
  241.         }
  242.         if(DualRoom4 == playerid || DualRoom4 == killerid)
  243.         {
  244.             Inventation[playerid] = -1;
  245.             InventationSent[playerid] = -1;
  246.             Inventation[killerid] = -1;
  247.             InventationSent[killerid] = -1;
  248.             InDual[playerid] = 0;
  249.             InDual[killerid] = 0;
  250.             format(string, sizeof(string), "%s defeated %s in a duel and wins $%d", killername, playername, DualRoom4price);
  251.             SendClientMessageToAll(GREEN, string);
  252.             GivePlayerMoney(killerid, (DualRoom4price*2));
  253.             SpawnPlayer(killerid);
  254.             SendDeathMessage(killerid, playerid, reason);
  255.             DualRoom4 = -1;
  256.             return 1;
  257.         }
  258.         return 1;
  259.     }
  260.     return 1;
  261. }
  262.  
  263. public OnPlayerCommandText(playerid, cmdtext[])
  264. {
  265.     //duel system commands
  266.     dcmd(watchduels,10,cmdtext);
  267.     dcmd(leavewatch,10,cmdtext);
  268.     dcmd(duel,4,cmdtext);
  269.     dcmd(acceptduel,10,cmdtext);
  270.     dcmd(declineduel,11,cmdtext);
  271.     return 0;
  272. }
  273.  
  274. dcmd_watchduels(playerid, params[])
  275. {
  276.     #pragma unused params
  277.     if(PlayerDualWatching[playerid] == 0)
  278.     {
  279.         SetPlayerPos(playerid, 1731.8315,-2864.7705,6.5554);
  280.         SetPlayerFacingAngle(playerid, 1.8901);
  281.         ResetPlayerWeapons(playerid);
  282.         SetPlayerHealth(playerid, 1000000000);
  283.         PlayerDualWatching[playerid] = 1;
  284.         SendClientMessage(playerid, COLOR_YELLOW, "You are now watching the player duels, Death Match is NOT allowed in this area, /leavewatch to leave.");
  285.         return 1;
  286.     }
  287.     else return SendClientMessage(playerid, RED, "[VT ERROR] You are already watching the duel fights, /leavewatch to leave this place.");
  288. }
  289.  
  290. dcmd_leavewatch(playerid, params[])
  291. {
  292.     #pragma unused params
  293.     if(PlayerDualWatching[playerid] == 1)
  294.     {
  295.         SetPlayerHealth(playerid, 100);
  296.         SpawnPlayer(playerid);
  297.         SendClientMessage(playerid, COLOR_YELLOW, "You left the player duel watching");
  298.         PlayerDualWatching[playerid] = 0;
  299.         return 1;
  300.     }
  301.     else return SendClientMessage(playerid, RED, "[VT ERROR] You are not watching the duel fights, /watchduels to watch.");
  302. }
  303.  
  304. dcmd_duel(playerid, params[])
  305. {
  306.     new
  307.         giveplayerid,
  308.         weapon[128],
  309.         price;
  310.     new string[256];
  311.     new sendername[MAX_PLAYER_NAME];
  312.     new giveplayername[MAX_PLAYER_NAME];
  313.     if (sscanf(params, "isi", giveplayerid,weapon,price))
  314.     {
  315.         SendClientMessage(playerid, COLOR_YELLOW, "[VT ERROR] Right Usage: /dual [playerid] [weapon] [amount]");
  316.         SendClientMessage(playerid, COLOR_YELLOW, "Duel weapons: deagle, mp5, chainsaw, silpist, combatsg, shotgun");
  317.         return 1;
  318.     }
  319.     else
  320.     {
  321.         if(playerid != giveplayerid)
  322.         {
  323.             GetPlayerName(playerid, sendername, sizeof(sendername));
  324.             GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
  325.             if(strcmp("deagle", weapon, true, 6) == 0)
  326.             {
  327.                 if(GetPlayerMoney(playerid) >= price)
  328.                 {
  329.                     if(Inventation[giveplayerid] == -1)
  330.                     {
  331.                         if(InventationSent[playerid] == -1)
  332.                         {
  333.                             if(InDual[playerid] == 0)
  334.                             {
  335.                                 if(InDual[giveplayerid] == 0)
  336.                                 {
  337.                                     if(DualRoom1 == -1)
  338.                                     {
  339.                                         SetTimerEx("inventationremove", 30000, 0, "i", playerid);
  340.                                         format(string, sizeof(string), "%s has sent you a 1 vs. 1 duel with a desert eagle for $%d, /acceptduel or /declineduel", sendername, price);
  341.                                         SendClientMessage(giveplayerid, GREEN, string);
  342.                                         format(string, sizeof(string), "you sent %s a 1 vs. 1 duel with a desert eagle for $%d", giveplayername, price);
  343.                                         SendClientMessage(playerid, GREEN, string);
  344.                                         InventationSent[playerid] = giveplayerid;
  345.                                         Inventation[giveplayerid] = playerid;
  346.                                         Inventationprice[giveplayerid] = price;
  347.                                         DualRoom1price = price;
  348.                                         DualRoom1 = playerid;
  349.                                         WeaponDualRoom1 = 24;
  350.                                         return 1;
  351.                                     }
  352.                                     else if(DualRoom2 == -1)
  353.                                     {
  354.                                         SetTimerEx("inventationremove", 30000, 0, "i", playerid);
  355.                                         format(string, sizeof(string), "%s has sent you a 1 vs. 1 duel with a desert eagle for $%d, /acceptduel or /declineduel", sendername, price);
  356.                                         SendClientMessage(giveplayerid, GREEN, string);
  357.                                         format(string, sizeof(string), "you sent %s a 1 vs. 1 duel with a desert eagle for $%d", giveplayername, price);
  358.                                         SendClientMessage(playerid, GREEN, string);
  359.                                         InventationSent[playerid] = giveplayerid;
  360.                                         Inventation[giveplayerid] = playerid;
  361.                                         DualRoom2price = price;
  362.                                         DualRoom2 = playerid;
  363.                                         WeaponDualRoom2 = 24;
  364.                                         return 1;
  365.                                     }
  366.                                     else if(DualRoom3 == -1)
  367.                                     {
  368.                                         SetTimerEx("inventationremove", 30000, 0, "i", playerid);
  369.                                         format(string, sizeof(string), "%s has sent you a 1 vs. 1 duel with a desert eagle for $%d, /acceptduel or /declineduel", sendername, price);
  370.                                         SendClientMessage(giveplayerid, GREEN, string);
  371.                                         format(string, sizeof(string), "you sent %s a 1 vs. 1 duel with a desert eagle for $%d", giveplayername, price);
  372.                                         SendClientMessage(playerid, GREEN, string);
  373.                                         InventationSent[playerid] = giveplayerid;
  374.                                         Inventation[giveplayerid] = playerid;
  375.                                         DualRoom3price = price;
  376.                                         DualRoom3 = playerid;
  377.                                         WeaponDualRoom3 = 24;
  378.                                         return 1;
  379.                                     }
  380.                                     else if(DualRoom4 == -1)
  381.                                     {
  382.                                         SetTimerEx("inventationremove", 30000, 0, "i", playerid);
  383.                                         format(string, sizeof(string), "%s has sent you a 1 vs. 1 duel with a desert eagle for $%d, /acceptduel or /declineduel", sendername, price);
  384.                                         SendClientMessage(giveplayerid, GREEN, string);
  385.                                         format(string, sizeof(string), "you sent %s a 1 vs. 1 duel with a desert eagle for $%d", giveplayername, price);
  386.                                         SendClientMessage(playerid, GREEN, string);
  387.                                         InventationSent[playerid] = giveplayerid;
  388.                                         Inventation[giveplayerid] = playerid;
  389.                                         DualRoom4price = price;
  390.                                         DualRoom4 = playerid;
  391.                                         WeaponDualRoom4 = 24;
  392.                                         return 1;
  393.                                     }
  394.                                     else return SendClientMessage(playerid, RED, "there are no dual rooms free, wait till a dual ends");
  395.                                 }
  396.                                 else return SendClientMessage(playerid, RED, "This player is already in a dual");
  397.                             }
  398.                             else return SendClientMessage(playerid, RED, "you are still in a dual, end it first");
  399.                         }
  400.                         else return SendClientMessage(playerid, RED, "You already sent an inventation, wait 30 seconds or wait till the other player declines");
  401.                     }
  402.                     else return SendClientMessage(playerid, RED, "This player already got an inventation");
  403.                 }
  404.                 else return SendClientMessage(playerid, RED, "You can't afford the dual fee");
  405.             }
  406.             if(strcmp("mp5", weapon, true, 3) == 0)
  407.             {
  408.                 if(GetPlayerMoney(playerid) >= price)
  409.                 {
  410.                     if(Inventation[giveplayerid] == -1)
  411.                     {
  412.                         if(InventationSent[playerid] == -1)
  413.                         {
  414.                             if(InDual[playerid] == 0)
  415.                             {
  416.                                 if(InDual[giveplayerid] == 0)
  417.                                 {
  418.                                     if(DualRoom1 == -1)
  419.                                     {
  420.                                         SetTimerEx("inventationremove", 30000, 0, "i", playerid);
  421.                                         format(string, sizeof(string), "%s has sent you a 1 vs. 1 duel with a desert eagle for $%d, /acceptduel or /declineduel", sendername, price);
  422.                                         SendClientMessage(giveplayerid, GREEN, string);
  423.                                         format(string, sizeof(string), "you sent %s a 1 vs. 1 duel with a desert eagle for $%d", giveplayername, price);
  424.                                         SendClientMessage(playerid, GREEN, string);
  425.                                         InventationSent[playerid] = giveplayerid;
  426.                                         Inventation[giveplayerid] = playerid;
  427.                                         Inventationprice[giveplayerid] = price;
  428.                                         DualRoom1price = price;
  429.                                         DualRoom1 = playerid;
  430.                                         WeaponDualRoom1 = 29;
  431.                                         return 1;
  432.                                     }
  433.                                     else if(DualRoom2 == -1)
  434.                                     {
  435.                                         SetTimerEx("inventationremove", 30000, 0, "i", playerid);
  436.                                         format(string, sizeof(string), "%s has sent you a 1 vs. 1 duel with a desert eagle for $%d, /acceptduel or /declineduel", sendername, price);
  437.                                         SendClientMessage(giveplayerid, GREEN, string);
  438.                                         format(string, sizeof(string), "you sent %s a 1 vs. 1 duel with a desert eagle for $%d", giveplayername, price);
  439.                                         SendClientMessage(playerid, GREEN, string);
  440.                                         InventationSent[playerid] = giveplayerid;
  441.                                         Inventation[giveplayerid] = playerid;
  442.                                         DualRoom2price = price;
  443.                                         DualRoom2 = playerid;
  444.                                         WeaponDualRoom2 = 29;
  445.                                         return 1;
  446.                                     }
  447.                                     else if(DualRoom3 == -1)
  448.                                     {
  449.                                         SetTimerEx("inventationremove", 30000, 0, "i", playerid);
  450.                                         format(string, sizeof(string), "%s has sent you a 1 vs. 1 duel with a desert eagle for $%d, /acceptduel or /declineduel", sendername, price);
  451.                                         SendClientMessage(giveplayerid, GREEN, string);
  452.                                         format(string, sizeof(string), "you sent %s a 1 vs. 1 duel with a desert eagle for $%d", giveplayername, price);
  453.                                         SendClientMessage(playerid, GREEN, string);
  454.                                         InventationSent[playerid] = giveplayerid;
  455.                                         Inventation[giveplayerid] = playerid;
  456.                                         DualRoom3price = price;
  457.                                         DualRoom3 = playerid;
  458.                                         WeaponDualRoom3 = 29;
  459.                                         return 1;
  460.                                     }
  461.                                     else if(DualRoom4 == -1)
  462.                                     {
  463.                                         SetTimerEx("inventationremove", 30000, 0, "i", playerid);
  464.                                         format(string, sizeof(string), "%s has sent you a 1 vs. 1 duel with a desert eagle for $%d, /acceptduel or /declineduel", sendername, price);
  465.                                         SendClientMessage(giveplayerid, GREEN, string);
  466.                                         format(string, sizeof(string), "you sent %s a 1 vs. 1 duel with a desert eagle for $%d", giveplayername, price);
  467.                                         SendClientMessage(playerid, GREEN, string);
  468.                                         InventationSent[playerid] = giveplayerid;
  469.                                         Inventation[giveplayerid] = playerid;
  470.                                         DualRoom4price = price;
  471.                                         DualRoom4 = playerid;
  472.                                         WeaponDualRoom4 = 29;
  473.                                         return 1;
  474.                                     }
  475.                                     else return SendClientMessage(playerid, RED, "there are no dual rooms free, wait till a dual ends");
  476.                                 }
  477.                                 else return SendClientMessage(playerid, RED, "This player is already in a dual");
  478.                             }
  479.                             else return SendClientMessage(playerid, RED, "you are still in a dual, end it first");
  480.                         }
  481.                         else return SendClientMessage(playerid, RED, "You already sent an inventation, wait 30 seconds or wait till the other player declines");
  482.                     }
  483.                     else return SendClientMessage(playerid, RED, "This player already got an inventation");
  484.                 }
  485.                 else return SendClientMessage(playerid, RED, "You can't afford the dual fee");
  486.             }
  487.             if(strcmp("chainsaw", weapon, true, 8) == 0)
  488.             {
  489.                 if(GetPlayerMoney(playerid) >= price)
  490.                 {
  491.                     if(Inventation[giveplayerid] == -1)
  492.                     {
  493.                         if(InventationSent[playerid] == -1)
  494.                         {
  495.                             if(InDual[playerid] == 0)
  496.                             {
  497.                                 if(InDual[giveplayerid] == 0)
  498.                                 {
  499.                                     if(DualRoom1 == -1)
  500.                                     {
  501.                                         SetTimerEx("inventationremove", 30000, 0, "i", playerid);
  502.                                         format(string, sizeof(string), "%s has sent you a 1 vs. 1 duel with a desert eagle for $%d, /acceptduel or /declineduel", sendername, price);
  503.                                         SendClientMessage(giveplayerid, GREEN, string);
  504.                                         format(string, sizeof(string), "you sent %s a 1 vs. 1 duel with a desert eagle for $%d", giveplayername, price);
  505.                                         SendClientMessage(playerid, GREEN, string);
  506.                                         InventationSent[playerid] = giveplayerid;
  507.                                         Inventation[giveplayerid] = playerid;
  508.                                         Inventationprice[giveplayerid] = price;
  509.                                         DualRoom1price = price;
  510.                                         DualRoom1 = playerid;
  511.                                         WeaponDualRoom1 = 9;
  512.                                         return 1;
  513.                                     }
  514.                                     else if(DualRoom2 == -1)
  515.                                     {
  516.                                         SetTimerEx("inventationremove", 30000, 0, "i", playerid);
  517.                                         format(string, sizeof(string), "%s has sent you a 1 vs. 1 duel with a desert eagle for $%d, /acceptduel or /declineduel", sendername, price);
  518.                                         SendClientMessage(giveplayerid, GREEN, string);
  519.                                         format(string, sizeof(string), "you sent %s a 1 vs. 1 duel with a desert eagle for $%d", giveplayername, price);
  520.                                         SendClientMessage(playerid, GREEN, string);
  521.                                         InventationSent[playerid] = giveplayerid;
  522.                                         Inventation[giveplayerid] = playerid;
  523.                                         DualRoom2price = price;
  524.                                         DualRoom2 = playerid;
  525.                                         WeaponDualRoom2 = 9;
  526.                                         return 1;
  527.                                     }
  528.                                     else if(DualRoom3 == -1)
  529.                                     {
  530.                                         SetTimerEx("inventationremove", 30000, 0, "i", playerid);
  531.                                         format(string, sizeof(string), "%s has sent you a 1 vs. 1 duel with a desert eagle for $%d, /acceptduel or /declineduel", sendername, price);
  532.                                         SendClientMessage(giveplayerid, GREEN, string);
  533.                                         format(string, sizeof(string), "you sent %s a 1 vs. 1 duel with a desert eagle for $%d", giveplayername, price);
  534.                                         SendClientMessage(playerid, GREEN, string);
  535.                                         InventationSent[playerid] = giveplayerid;
  536.                                         Inventation[giveplayerid] = playerid;
  537.                                         DualRoom3price = price;
  538.                                         DualRoom3 = playerid;
  539.                                         WeaponDualRoom3 = 9;
  540.                                         return 1;
  541.                                     }
  542.                                     else if(DualRoom4 == -1)
  543.                                     {
  544.                                         SetTimerEx("inventationremove", 30000, 0, "i", playerid);
  545.                                         format(string, sizeof(string), "%s has sent you a 1 vs. 1 duel with a desert eagle for $%d, /acceptduel or /declineduel", sendername, price);
  546.                                         SendClientMessage(giveplayerid, GREEN, string);
  547.                                         format(string, sizeof(string), "you sent %s a 1 vs. 1 duel with a desert eagle for $%d", giveplayername, price);
  548.                                         SendClientMessage(playerid, GREEN, string);
  549.                                         InventationSent[playerid] = giveplayerid;
  550.                                         Inventation[giveplayerid] = playerid;
  551.                                         DualRoom4price = price;
  552.                                         DualRoom4 = playerid;
  553.                                         WeaponDualRoom4 = 9;
  554.                                         return 1;
  555.                                     }
  556.                                     else return SendClientMessage(playerid, RED, "there are no dual rooms free, wait till a dual ends");
  557.                                 }
  558.                                 else return SendClientMessage(playerid, RED, "This player is already in a dual");
  559.                             }
  560.                             else return SendClientMessage(playerid, RED, "you are still in a dual, end it first");
  561.                         }
  562.                         else return SendClientMessage(playerid, RED, "You already sent an inventation, wait 30 seconds or wait till the other player declines");
  563.                     }
  564.                     else return SendClientMessage(playerid, RED, "This player already got an inventation");
  565.                 }
  566.                 else return SendClientMessage(playerid, RED, "You can't afford the dual fee");
  567.             }
  568.             if(strcmp("silpist", weapon, true, 7) == 0)
  569.             {
  570.                 if(GetPlayerMoney(playerid) >= price)
  571.                 {
  572.                     if(Inventation[giveplayerid] == -1)
  573.                     {
  574.                         if(InventationSent[playerid] == -1)
  575.                         {
  576.                             if(InDual[playerid] == 0)
  577.                             {
  578.                                 if(InDual[giveplayerid] == 0)
  579.                                 {
  580.                                     SetTimerEx("inventationremove", 30000, 0, "i", playerid);
  581.                                     if(DualRoom1 == -1)
  582.                                     {
  583.                                         SetTimerEx("inventationremove", 30000, 0, "i", playerid);
  584.                                         format(string, sizeof(string), "%s has sent you a 1 vs. 1 duel with a desert eagle for $%d, /acceptduel or /declineduel", sendername, price);
  585.                                         SendClientMessage(giveplayerid, GREEN, string);
  586.                                         format(string, sizeof(string), "you sent %s a 1 vs. 1 duel with a desert eagle for $%d", giveplayername, price);
  587.                                         SendClientMessage(playerid, GREEN, string);
  588.                                         InventationSent[playerid] = giveplayerid;
  589.                                         Inventation[giveplayerid] = playerid;
  590.                                         Inventationprice[giveplayerid] = price;
  591.                                         DualRoom1price = price;
  592.                                         DualRoom1 = playerid;
  593.                                         WeaponDualRoom1 = 23;
  594.                                         return 1;
  595.                                     }
  596.                                     else if(DualRoom2 == -1)
  597.                                     {
  598.                                         SetTimerEx("inventationremove", 30000, 0, "i", playerid);
  599.                                         format(string, sizeof(string), "%s has sent you a 1 vs. 1 duel with a desert eagle for $%d, /acceptduel or /declineduel", sendername, price);
  600.                                         SendClientMessage(giveplayerid, GREEN, string);
  601.                                         format(string, sizeof(string), "you sent %s a 1 vs. 1 duel with a desert eagle for $%d", giveplayername, price);
  602.                                         SendClientMessage(playerid, GREEN, string);
  603.                                         InventationSent[playerid] = giveplayerid;
  604.                                         Inventation[giveplayerid] = playerid;
  605.                                         DualRoom2price = price;
  606.                                         DualRoom2 = playerid;
  607.                                         WeaponDualRoom2 = 23;
  608.                                         return 1;
  609.                                     }
  610.                                     else if(DualRoom3 == -1)
  611.                                     {
  612.                                         SetTimerEx("inventationremove", 30000, 0, "i", playerid);
  613.                                         format(string, sizeof(string), "%s has sent you a 1 vs. 1 duel with a desert eagle for $%d, /acceptduel or /declineduel", sendername, price);
  614.                                         SendClientMessage(giveplayerid, GREEN, string);
  615.                                         format(string, sizeof(string), "you sent %s a 1 vs. 1 duel with a desert eagle for $%d", giveplayername, price);
  616.                                         SendClientMessage(playerid, GREEN, string);
  617.                                         InventationSent[playerid] = giveplayerid;
  618.                                         Inventation[giveplayerid] = playerid;
  619.                                         DualRoom3price = price;
  620.                                         DualRoom3 = playerid;
  621.                                         WeaponDualRoom3 = 23;
  622.                                         return 1;
  623.                                     }
  624.                                     else if(DualRoom4 == -1)
  625.                                     {
  626.                                         SetTimerEx("inventationremove", 30000, 0, "i", playerid);
  627.                                         format(string, sizeof(string), "%s has sent you a 1 vs. 1 duel with a desert eagle for $%d, /acceptduel or /declineduel", sendername, price);
  628.                                         SendClientMessage(giveplayerid, GREEN, string);
  629.                                         format(string, sizeof(string), "you sent %s a 1 vs. 1 duel with a desert eagle for $%d", giveplayername, price);
  630.                                         SendClientMessage(playerid, GREEN, string);
  631.                                         InventationSent[playerid] = giveplayerid;
  632.                                         Inventation[giveplayerid] = playerid;
  633.                                         DualRoom4price = price;
  634.                                         DualRoom4 = playerid;
  635.                                         WeaponDualRoom4 = 23;
  636.                                         return 1;
  637.                                     }
  638.                                     else return SendClientMessage(playerid, RED, "there are no dual rooms free, wait till a dual ends");
  639.                                 }
  640.                                 else return SendClientMessage(playerid, RED, "This player is already in a dual");
  641.                             }
  642.                             else return SendClientMessage(playerid, RED, "you are still in a dual, end it first");
  643.                         }
  644.                         else return SendClientMessage(playerid, RED, "You already sent an inventation, wait 30 seconds or wait till the other player declines");
  645.                     }
  646.                     else return SendClientMessage(playerid, RED, "This player already got an inventation");
  647.                 }
  648.                 else return SendClientMessage(playerid, RED, "You can't afford the dual fee");
  649.             }
  650.             if(strcmp("combatsg", weapon, true, 8) == 0)
  651.             {
  652.                 if(GetPlayerMoney(playerid) >= price)
  653.                 {
  654.                     if(Inventation[giveplayerid] == -1)
  655.                     {
  656.                         if(InventationSent[playerid] == -1)
  657.                         {
  658.                             if(InDual[playerid] == 0)
  659.                             {
  660.                                 if(InDual[giveplayerid] == 0)
  661.                                 {
  662.                                     if(DualRoom1 == -1)
  663.                                     {
  664.                                         SetTimerEx("inventationremove", 30000, 0, "i", playerid);
  665.                                         format(string, sizeof(string), "%s has sent you a 1 vs. 1 duel with a desert eagle for $%d, /acceptduel or /declineduel", sendername, price);
  666.                                         SendClientMessage(giveplayerid, GREEN, string);
  667.                                         format(string, sizeof(string), "you sent %s a 1 vs. 1 duel with a desert eagle for $%d", giveplayername, price);
  668.                                         SendClientMessage(playerid, GREEN, string);
  669.                                         InventationSent[playerid] = giveplayerid;
  670.                                         Inventation[giveplayerid] = playerid;
  671.                                         Inventationprice[giveplayerid] = price;
  672.                                         DualRoom1price = price;
  673.                                         DualRoom1 = playerid;
  674.                                         WeaponDualRoom1 = 27;
  675.                                         return 1;
  676.                                     }
  677.                                     else if(DualRoom2 == -1)
  678.                                     {
  679.                                         SetTimerEx("inventationremove", 30000, 0, "i", playerid);
  680.                                         format(string, sizeof(string), "%s has sent you a 1 vs. 1 duel with a desert eagle for $%d, /acceptduel or /declineduel", sendername, price);
  681.                                         SendClientMessage(giveplayerid, GREEN, string);
  682.                                         format(string, sizeof(string), "you sent %s a 1 vs. 1 duel with a desert eagle for $%d", giveplayername, price);
  683.                                         SendClientMessage(playerid, GREEN, string);
  684.                                         InventationSent[playerid] = giveplayerid;
  685.                                         Inventation[giveplayerid] = playerid;
  686.                                         DualRoom2price = price;
  687.                                         DualRoom2 = playerid;
  688.                                         WeaponDualRoom2 = 27;
  689.                                         return 1;
  690.                                     }
  691.                                     else if(DualRoom3 == -1)
  692.                                     {
  693.                                         SetTimerEx("inventationremove", 30000, 0, "i", playerid);
  694.                                         format(string, sizeof(string), "%s has sent you a 1 vs. 1 duel with a desert eagle for $%d, /acceptduel or /declineduel", sendername, price);
  695.                                         SendClientMessage(giveplayerid, GREEN, string);
  696.                                         format(string, sizeof(string), "you sent %s a 1 vs. 1 duel with a desert eagle for $%d", giveplayername, price);
  697.                                         SendClientMessage(playerid, GREEN, string);
  698.                                         InventationSent[playerid] = giveplayerid;
  699.                                         Inventation[giveplayerid] = playerid;
  700.                                         DualRoom3price = price;
  701.                                         DualRoom3 = playerid;
  702.                                         WeaponDualRoom3 = 27;
  703.                                         return 1;
  704.                                     }
  705.                                     else if(DualRoom4 == -1)
  706.                                     {
  707.                                         SetTimerEx("inventationremove", 30000, 0, "i", playerid);
  708.                                         format(string, sizeof(string), "%s has sent you a 1 vs. 1 duel with a desert eagle for $%d, /acceptduel or /declineduel", sendername, price);
  709.                                         SendClientMessage(giveplayerid, GREEN, string);
  710.                                         format(string, sizeof(string), "you sent %s a 1 vs. 1 duel with a desert eagle for $%d", giveplayername, price);
  711.                                         SendClientMessage(playerid, GREEN, string);
  712.                                         InventationSent[playerid] = giveplayerid;
  713.                                         Inventation[giveplayerid] = playerid;
  714.                                         DualRoom4price = price;
  715.                                         DualRoom4 = playerid;
  716.                                         WeaponDualRoom4 = 27;
  717.                                         return 1;
  718.                                     }
  719.                                     else return SendClientMessage(playerid, RED, "there are no dual rooms free, wait till a dual ends");
  720.                                 }
  721.                                 else return SendClientMessage(playerid, RED, "This player is already in a dual");
  722.                             }
  723.                             else return SendClientMessage(playerid, RED, "you are still in a dual, end it first");
  724.                         }
  725.                         else return SendClientMessage(playerid, RED, "You already sent an inventation, wait 30 seconds or wait till the other player declines");
  726.                     }
  727.                     else return SendClientMessage(playerid, RED, "This player already got an inventation");
  728.                 }
  729.                 else return SendClientMessage(playerid, RED, "You can't afford the dual fee");
  730.             }
  731.             if(strcmp("shotgun", weapon, true, 7) == 0)
  732.             {
  733.                 if(GetPlayerMoney(playerid) >= price)
  734.                 {
  735.                     if(Inventation[giveplayerid] == -1)
  736.                     {
  737.                         if(InventationSent[playerid] == -1)
  738.                         {
  739.                             if(InDual[playerid] == 0)
  740.                             {
  741.                                 if(InDual[giveplayerid] == 0)
  742.                                 {
  743.                                     if(DualRoom1 == -1)
  744.                                     {
  745.                                         SetTimerEx("inventationremove", 30000, 0, "i", playerid);
  746.                                         format(string, sizeof(string), "%s has sent you a 1 vs. 1 duel with a desert eagle for $%d, /acceptduel or /declineduel", sendername, price);
  747.                                         SendClientMessage(giveplayerid, GREEN, string);
  748.                                         format(string, sizeof(string), "you sent %s a 1 vs. 1 duel with a desert eagle for $%d", giveplayername, price);
  749.                                         SendClientMessage(playerid, GREEN, string);
  750.                                         InventationSent[playerid] = giveplayerid;
  751.                                         Inventation[giveplayerid] = playerid;
  752.                                         Inventationprice[giveplayerid] = price;
  753.                                         DualRoom1price = price;
  754.                                         DualRoom1 = playerid;
  755.                                         WeaponDualRoom1 = 25;
  756.                                         return 1;
  757.                                     }
  758.                                     else if(DualRoom2 == -1)
  759.                                     {
  760.                                         SetTimerEx("inventationremove", 30000, 0, "i", playerid);
  761.                                         format(string, sizeof(string), "%s has sent you a 1 vs. 1 duel with a desert eagle for $%d, /acceptduel or /declineduel", sendername, price);
  762.                                         SendClientMessage(giveplayerid, GREEN, string);
  763.                                         format(string, sizeof(string), "you sent %s a 1 vs. 1 duel with a desert eagle for $%d", giveplayername, price);
  764.                                         SendClientMessage(playerid, GREEN, string);
  765.                                         InventationSent[playerid] = giveplayerid;
  766.                                         Inventation[giveplayerid] = playerid;
  767.                                         DualRoom2price = price;
  768.                                         DualRoom2 = playerid;
  769.                                         WeaponDualRoom2 = 25;
  770.                                         return 1;
  771.                                     }
  772.                                     else if(DualRoom3 == -1)
  773.                                     {
  774.                                         SetTimerEx("inventationremove", 30000, 0, "i", playerid);
  775.                                         format(string, sizeof(string), "%s has sent you a 1 vs. 1 duel with a desert eagle for $%d, /acceptduel or /declineduel", sendername, price);
  776.                                         SendClientMessage(giveplayerid, GREEN, string);
  777.                                         format(string, sizeof(string), "you sent %s a 1 vs. 1 duel with a desert eagle for $%d", giveplayername, price);
  778.                                         SendClientMessage(playerid, GREEN, string);
  779.                                         InventationSent[playerid] = giveplayerid;
  780.                                         Inventation[giveplayerid] = playerid;
  781.                                         DualRoom3price = price;
  782.                                         DualRoom3 = playerid;
  783.                                         WeaponDualRoom3 = 25;
  784.                                         return 1;
  785.                                     }
  786.                                     else if(DualRoom4 == -1)
  787.                                     {
  788.                                         SetTimerEx("inventationremove", 30000, 0, "i", playerid);
  789.                                         format(string, sizeof(string), "%s has sent you a 1 vs. 1 duel with a desert eagle for $%d, /acceptduel or /declineduel", sendername, price);
  790.                                         SendClientMessage(giveplayerid, GREEN, string);
  791.                                         format(string, sizeof(string), "you sent %s a 1 vs. 1 duel with a desert eagle for $%d", giveplayername, price);
  792.                                         SendClientMessage(playerid, GREEN, string);
  793.                                         InventationSent[playerid] = giveplayerid;
  794.                                         Inventation[giveplayerid] = playerid;
  795.                                         DualRoom4price = price;
  796.                                         DualRoom4 = playerid;
  797.                                         WeaponDualRoom4 = 25;
  798.                                         return 1;
  799.                                     }
  800.                                     else return SendClientMessage(playerid, RED, "there are no duel rooms free, wait till a duel ends");
  801.                                 }
  802.                                 else return SendClientMessage(playerid, RED, "This player is already in a duel");
  803.                             }
  804.                             else return SendClientMessage(playerid, RED, "you are still in a duel, end it first");
  805.                         }
  806.                         else return SendClientMessage(playerid, RED, "You already sent an inventation, wait 30 seconds or wait till the other player declines");
  807.                     }
  808.                     else return SendClientMessage(playerid, RED, "This player already got an inventation");
  809.                 }
  810.                 else return SendClientMessage(playerid, RED, "You can't afford the duel fee");
  811.             }
  812.             else return SendClientMessage(playerid, COLOR_YELLOW, "Right Usage: /duel [playerid] [weapon] [amount]");
  813.         }
  814.         else return SendClientMessage(playerid, RED, "You cant duel yourself");
  815.     }
  816. }
  817.  
  818. dcmd_acceptduel(playerid, params[])
  819. {
  820.     #pragma unused params
  821.     if(Inventation[playerid] >= 0)
  822.     {
  823.         if(GetPlayerMoney(playerid) >= Inventationprice[playerid])
  824.         {
  825.             if(DualRoom1 == Inventation[playerid])
  826.             {
  827.                 SetPlayerTeam(playerid, 1);
  828.                 SetPlayerTeam(Inventation[playerid], 2);
  829.                 InDual[Inventation[playerid]] = 1;
  830.                 InDual[playerid] = 1;
  831.                 ResetPlayerWeapons(playerid);
  832.                 ResetPlayerWeapons(Inventation[playerid]);
  833.                 GivePlayerWeapon(playerid, WeaponDualRoom1, 500);
  834.                 GivePlayerWeapon(Inventation[playerid], WeaponDualRoom1, 500);
  835.                 SetPlayerPos(playerid, 1715.5034,-2865.0405,6.5554);
  836.                 SetPlayerFacingAngle(playerid,317.1064);
  837.                 SetPlayerPos(Inventation[playerid], 1723.2203,-2856.0315,6.5554);
  838.                 SetPlayerFacingAngle(Inventation[playerid],140.0715);
  839.                 SetPlayerHealth(playerid, 100);
  840.                 SetPlayerArmour(playerid, 100);
  841.                 SetPlayerHealth(Inventation[playerid], 100);
  842.                 SetPlayerArmour(Inventation[playerid], 100);
  843.                 GivePlayerMoney(playerid, -DualRoom1price);
  844.                 GivePlayerMoney(Inventation[playerid], -DualRoom1price);
  845.                 SendClientMessage(playerid, GREEN, "LET THE BATTLE BEGIN!");
  846.                 SendClientMessage(Inventation[playerid], GREEN, "LET THE BATTLE BEGIN!");
  847.                 TogglePlayerControllable(playerid, 0);
  848.                 TogglePlayerControllable(Inventation[playerid], 0);
  849.                 CountDown(playerid, 3);
  850.                 CountDown(Inventation[playerid], 3);
  851.             }
  852.             if(DualRoom2 == Inventation[playerid])
  853.             {
  854.                 SetPlayerTeam(playerid, 1);
  855.                 SetPlayerTeam(Inventation[playerid], 2);
  856.                 InDual[Inventation[playerid]] = 1;
  857.                 InDual[playerid] = 1;
  858.                 ResetPlayerWeapons(playerid);
  859.                 ResetPlayerWeapons(Inventation[playerid]);
  860.                 GivePlayerWeapon(playerid, WeaponDualRoom2, 500);
  861.                 GivePlayerWeapon(Inventation[playerid], WeaponDualRoom2, 500);
  862.                 SetPlayerPos(playerid, 1747.7878,-2864.6843,6.5554);
  863.                 SetPlayerFacingAngle(playerid,47.0340);
  864.                 SetPlayerPos(Inventation[playerid], 1740.1650,-2858.3879,6.5554);
  865.                 SetPlayerFacingAngle(Inventation[playerid],228.1190);
  866.                 SetPlayerHealth(playerid, 100);
  867.                 SetPlayerArmour(playerid, 100);
  868.                 SetPlayerHealth(Inventation[playerid], 100);
  869.                 SetPlayerArmour(Inventation[playerid], 100);
  870.                 GivePlayerMoney(playerid, -DualRoom2price);
  871.                 GivePlayerMoney(Inventation[playerid], -DualRoom2price);
  872.                 SendClientMessage(playerid, GREEN, "LET THE BATTLE BEGIN!");
  873.                 SendClientMessage(Inventation[playerid], GREEN, "LET THE BATTLE BEGIN!");
  874.                 TogglePlayerControllable(playerid, 0);
  875.                 TogglePlayerControllable(Inventation[playerid], 0);
  876.                 CountDown(playerid, 3);
  877.                 CountDown(Inventation[playerid], 3);
  878.                 return 1;
  879.             }
  880.             if(DualRoom3 == Inventation[playerid])
  881.             {
  882.                 SetPlayerTeam(playerid, 1);
  883.                 SetPlayerTeam(Inventation[playerid], 2);
  884.                 InDual[Inventation[playerid]] = 1;
  885.                 InDual[playerid] = 1;
  886.                 ResetPlayerWeapons(playerid);
  887.                 ResetPlayerWeapons(Inventation[playerid]);
  888.                 GivePlayerWeapon(playerid, WeaponDualRoom3, 500);
  889.                 GivePlayerWeapon(Inventation[playerid], WeaponDualRoom3, 500);
  890.                 SetPlayerPos(playerid, 1748.3942,-2832.6250,6.5554);
  891.                 SetPlayerFacingAngle(playerid,141.3482);
  892.                 SetPlayerPos(Inventation[playerid], 1741.1982,-2839.9243,6.5554);
  893.                 SetPlayerFacingAngle(Inventation[playerid],315.8531);
  894.                 SetPlayerHealth(playerid, 100);
  895.                 SetPlayerArmour(playerid, 100);
  896.                 SetPlayerHealth(Inventation[playerid], 100);
  897.                 SetPlayerArmour(Inventation[playerid], 100);
  898.                 GivePlayerMoney(playerid, -DualRoom3price);
  899.                 GivePlayerMoney(Inventation[playerid], -DualRoom3price);
  900.                 SendClientMessage(playerid, GREEN, "LET THE BATTLE BEGIN!");
  901.                 SendClientMessage(Inventation[playerid], GREEN, "LET THE BATTLE BEGIN!");
  902.                 TogglePlayerControllable(playerid, 0);
  903.                 TogglePlayerControllable(Inventation[playerid], 0);
  904.                 CountDown(playerid, 3);
  905.                 CountDown(Inventation[playerid], 3);
  906.                 return 1;
  907.             }
  908.             if(DualRoom4 == Inventation[playerid])
  909.             {
  910.                 SetPlayerTeam(playerid, 1);
  911.                 SetPlayerTeam(Inventation[playerid], 2);
  912.                 InDual[Inventation[playerid]] = 1;
  913.                 InDual[playerid] = 1;
  914.                 ResetPlayerWeapons(playerid);
  915.                 ResetPlayerWeapons(Inventation[playerid]);
  916.                 GivePlayerWeapon(playerid, WeaponDualRoom4, 500);
  917.                 GivePlayerWeapon(Inventation[playerid], WeaponDualRoom4, 500);
  918.                 SetPlayerPos(playerid, 1716.7450,-2832.7969,6.5554);
  919.                 SetPlayerFacingAngle(playerid,229.7091);
  920.                 SetPlayerPos(Inventation[playerid], 1722.3630,-2840.2034,6.5554);
  921.                 SetPlayerFacingAngle(Inventation[playerid],45.7807);
  922.                 SetPlayerHealth(playerid, 100);
  923.                 SetPlayerArmour(playerid, 100);
  924.                 SetPlayerHealth(Inventation[playerid], 100);
  925.                 SetPlayerArmour(Inventation[playerid], 100);
  926.                 GivePlayerMoney(playerid, -DualRoom4price);
  927.                 GivePlayerMoney(Inventation[playerid], -DualRoom4price);
  928.                 SendClientMessage(playerid, GREEN, "LET THE BATTLE BEGIN!");
  929.                 SendClientMessage(Inventation[playerid], GREEN, "LET THE BATTLE BEGIN!");
  930.                 TogglePlayerControllable(playerid, 0);
  931.                 TogglePlayerControllable(Inventation[playerid], 0);
  932.                 CountDown(playerid, 3);
  933.                 CountDown(Inventation[playerid], 3);
  934.                 return 1;
  935.             }
  936.             return 1;
  937.         }
  938.         else return SendClientMessage(playerid, RED, "You dont have enough money to accept the duel use /declineduel please.");
  939.     }
  940.     else return SendClientMessage(playerid, RED, "You didnt receive a duel inventation");
  941. }
  942.  
  943. dcmd_declineduel(playerid, params[])
  944. {
  945.     #pragma unused params
  946.     SendClientMessage(playerid, RED, "You decline the duel inventation");
  947.     SendClientMessage(Inventation[playerid], RED, "your duel inventation got declined.");
  948.     Inventation[InventationSent[playerid]] = -1;
  949.     InventationSent[playerid] = -1;
  950.     if(DualRoom1 == playerid)
  951.     {
  952.         DualRoom1 = -1;
  953.     }
  954.     if(DualRoom2 == playerid)
  955.     {
  956.         DualRoom2 = -1;
  957.     }
  958.     if(DualRoom3 == playerid)
  959.     {
  960.         DualRoom3 = -1;
  961.     }
  962.     if(DualRoom3 == playerid)
  963.     {
  964.         DualRoom4 = -1;
  965.     }
  966.     return 1;
  967. }
  968.  
  969. stock sscanf(string[], format[], {Float,_}:...)
  970. {
  971.     #if defined isnull
  972.         if (isnull(string))
  973.     #else
  974.         if (string[0] == 0 || (string[0] == 1 && string[1] == 0))
  975.     #endif
  976.         {
  977.             return format[0];
  978.         }
  979.     #pragma tabsize 4
  980.     new
  981.         formatPos = 0,
  982.         stringPos = 0,
  983.         paramPos = 2,
  984.         paramCount = numargs(),
  985.         delim = ' ';
  986.     while (string[stringPos] && string[stringPos] <= ' ')
  987.     {
  988.         stringPos++;
  989.     }
  990.     while (paramPos < paramCount && string[stringPos])
  991.     {
  992.         switch (format[formatPos++])
  993.         {
  994.             case '\0':
  995.             {
  996.                 return 0;
  997.             }
  998.             case 'i', 'd':
  999.             {
  1000.                 new
  1001.                     neg = 1,
  1002.                     num = 0,
  1003.                     ch = string[stringPos];
  1004.                 if (ch == '-')
  1005.                 {
  1006.                     neg = -1;
  1007.                     ch = string[++stringPos];
  1008.                 }
  1009.                 do
  1010.                 {
  1011.                     stringPos++;
  1012.                     if ('0' <= ch <= '9')
  1013.                     {
  1014.                         num = (num * 10) + (ch - '0');
  1015.                     }
  1016.                     else
  1017.                     {
  1018.                         return -1;
  1019.                     }
  1020.                 }
  1021.                 while ((ch = string[stringPos]) > ' ' && ch != delim);
  1022.                 setarg(paramPos, 0, num * neg);
  1023.             }
  1024.             case 'h', 'x':
  1025.             {
  1026.                 new
  1027.                     num = 0,
  1028.                     ch = string[stringPos];
  1029.                 do
  1030.                 {
  1031.                     stringPos++;
  1032.                     switch (ch)
  1033.                     {
  1034.                         case 'x', 'X':
  1035.                         {
  1036.                             num = 0;
  1037.                             continue;
  1038.                         }
  1039.                         case '0' .. '9':
  1040.                         {
  1041.                             num = (num << 4) | (ch - '0');
  1042.                         }
  1043.                         case 'a' .. 'f':
  1044.                         {
  1045.                             num = (num << 4) | (ch - ('a' - 10));
  1046.                         }
  1047.                         case 'A' .. 'F':
  1048.                         {
  1049.                             num = (num << 4) | (ch - ('A' - 10));
  1050.                         }
  1051.                         default:
  1052.                         {
  1053.                             return -1;
  1054.                         }
  1055.                     }
  1056.                 }
  1057.                 while ((ch = string[stringPos]) > ' ' && ch != delim);
  1058.                 setarg(paramPos, 0, num);
  1059.             }
  1060.             case 'c':
  1061.             {
  1062.                 setarg(paramPos, 0, string[stringPos++]);
  1063.             }
  1064.             case 'f':
  1065.             {
  1066.                 setarg(paramPos, 0, _:floatstr(string[stringPos]));
  1067.             }
  1068.             case 'p':
  1069.             {
  1070.                 delim = format[formatPos++];
  1071.                 continue;
  1072.             }
  1073.             case '\'':
  1074.             {
  1075.                 new
  1076.                     end = formatPos - 1,
  1077.                     ch;
  1078.                 while ((ch = format[++end]) && ch != '\'') {}
  1079.                 if (!ch)
  1080.                 {
  1081.                     return -1;
  1082.                 }
  1083.                 format[end] = '\0';
  1084.                 if ((ch = strfind(string, format[formatPos], false, stringPos)) == -1)
  1085.                 {
  1086.                     if (format[end + 1])
  1087.                     {
  1088.                         return -1;
  1089.                     }
  1090.                     return 0;
  1091.                 }
  1092.                 format[end] = '\'';
  1093.                 stringPos = ch + (end - formatPos);
  1094.                 formatPos = end + 1;
  1095.             }
  1096.             case 'u':
  1097.             {
  1098.                 new
  1099.                     end = stringPos - 1,
  1100.                     id = 0,
  1101.                     bool:num = true,
  1102.                     ch;
  1103.                 while ((ch = string[++end]) && ch != delim)
  1104.                 {
  1105.                     if (num)
  1106.                     {
  1107.                         if ('0' <= ch <= '9')
  1108.                         {
  1109.                             id = (id * 10) + (ch - '0');
  1110.                         }
  1111.                         else
  1112.                         {
  1113.                             num = false;
  1114.                         }
  1115.                     }
  1116.                 }
  1117.                 if (num && IsPlayerConnected(id))
  1118.                 {
  1119.                     setarg(paramPos, 0, id);
  1120.                 }
  1121.                 else
  1122.                 {
  1123.                     #if !defined foreach
  1124.                         #define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
  1125.                         #define __SSCANF_FOREACH__
  1126.                     #endif
  1127.                     string[end] = '\0';
  1128.                     num = false;
  1129.                     new
  1130.                         name[MAX_PLAYER_NAME];
  1131.                     id = end - stringPos;
  1132.                     foreach (Player, playerid)
  1133.                     {
  1134.                         GetPlayerName(playerid, name, sizeof (name));
  1135.                         if (!strcmp(name, string[stringPos], true, id))
  1136.                         {
  1137.                             setarg(paramPos, 0, playerid);
  1138.                             num = true;
  1139.                             break;
  1140.                         }
  1141.                     }
  1142.                     if (!num)
  1143.                     {
  1144.                         setarg(paramPos, 0, INVALID_PLAYER_ID);
  1145.                     }
  1146.                     string[end] = ch;
  1147.                     #if defined __SSCANF_FOREACH__
  1148.                         #undef foreach
  1149.                         #undef __SSCANF_FOREACH__
  1150.                     #endif
  1151.                 }
  1152.                 stringPos = end;
  1153.             }
  1154.             case 's', 'z':
  1155.             {
  1156.                 new
  1157.                     i = 0,
  1158.                     ch;
  1159.                 if (format[formatPos])
  1160.                 {
  1161.                     while ((ch = string[stringPos++]) && ch != delim)
  1162.                     {
  1163.                         setarg(paramPos, i++, ch);
  1164.                     }
  1165.                     if (!i)
  1166.                     {
  1167.                         return -1;
  1168.                     }
  1169.                 }
  1170.                 else
  1171.                 {
  1172.                     while ((ch = string[stringPos++]))
  1173.                     {
  1174.                         setarg(paramPos, i++, ch);
  1175.                     }
  1176.                 }
  1177.                 stringPos--;
  1178.                 setarg(paramPos, i, '\0');
  1179.             }
  1180.             default:
  1181.             {
  1182.                 continue;
  1183.             }
  1184.         }
  1185.         while (string[stringPos] && string[stringPos] != delim && string[stringPos] > ' ')
  1186.         {
  1187.             stringPos++;
  1188.         }
  1189.         while (string[stringPos] && (string[stringPos] == delim || string[stringPos] <= ' '))
  1190.         {
  1191.             stringPos++;
  1192.         }
  1193.         paramPos++;
  1194.     }
  1195.     do
  1196.     {
  1197.         if ((delim = format[formatPos++]) > ' ')
  1198.         {
  1199.             if (delim == '\'')
  1200.             {
  1201.                 while ((delim = format[formatPos++]) && delim != '\'') {}
  1202.             }
  1203.             else if (delim != 'z')
  1204.             {
  1205.                 return delim;
  1206.             }
  1207.         }
  1208.     }
  1209.     while (delim > ' ');
  1210.     return 0;
  1211. }
  1212.  
  1213. //-----------------------------[© Notime(G.H.J.N.) 2009-2010]-------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement