Advertisement
DragonZafiro666

Duel System v1.0

Mar 20th, 2016
1,317
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 16.76 KB | None | 0 0
  1. /*==============================================================================
  2. ** SA-MP (0.3.7)  DUel Filterscript v1.0
  3. ** By: DragonZafiro/NeloAngelo
  4. ** Created: 18/03/16
  5. ==============================================================================*/
  6. #include <a_samp>
  7. #include <zcmd>
  8. #include <sscanf2>
  9. #include <YSI\y_colours>
  10. #include "../include/gl_common.inc"
  11. #define FILTERSCRIPT
  12. #define COLOR_ADVICE    X11_RED
  13. #define COLOR_SUCCESS   X11_LIMEGREEN
  14. #define PLAIN_TEXT      "{FFFAFA}"
  15. #define M_TEXT          "{808080}"
  16. #define M_TITLE         "{45FF00}"
  17. new tempTeam[MAX_PLAYERS]; // TEAM TEMPORAL
  18.  
  19. enum pInfo
  20. {
  21.     ActiveDuel,
  22.     onDuel,
  23.     DuelInvited,
  24.     DuelReceived,
  25.     DuelWatching
  26. };
  27. new PlayerInfo[MAX_PLAYERS][pInfo];
  28. new DuelDoors[2];
  29. new DuelTimer;
  30.  
  31. new Text:DuelSpec;
  32.  
  33. #define DIALOG_DUEL_WEAPONS 51
  34. #define DIALOG_DUEL_INVITE  52
  35. #define DIALOG_DUEL_SPEC    53
  36. public OnFilterScriptInit()
  37. {
  38.     CreateObject(985, 2658.97021, 1223.53833, 27.63396,   0.00000, 0.00000, 270.00000);
  39.     CreateObject(985, 2658.98682, 1215.67554, 27.63396,   0.00000, 0.00000, 270.00000);
  40.     CreateObject(985, 2658.98584, 1207.79749, 27.63396,   0.00000, 0.00000, 270.00000);
  41.     CreateObject(985, 2658.97974, 1199.92932, 27.63396,   0.00000, 0.00000, 270.00000);
  42.     CreateObject(986, 2658.98218, 1191.97839, 27.63396,   0.00000, 0.00000, 90.00000);
  43.     CreateObject(986, 2658.97705, 1231.47131, 27.63396,   0.00000, 0.00000, 90.00000);
  44.     CreateObject(983, 2658.94946, 1187.32385, 29.15171,   269.75909, 0.00000, 0.00000);
  45.     CreateObject(1468, 2659.02881, 1186.75110, 27.18706,   0.00000, 269.75909, 90.85940);
  46.     CreateObject(1468, 2659.01880, 1186.74170, 30.46206,   0.00000, 269.75909, 90.85940);
  47.     CreateObject(986, 2631.37769, 1231.48218, 27.62882,   0.00000, 0.00000, 90.00000);
  48.     CreateObject(986, 2631.38843, 1223.46484, 27.63396,   0.00000, 0.00000, 90.00000);
  49.     CreateObject(986, 2631.39453, 1215.44385, 27.63396,   0.00000, 0.00000, 90.00000);
  50.     CreateObject(986, 2631.39014, 1207.42273, 27.63396,   0.00000, 0.00000, 90.00000);
  51.     CreateObject(986, 2631.38135, 1199.40869, 27.63396,   0.00000, 0.00000, 90.00000);
  52.     CreateObject(986, 2631.37769, 1191.38794, 27.63396,   0.00000, 0.00000, 90.00000);
  53.     CreateObject(1468, 2631.36646, 1186.16077, 28.56204,   0.00000, 90.24080, 270.48181);
  54.     CreateObject(1468, 2631.36646, 1186.15320, 30.46203,   0.00000, 90.24080, 270.48181);
  55.     CreateObject(987, 2631.45972, 1235.70264, 26.94314,   0.00000, 0.00000, 0.00000);
  56.     CreateObject(987, 2643.42334, 1235.68005, 26.91814,   0.00000, 0.00000, 0.00000);
  57.     CreateObject(987, 2647.08740, 1235.69678, 26.94315,   0.00000, 0.00000, 0.00000);
  58.     CreateObject(987, 2643.23853, 1186.14905, 26.91815,   0.00000, 0.00000, 180.00000);
  59.     CreateObject(987, 2655.19287, 1186.14929, 26.94314,   0.00000, 0.00000, 180.00000);
  60.     CreateObject(987, 2658.89355, 1186.13464, 26.94206,   0.00000, 0.00000, 180.00000);
  61.     CreateObject(988, 2648.85791, 1232.85437, 26.95722,   0.00000, 0.00000, 90.00000);
  62.     CreateObject(988, 2643.47607, 1232.70288, 26.95722,   0.00000, 0.00000, 270.00000);
  63.     CreateObject(988, 2646.05737, 1234.20801, 31.01233,   270.61859, 0.00000, 180.00000);
  64.     CreateObject(988, 2643.48584, 1189.04944, 26.95722,   0.00000, 0.00000, 270.00000);
  65.     CreateObject(988, 2648.90845, 1189.16089, 26.95722,   0.00000, 0.00000, 90.00020);
  66.     CreateObject(988, 2646.25464, 1187.70081, 31.01859,   270.61859, 0.00000, 0.00010);
  67.     CreateObject(3819, 2663.85181, 1223.96643, 26.92105,   0.00000, 0.00000, 0.00000);
  68.     CreateObject(3819, 2663.85693, 1215.37488, 26.92105,   0.00000, 0.00000, 0.00000);
  69.     CreateObject(3819, 2663.85327, 1206.77734, 26.92105,   0.00000, 0.00000, 0.00000);
  70.     CreateObject(3819, 2663.85059, 1198.16992, 26.92105,   0.00000, 0.00000, 0.00000);
  71.     CreateObject(3819, 2626.50415, 1197.89392, 26.92105,   0.00000, 0.00000, 180.00000);
  72.     CreateObject(3819, 2626.50391, 1206.49182, 26.92105,   0.00000, 0.00000, 180.00000);
  73.     CreateObject(3819, 2626.49585, 1215.07849, 26.92105,   0.00000, 0.00000, 180.00000);
  74.     CreateObject(3819, 2626.49756, 1223.67383, 26.92105,   0.00000, 0.00000, 180.00000);
  75.     CreateObject(3528, 2645.73853, 1233.81335, 34.38435,   0.00000, 0.00000, 270.00000);
  76.     CreateObject(3528, 2646.61523, 1188.38440, 34.48753,   0.00000, 0.00000, 90.00000);
  77.     CreateObject(983, 2631.42212, 1186.72498, 29.15200,   -89.38100, 0.00000, 0.85900);
  78.     CreateObject(976, 2666.74194, 1220.18396, 27.22200,   0.00000, 0.00000, 90.24100);
  79.     CreateObject(976, 2666.77197, 1211.32800, 27.23000,   0.00000, 0.00000, 90.24100);
  80.     CreateObject(976, 2666.77002, 1202.50696, 27.22800,   0.00000, 0.00000, 90.24100);
  81.     CreateObject(976, 2666.77490, 1193.65100, 27.21600,   0.00000, 0.00000, 90.24100);
  82.     CreateObject(976, 2623.68091, 1220.20300, 27.22200,   0.00000, 0.00000, 90.24100);
  83.     CreateObject(976, 2623.72095, 1211.39099, 27.22200,   0.00000, 0.00000, 90.24100);
  84.     CreateObject(976, 2623.75610, 1202.56299, 27.21100,   0.00000, 0.00000, 90.24100);
  85.     CreateObject(976, 2623.71802, 1193.72095, 27.17200,   0.00000, 0.00000, 90.24100);
  86.  
  87.     DuelDoors[0] = CreateObject(988, 2646.2058, 1230.0742, 26.9624, 0.0000, 0.0000, 0.0000);
  88.     DuelDoors[1] = CreateObject(988, 2646.165771, 1191.811157, 26.957216, 0.0000, 0.0000, 180.0001);
  89.  
  90.     DuelSpec = TextDrawCreate(160.000000, 361.000000, "~b~] ~w~Press ~r~    ~k~~PED_SPRINT~ ~w~to stop watching ~b~]");
  91.     TextDrawFont(DuelSpec, 2);
  92.     TextDrawLetterSize(DuelSpec, 0.360000, 1.600000);
  93.     TextDrawColor(DuelSpec, -1);
  94.     TextDrawSetOutline(DuelSpec, 1);
  95.     TextDrawSetProportional(DuelSpec, 1);
  96.  
  97.     for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++)
  98.     {
  99.         if(IsPlayerConnected(i))
  100.         {
  101.             PlayerInfo[i][onDuel] = 0;
  102.             PlayerInfo[i][ActiveDuel] = 1;
  103.             PlayerInfo[i][DuelInvited] = -1;
  104.             PlayerInfo[i][DuelReceived] = -1;
  105.         }
  106.     }
  107.     return 1;
  108. }
  109. public OnFilterScriptExit()
  110. {
  111.     DestroyObject(DuelDoors[0]);
  112.     DestroyObject(DuelDoors[1]);
  113.     return 1;
  114. }
  115. forward CancelDuel(playerid, invited);
  116. public CancelDuel(playerid, invited)
  117. {
  118.     PlayerInfo[playerid][DuelInvited] = -1;
  119.     PlayerInfo[playerid][DuelReceived] = -1;
  120.     PlayerInfo[invited][DuelInvited] = -1;
  121.     PlayerInfo[invited][DuelReceived] = -1;
  122.     SendClientMessage(playerid, COLOR_ADVICE, "[!]: "PLAIN_TEXT"Duel time has expired.");
  123.     SendClientMessage(invited, COLOR_ADVICE, "[!]: "PLAIN_TEXT"Duel time has expired.");
  124.     return 1;
  125. }
  126. forward StartDuel(movedoor);
  127. public StartDuel(movedoor)
  128. {
  129.     if(movedoor == 1)
  130.     {
  131.         MoveObject(DuelDoors[0], 2646.2058, 1230.0742, 32.0, 3.0, 0.0, 0.0, 0.0);
  132.         MoveObject(DuelDoors[1], 2646.165771, 1191.811157, 32.0, 3.0, 0.0, 0.0, 180.0001);
  133.     }
  134.     else
  135.     {
  136.         MoveObject(DuelDoors[0], 2646.2058, 1230.0742, 26.9624, 3.0, 0.0, 0.0, 0.0);
  137.         MoveObject(DuelDoors[1], 2646.165771, 1191.811157, 26.9624, 3.0, 0.0, 0.0, 180.0001);
  138.     }
  139.     return 1;
  140. }
  141. SetupDuel(playerid, oponent, weapons)
  142. {
  143.     if(PlayerInfo[playerid][DuelWatching] == 1)
  144.     {
  145.         TogglePlayerSpectating(playerid, 0);
  146.         PlayerInfo[playerid][DuelWatching] = 0;
  147.     }
  148.     if(PlayerInfo[oponent][DuelWatching] == 1)
  149.     {
  150.         TogglePlayerSpectating(oponent, 0);
  151.         PlayerInfo[oponent][DuelWatching] = 0;
  152.     }
  153.     KillTimer(DuelTimer);
  154.     new str[200], weapon[20];
  155.     GetPVarString(oponent, "DuelWeapons", weapon, sizeof(weapon));
  156.     format(str, sizeof(str), "[Duel]: "PLAIN_TEXT"A duel between "M_TITLE"%s v "M_TITLE"%s "PLAIN_TEXT"[%s] Will start in 10 seconds...",
  157.         PlayerName(playerid), PlayerName(oponent), weapon);
  158.     SendClientMessageToAll(COLOR_ADVICE, str);
  159.     ResetPlayerWeapons(playerid);
  160.     ResetPlayerWeapons(oponent);
  161.     if(weapons == 0) // RW SET
  162.     {
  163.         GivePlayerWeapon(playerid, WEAPON_UZI, 1000);
  164.         GivePlayerWeapon(playerid, WEAPON_COLT45, 1000);
  165.         GivePlayerWeapon(playerid, WEAPON_SAWEDOFF, 1000);
  166.         GivePlayerWeapon(oponent, WEAPON_UZI, 1000);
  167.         GivePlayerWeapon(oponent, WEAPON_COLT45, 1000);
  168.         GivePlayerWeapon(oponent, WEAPON_SAWEDOFF, 1000);
  169.     }
  170.     else if(weapons == 1) // WW SET
  171.     {
  172.         GivePlayerWeapon(playerid, WEAPON_DEAGLE, 1000);
  173.         GivePlayerWeapon(playerid, WEAPON_SHOTGUN, 1000);
  174.         GivePlayerWeapon(playerid, WEAPON_SNIPER, 1000);
  175.         GivePlayerWeapon(oponent, WEAPON_DEAGLE, 1000);
  176.         GivePlayerWeapon(oponent, WEAPON_SHOTGUN, 1000);
  177.         GivePlayerWeapon(oponent, WEAPON_SNIPER, 1000);
  178.     }
  179.     SetPlayerPos(playerid, 2646.134033, 1232.647460, 26.918153);
  180.     SetPlayerFacingAngle(playerid, 183.424057);
  181.     SetPlayerInterior(playerid, 0);
  182.     SetPlayerVirtualWorld(playerid, playerid + 1);
  183.     tempTeam[playerid] = GetPlayerTeam(playerid);
  184.     SetPlayerTeam(playerid, playerid); // Remover TEAM
  185.  
  186.     SetPlayerPos(oponent, 2645.674804, 1190.122802, 26.918153);
  187.     SetPlayerFacingAngle(oponent, 359.496429);
  188.     SetPlayerInterior(oponent, 0);
  189.     SetPlayerVirtualWorld(oponent, playerid + 1);
  190.     tempTeam[oponent] = GetPlayerTeam(oponent);
  191.     SetPlayerTeam(oponent, oponent); // Remover TEAM
  192.  
  193.     PlayerInfo[playerid][onDuel] = 1;
  194.     PlayerInfo[oponent][onDuel] = 1;
  195.     SetTimerEx("StartDuel", 10000, false, "d", 1);
  196. }
  197. public OnPlayerDisconnect(playerid, reason)
  198. {
  199.     if(PlayerInfo[playerid][onDuel] != 0)
  200.     {
  201.         new str[124];
  202.         format(str, sizeof(str), "[Duel]: "PLAIN_TEXT"%s has been left the server...", PlayerName(playerid));
  203.         SendClientMessageToAll(COLOR_ADVICE, str);
  204.         StartDuel(0);
  205.         for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++)
  206.         {
  207.             if(IsPlayerConnected(i) && PlayerInfo[i][onDuel] == 1)
  208.             {
  209.                 SetPlayerTeam(i, tempTeam[i]);
  210.                 SpawnPlayer(i);
  211.                 PlayerInfo[i][onDuel] = 0;
  212.                 PlayerInfo[i][DuelInvited] = -1;
  213.                 PlayerInfo[i][DuelReceived] = -1;
  214.             }
  215.         }
  216.     }
  217.     return 1;
  218. }
  219. public OnPlayerDeath(playerid,killerid,reason)
  220. {
  221.     if(PlayerInfo[playerid][onDuel] != 0 && PlayerInfo[killerid][onDuel] != 0)
  222.     {
  223.         new str[254];
  224.         format(str, sizeof(str), "[Duel]: "PLAIN_TEXT"%s has won the duel against %s...", PlayerName(killerid), PlayerName(playerid));
  225.         SendClientMessageToAll(COLOR_ADVICE, str);
  226.         SetPlayerTeam(killerid, tempTeam[killerid]);
  227.         SetPlayerTeam(playerid, tempTeam[playerid]);
  228.         SpawnPlayer(killerid);
  229.         PlayerInfo[playerid][onDuel] = 0;
  230.         PlayerInfo[killerid][onDuel] = 0;
  231.         PlayerInfo[playerid][DuelInvited] = -1;
  232.         PlayerInfo[playerid][DuelReceived] = -1;
  233.         PlayerInfo[killerid][DuelInvited] = -1;
  234.         PlayerInfo[killerid][DuelReceived] = -1;
  235.         StartDuel(0);
  236.     }
  237.     if(killerid == INVALID_PLAYER_ID)
  238.     {
  239.         for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++)
  240.         {
  241.             if(IsPlayerConnected(i) && PlayerInfo[i][onDuel] == 1)
  242.             {
  243.                 SetPlayerTeam(i, tempTeam[i]);
  244.                 SpawnPlayer(i);
  245.                 PlayerInfo[i][onDuel] = 0;
  246.                 PlayerInfo[i][DuelInvited] = -1;
  247.                 PlayerInfo[i][DuelReceived] = -1;
  248.             }
  249.         }
  250.     }
  251.     return 1;
  252. }
  253. CMD:duelo(playerid, params[])
  254. {
  255.     new Float:health;
  256.     GetPlayerHealth(playerid, health);
  257.     if(health < 50.0) return SendClientMessage(playerid, COLOR_ADVICE, "[!]: "PLAIN_TEXT"You cannot use this command with low HP.");
  258.     if(isnull(params)) return SendClientMessage(playerid, COLOR_ADVICE, "[!]: "PLAIN_TEXT"Use: /Duel [Invite | View | Accept | Decline | Enable | Disable]");
  259.  
  260.     if(strfind(params, "invite", true) != -1)
  261.     {
  262.         if(PlayerInfo[playerid][ActiveDuel] != 1) return SendClientMessage(playerid, COLOR_ADVICE, "[!]: "PLAIN_TEXT"You have disabled the duels. Use: /Duel Enable");
  263.         if(PlayerInfo[playerid][DuelInvited] != -1) return SendClientMessage(playerid, COLOR_ADVICE, "[!]: "PLAIN_TEXT"You've already invited a player to a duel.");
  264.         if(PlayerInfo[playerid][DuelReceived] != -1) return SendClientMessage(playerid, COLOR_ADVICE, "[!]: "PLAIN_TEXT"You're invited to a duel. Use: /Duel Decline");
  265.         ShowPlayerDialog(playerid, DIALOG_DUEL_WEAPONS, DIALOG_STYLE_LIST, ""M_TITLE"Select the weapons:", "{FAFAFA}Running Weapons(RW)\nWalking Weapons(WW)", "Select", "Cancel");
  266.         return 1;
  267.     }
  268.     if(strfind(params, "view", true) != -1)
  269.     {
  270.         if(PlayerInfo[playerid][DuelWatching] != 0) return SendClientMessage(playerid, COLOR_ADVICE, "[!]: "PLAIN_TEXT"You're watching a duel.");
  271.         new PlayerList[120];
  272.         for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++)
  273.         {
  274.             if(IsPlayerConnected(i) && PlayerInfo[i][onDuel] != 0 &&  playerid != i)
  275.             {
  276.                 strcat(PlayerList, PlayerName(i));
  277.                 strcat(PlayerList, "\n");
  278.             }
  279.         }
  280.         if(!isnull(PlayerList)) ShowPlayerDialog(playerid, DIALOG_DUEL_SPEC, DIALOG_STYLE_LIST, ""M_TITLE"Select a player:", PlayerList, "Select", "Cancel");
  281.         else SendClientMessage(playerid, COLOR_ADVICE, "[!]: "PLAIN_TEXT"There's noone on a duel.");
  282.         return 1;
  283.     }
  284.     if(strfind(params, "accept", true) != -1)
  285.     {
  286.         if(PlayerInfo[playerid][DuelReceived] != -1)
  287.             SetupDuel(playerid, PlayerInfo[playerid][DuelReceived], GetPVarInt(PlayerInfo[playerid][DuelReceived], "DuelWeaponsID"));
  288.         else SendClientMessage(playerid, COLOR_ADVICE, "[!]: "PLAIN_TEXT"You aren't invited to a duel.");
  289.         return 1;
  290.     }
  291.     if(strfind(params, "decline", true) != -1)
  292.     {
  293.         if(PlayerInfo[playerid][DuelReceived] != -1)
  294.         {
  295.             new str[254];
  296.             SendClientMessage(playerid, COLOR_SUCCESS, "You have declined the duel, you can now receive invitations to a duel.");
  297.             format(str, sizeof(str), "%s "PLAIN_TEXT"Has declined your invitation to a duel.", PlayerName(playerid));
  298.             SendClientMessage(PlayerInfo[playerid][DuelReceived], GetPlayerColor(playerid), str);
  299.             PlayerInfo[PlayerInfo[playerid][DuelReceived]][DuelInvited] = -1;
  300.             PlayerInfo[playerid][DuelReceived] = -1;
  301.             KillTimer(DuelTimer);
  302.         }
  303.         else SendClientMessage(playerid, COLOR_ADVICE, "[!]: "PLAIN_TEXT"You have not invitations to a duel.");
  304.         return 1;
  305.     }
  306.     if(strfind(params, "enable", true) != -1)
  307.     {
  308.         PlayerInfo[playerid][ActiveDuel] = 1;
  309.         SendClientMessage(playerid, COLOR_SUCCESS, "You have enabled the invitations to a duel.");
  310.         return 1;
  311.     }
  312.     if(strfind(params, "disable", true) != -1)
  313.     {
  314.         PlayerInfo[playerid][ActiveDuel] = 0;
  315.         SendClientMessage(playerid, COLOR_SUCCESS, "You have disabled the invitations to a duel.");
  316.         return 1;
  317.     }
  318.     else SendClientMessage(playerid, COLOR_ADVICE, "[!]: "PLAIN_TEXT"Use: /Duel [Invite | View | Accept | Decline | Enable | Disable]");
  319.     return 1;
  320. }
  321. public OnPlayerCommandReceived(playerid, cmdtext[])
  322. {
  323.     // ON DUEL
  324.     if( PlayerInfo[playerid][onDuel] == 1 )
  325.     {
  326.         SendClientMessage(playerid, COLOR_ADVICE,  "[!]: "PLAIN_TEXT"You can't use commands on a duel!");
  327.         return 0;
  328.     }
  329.     return 1;
  330. }
  331. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  332. {
  333.     if(newkeys == KEY_SPRINT)
  334.     {
  335.         if(PlayerInfo[playerid][DuelWatching] == 1)
  336.         {
  337.             TogglePlayerSpectating(playerid, 0);
  338.             TextDrawHideForPlayer(playerid, DuelSpec);
  339.         }
  340.     }
  341.     return 1;
  342. }
  343. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  344. {
  345.     switch(dialogid)
  346.     {
  347.         case DIALOG_DUEL_SPEC:
  348.         {
  349.             if(response)
  350.             {
  351.                 new id;
  352.                 if(sscanf(inputtext, "u", id)) SendClientMessage(playerid, COLOR_ADVICE, "[!]: "PLAIN_TEXT"Player disconnected.");
  353.                 else
  354.                 {
  355.                     PlayerInfo[playerid][DuelWatching] = 1;
  356.                     TogglePlayerSpectating(playerid, 1);
  357.                     SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(id));
  358.                     SetPlayerInterior(playerid, GetPlayerInterior(id));
  359.                     PlayerSpectatePlayer(playerid, id);
  360.                     TextDrawShowForPlayer(playerid, DuelSpec);
  361.                 }
  362.             }
  363.         }
  364.         case DIALOG_DUEL_WEAPONS:
  365.         {
  366.             if(response)
  367.             {
  368.                 new PlayerList[120];
  369.                 SetPVarString(playerid, "DuelWeapons", inputtext);
  370.                 SetPVarInt(playerid, "DuelWeaponsID", listitem);
  371.                 for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++)
  372.                 {
  373.                     if(IsPlayerConnected(i) && PlayerInfo[i][ActiveDuel] != 0&&  playerid != i)
  374.                     {
  375.                         strcat(PlayerList, PlayerName(i));
  376.                         strcat(PlayerList, "\n");
  377.                     }
  378.                 }
  379.                 if(!isnull(PlayerList)) ShowPlayerDialog(playerid, DIALOG_DUEL_INVITE, DIALOG_STYLE_LIST, ""M_TITLE"Select the player:", PlayerList, "Select", "Cancel");
  380.                 else SendClientMessage(playerid, COLOR_ADVICE, "[!]: "PLAIN_TEXT"There's no one online.");
  381.             }
  382.         }
  383.         case DIALOG_DUEL_INVITE:
  384.         {
  385.             if(response)
  386.             {
  387.                 new invited;
  388.                 if(sscanf(inputtext, "u", invited)) SendClientMessage(playerid, COLOR_ADVICE, "[!]: "PLAIN_TEXT"Player disconnected.");
  389.                 else if(PlayerInfo[invited][onDuel] != 0) SendClientMessage(playerid, COLOR_ADVICE, "[!]: "PLAIN_TEXT"This player is already on a duel. Use: /Duel View");
  390.                 else if(PlayerInfo[invited][DuelReceived] != -1 || PlayerInfo[invited][DuelInvited] != -1)
  391.                     SendClientMessage(playerid, COLOR_ADVICE, "[!]: "PLAIN_TEXT"This player has already a invitation, wait for his response.");
  392.                 else
  393.                 {
  394.                     new str[200], weapon[30];
  395.                     PlayerInfo[playerid][DuelInvited] = invited;
  396.                     PlayerInfo[invited][DuelReceived] = playerid;
  397.                     GetPVarString(playerid, "DuelWeapons", weapon, sizeof(weapon));
  398.                     format(str, sizeof(str), "You've invited %s to a duel (%s), wait for his response.", PlayerName(invited), weapon);
  399.                     SendClientMessage(playerid, COLOR_SUCCESS, str);
  400.                     format(str, sizeof(str), "! %s "PLAIN_TEXT"Has invited you to a duel (%s), Use (/Duel Accept) or (/Duel Decline)", PlayerName(playerid), weapon);
  401.                     SendClientMessage(invited, GetPlayerColor(playerid), str);
  402.                     DuelTimer = SetTimerEx("CancelDuel", 30000, 0, "dd", playerid, invited);
  403.                 }
  404.             }
  405.         }
  406.     }
  407.     return 1;
  408. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement