Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Duel Script Update v1.3
- -Patched glitch which allows players to join duel while spectating.
- -Fixed bug with duel info broken weapon format
- Duel Script Update v1.4.5
- .Add duel statistics dialog
- -Added duel spectate system
- -Player's color changes while in duel
- -Added sounds for the countdown
- -Fixed spec textdraw showing on exiting
- -Fixed spectate mode not showing right away
- */
- #include <a_samp>
- #include <zcmd>
- #include <dini>
- #include <sscanf2>
- //=====[Internal Settings]=====
- #define DUELDIAG 6550
- #define MAX_DUELS 40
- #define DUELFILES "/Duels/%d.ini"
- #define DUEL_IDFILE "/Duels/idset.ini"
- #define SPEC_UPDATE 1000
- #define Money_GivePlayerMoney GivePlayerMoney //Replace with your own money functions
- #define Money_GetPlayerMoney GetPlayerMoney
- #define MINMONEY 500 //Minimum duel bet money - Useful for A/D servers, set to 0 for A/D
- //=============================
- #define COLOR_RED 0xFF0000
- #define COLOR_DUEL 0x00C224
- new DuelTimer[MAX_PLAYERS];
- new UpdateSpecTimer[MAX_PLAYERS];
- forward DuelReset(player1, player2);
- forward DuelCDUpdate(playerid);
- forward UpdateSpectate(playerid);
- new dFile[70];
- new diagstr[900];
- new Text:SpecTD[MAX_PLAYERS][2];
- //Spec Diag
- new diagitem[25]; //store player id
- public OnFilterScriptInit()
- {
- SendClientMessageToAll(COLOR_DUEL, "Duel System v1.4 by PotH3Ad initialized!");
- print(" Duel System v1.4 by PotH3Ad initialized!");
- return 1;
- }
- public OnFilterScriptExit()
- {
- SendClientMessageToAll(COLOR_DUEL, "Duel System v1.4 by PotH3Ad has been unloaded!");
- print(" Duel System v1.4 by PotH3Ad has been unloaded!");
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- SetPVarInt(playerid, "dWep0", 0);
- SetPVarInt(playerid, "dWep1", 0);
- SetPVarInt(playerid, "dWep2", 0);
- SetPVarInt(playerid, "dPID", -1);
- SetPVarInt(playerid, "dLoc", -1);
- SetPVarInt(playerid, "dBet", 0);
- LoadDuelSpecTextdraw(playerid);
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- new duelerid = GetPVarInt(playerid, "InviterID");
- if(GetPVarInt(duelerid, "InDuel") == 1 && GetPVarInt(playerid, "InDuel") == 1)
- {
- new sReason[56];
- switch(reason)
- {
- case 0: format(sReason, sizeof(sReason), "Timeout");
- case 1: format(sReason, sizeof(sReason), "Leaving");
- case 2: format(sReason, sizeof(sReason), "Kicked");
- }
- new gBet = GetPVarInt(playerid, "DuelBet");
- new gDuelSpot = GetPVarInt(playerid, "DuelSpot");
- new Slot[3];
- Slot[0] = GetPVarInt(playerid, "dWeap1");
- Slot[1] = GetPVarInt(playerid, "dWeap2");
- Slot[2] = GetPVarInt(playerid, "dWeap3");
- Money_GivePlayerMoney(duelerid, gBet);
- new str[150];
- format(str, sizeof(str), "Duel | %s has left the server during a duel with %s (Reason: %s)", pName(playerid), pName(duelerid), sReason);
- SendClientMessageToAll(COLOR_DUEL, str);
- format(str, sizeof(str), "Duel | %s won the duel against %s (%s, %s, %s) (Bet: $%d) (%s [ID %d])", pName(duelerid), pName(playerid), weaponNames(Slot[0]), weaponNames(Slot[1]), weaponNames(Slot[2]), gBet, ReturnDuelNameFromID(gDuelSpot), gDuelSpot);
- SendClientMessageToAll(COLOR_DUEL, str);
- SetPlayerArmour(playerid, 0);
- SetPlayerArmour(duelerid, 0);
- RemoveFromDuel(playerid);
- RemoveFromDuel(duelerid);
- SpawnPlayer(duelerid);
- }
- TextDrawDestroy(SpecTD[playerid][0]);
- TextDrawDestroy(SpecTD[playerid][1]);
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- if(GetPVarInt(killerid, "InDuel") == 1 && GetPVarInt(playerid, "InDuel") == 1)
- {
- new gBet = GetPVarInt(playerid, "DuelBet");
- new gDuelSpot = GetPVarInt(playerid, "DuelSpot");
- new Slot[3];
- Slot[0] = GetPVarInt(killerid, "dWeap1");
- Slot[1] = GetPVarInt(killerid, "dWeap2");
- Slot[2] = GetPVarInt(killerid, "dWeap3");
- Money_GivePlayerMoney(playerid, -gBet);
- Money_GivePlayerMoney(killerid, gBet);
- new str[230], duelid[40];
- new HPT = GetRoundedTotalHP(playerid);
- format(duelid, sizeof(duelid), "%s", ReturnDuelNameFromID(gDuelSpot));
- format(str, sizeof(str), "Duel | %s won the duel against %s {0004B6}(HP %d) (%s %s %s) {009900}(Bet: $%d) {F8FF3D}(%s [ID %d])", pName(killerid), pName(playerid), HPT, weaponNames(Slot[0]), weaponNames(Slot[1]), weaponNames(Slot[2]), gBet, duelid, gDuelSpot);
- SendClientMessageToAll(COLOR_RED, str);
- SetPlayerArmour(playerid, 0);
- SetPlayerArmour(killerid, 0);
- RemoveFromDuel(playerid);
- RemoveFromDuel(killerid);
- SpawnPlayer(killerid);
- }
- else if(killerid == INVALID_PLAYER_ID && GetPVarInt(playerid, "InDuel") == 1)
- {
- new gBet = GetPVarInt(playerid, "DuelBet");
- new gDuelSpot = GetPVarInt(playerid, "DuelSpot");
- new Slot[3];
- Slot[0] = GetPVarInt(playerid, "dWeap1");
- Slot[1] = GetPVarInt(playerid, "dWeap2");
- Slot[2] = GetPVarInt(playerid, "dWeap3");
- Money_GivePlayerMoney(playerid, -gBet);
- Money_GivePlayerMoney(killerid, gBet);
- new str[220];
- format(str, sizeof(str), "Duel | %s commited suicide during a duel with %s {0004B6}(%s %s %s) {009900}(Bet: $%d) {F8FF3D}(%s [ID %d])", pName(playerid), pName(GetPVarInt(playerid, "InviterID")), weaponNames(Slot[0]), weaponNames(Slot[1]), weaponNames(Slot[2]), gBet, ReturnDuelNameFromID(gDuelSpot), gDuelSpot);
- SendClientMessageToAll(COLOR_DUEL, str);
- new duelerid = GetPVarInt(playerid, "InviterID");
- SetPlayerArmour(playerid, 0);
- SetPlayerArmour(duelerid, 0);
- RemoveFromDuel(duelerid);
- RemoveFromDuel(playerid);
- SpawnPlayer(duelerid);
- }
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if(newkeys == KEY_FIRE)
- {
- new specid = GetPVarInt(playerid, "DuelSpecID");
- if(GetPVarInt(playerid, "DuelSpec") && IsPlayerInDuel(specid))
- {
- new dueler = GetPVarInt(specid, "InviterID");
- SetPlayerSpectatingDuel(playerid, dueler);
- }
- }
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == DUELDIAG)
- {
- if(response)
- {
- switch(listitem)
- {
- case 0: //Choose player
- {
- ShowPlayerDialog(playerid, DUELDIAG+1, DIALOG_STYLE_INPUT, "Select a player", "Type in the name/playerid of the player you want\nto invite to a duel.\nNOTE: You can enter partial names.", "Continue", "Back");
- }
- case 1: //Choose Duel location
- {
- format(diagstr, sizeof(diagstr), "ID\tDuel Name\n");
- for(new x=0; x<MAX_DUELS; x++)
- {
- format(dFile, sizeof(dFile), DUELFILES, x);
- if(strlen(dini_Get(dFile, "duelName")) > 0) format(diagstr, sizeof(diagstr), "%s%d\t%s\n", diagstr, x, dini_Get(dFile, "duelName"));
- else format(diagstr, sizeof(diagstr), "%s%d\tEmpty Slot\n", diagstr, x);
- }
- ShowPlayerDialog(playerid, DUELDIAG+2, DIALOG_STYLE_LIST, "Duel List", diagstr, "Select", "Exit");
- return 1;
- }
- case 2: //Choose weapons
- {
- ShowPlayerDialog(playerid, DUELDIAG+5, DIALOG_STYLE_LIST, "Select Weapon Slot", "Slot 1\nSlot 2\nSlot 3", "Select", "Back");
- }
- case 3: //Choose Duel Money
- {
- ShowPlayerDialog(playerid, DUELDIAG+4, DIALOG_STYLE_INPUT, "Set Bet Amount", "Set the bet amount for the duel.\nThe winner takes the money and the loser\nloses this amount of money.", "Set", "Back");
- }
- case 4: //Send invitation
- {
- new str[80];
- new dPID = GetPVarInt(playerid, "dPID");
- new dBet = GetPVarInt(playerid, "dBet");
- new dLoc = GetPVarInt(playerid, "dLoc");
- new dWep[3], key[7];
- for(new x=0; x<=2; x++)
- {
- format(key, sizeof(key), "dWep%d", x);
- dWep[x] = GetPVarInt(playerid, key);
- }
- format(str, sizeof(str), "invite %d %d %d %d %d %d", dPID, dBet, dLoc, dWep[0], dWep[1], dWep[2]);
- return cmd_duel(playerid, str);
- }
- case 5: //Cancel invitation
- {
- return SendClientMessage(playerid, COLOR_DUEL, "Duel invite was canceled, duel settings were saved.");
- }
- }
- }
- }
- if(dialogid == DUELDIAG+1)
- {
- if(response)
- {
- new invitee;
- if(sscanf(inputtext, "u", invitee)) return ShowPlayerDialog(playerid, DUELDIAG+1, DIALOG_STYLE_INPUT, "Select a player", "Type in the name/playerid of the player you want\nto invite to a duel.\nNOTE: You can enter partial names.", "Continue", "Back");
- if(invitee == INVALID_PLAYER_ID) return ShowPlayerDialog(playerid, DUELDIAG+1, DIALOG_STYLE_INPUT, "Select a player", "ERROR: The player specified is not connected, try again!\nType in the name/playerid of the player you want\nto invite to a duel.\nNOTE: You can enter partial names.", "Continue", "Back");
- SetPVarInt(playerid, "dPID", invitee);
- ShowDuelSettingsDialog(playerid);
- }
- else ShowDuelSettingsDialog(playerid);
- }
- if(dialogid == DUELDIAG+2)
- {
- if(response)
- {
- format(dFile, sizeof(dFile), DUELFILES, listitem-1);
- if(!dini_Exists(dFile)) return OnDialogResponse(playerid, DUELDIAG, 1, 1, "blank");
- SetPVarInt(playerid, "dLoc", listitem-1);
- ShowDuelSettingsDialog(playerid);
- }
- else ShowDuelSettingsDialog(playerid);
- }
- if(dialogid == DUELDIAG+4) //Duel money
- {
- if(response)
- {
- new amount;
- if(sscanf(inputtext, "d", amount)) return ShowPlayerDialog(playerid, DUELDIAG+4, DIALOG_STYLE_INPUT, "Set Bet Amount", "Enter the bet amount for the duel.\nThe winner takes the money and the loser\nloses this amount of money.", "Set", "Back");
- if(amount < 500) return ShowPlayerDialog(playerid, DUELDIAG+4, DIALOG_STYLE_INPUT, "Set Bet Amount", "ERROR: Bet amount must be higher then $500!\nSet the bet amount for the duel.\nThe winner takes the money and the loser\nloses this amount of money.", "Set", "Back");
- SetPVarInt(playerid, "dBet", amount);
- ShowDuelSettingsDialog(playerid);
- }
- else ShowDuelSettingsDialog(playerid);
- }
- if(dialogid == DUELDIAG+5) //Weapon slots
- {
- if(response)
- {
- SetPVarInt(playerid, "dWSlot", listitem);
- ShowPlayerDialog(playerid, DUELDIAG+6, DIALOG_STYLE_LIST, "Choose a weapon", "Brass Knuckles\nGolf Club\nNite Stick\nKnife\nBaseball Bat\nShovel\nPool Cue\nKatana\nChainsaw\nDildo\nVibrator\nFlowers\nCane\nGrenade\nTeargas\nMolotov\nColt 45\nSilenced Pistol\nDeagle\nShotgun\nSawns\nSpas\nUzi\nMP5\nAK47\nM4\nTec9\nRifle\nSniper", "Select", "Back");
- }
- else ShowDuelSettingsDialog(playerid);
- }
- if(dialogid == DUELDIAG+6)
- {
- if(response)
- {
- new key[7];
- format(key, sizeof(key), "dWep%d", GetPVarInt(playerid, "dWSlot"));
- switch(listitem)
- {
- case 13..15:
- {
- ShowPlayerDialog(playerid, DUELDIAG+6, DIALOG_STYLE_LIST, "Choose a weapon", "Brass Knuckles\nGolf Club\nNite Stick\nKnife\nBaseball Bat\nShovel\nPool Cue\nKatana\nChainsaw\nDildo\nVibrator\nFlowers\nCane\nGrenade\nTeargas\nMolotov\nColt 45\nSilenced Pistol\nDeagle\nShotgun\nSawns\nSpas\nUzi\nMP5\nAK47\nM4\nTec9\nRifle\nSniper", "Select", "Back");
- return SendClientMessage(playerid, COLOR_RED, "ERROR: This weapon is disabled!");
- }
- }
- switch(listitem)
- {
- case 0: SetPVarInt(playerid, key, 1);
- case 1: SetPVarInt(playerid, key, 2);
- case 2: SetPVarInt(playerid, key, 3);
- case 3: SetPVarInt(playerid, key, 4);
- case 4: SetPVarInt(playerid, key, 5);
- case 5: SetPVarInt(playerid, key, 6);
- case 6: SetPVarInt(playerid, key, 7);
- case 7: SetPVarInt(playerid, key, 8);
- case 8: SetPVarInt(playerid, key, 9);
- case 9: SetPVarInt(playerid, key, 10);
- case 10: SetPVarInt(playerid, key, 11);
- case 11: SetPVarInt(playerid, key, 14);
- case 12: SetPVarInt(playerid, key, 15);
- case 13: SetPVarInt(playerid, key, 16);
- case 14: SetPVarInt(playerid, key, 17);
- case 15: SetPVarInt(playerid, key, 18);
- case 16: SetPVarInt(playerid, key, 22);
- case 17: SetPVarInt(playerid, key, 23);
- case 18: SetPVarInt(playerid, key, 24);
- case 19: SetPVarInt(playerid, key, 25);
- case 20: SetPVarInt(playerid, key, 26);
- case 21: SetPVarInt(playerid, key, 27);
- case 22: SetPVarInt(playerid, key, 28);
- case 23: SetPVarInt(playerid, key, 29);
- case 24: SetPVarInt(playerid, key, 30);
- case 25: SetPVarInt(playerid, key, 31);
- case 26: SetPVarInt(playerid, key, 32);
- case 27: SetPVarInt(playerid, key, 33);
- case 28: SetPVarInt(playerid, key, 34);
- }
- ShowDuelSettingsDialog(playerid);
- }
- else ShowDuelSettingsDialog(playerid);
- }
- if(dialogid == DUELDIAG+7)
- {
- if(response)
- {
- if(!IsPlayerInDuel(diagitem[listitem])) return 1;
- SetPlayerSpectatingDuel(playerid, diagitem[listitem]);
- }
- else return 1;
- }
- return 0;
- }
- CMD:duelmenu(playerid, params[])
- {
- ShowDuelSettingsDialog(playerid);
- return 1;
- }
- CMD:duels(playerid, params[])
- {
- new tduels;
- format(diagstr, sizeof(diagstr), "");
- for(new x=0; x<MAX_PLAYERS; x++)
- {
- if(GetPVarInt(x, "InDuel") == 1)
- {
- for(new i=0; i<sizeof(diagitem); i++) if(x == diagitem[i]) continue; //Prevent duplicate duels
- new dueler = GetPVarInt(x, "InviterID");
- format(diagstr, sizeof(diagstr), "%s%s vs %s\n", diagstr, pName(x), pName(dueler));
- diagitem[tduels] = x;
- tduels++;
- }
- }
- if(tduels < 1) format(diagstr, sizeof(diagstr), "There are currently no duels.");
- ShowPlayerDialog(playerid, DUELDIAG+7, DIALOG_STYLE_LIST, "Current Duels", diagstr, "Select", "Cancel");
- return 1;
- }
- CMD:duel(playerid, params[])
- {
- if(strfind(params, "create", true) != -1)
- {
- new third[60];
- sscanf(params[7], "s[60]", third);
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You are not an admin!");
- if(GetPVarInt(playerid, "DuelEdit") == 1) return SendClientMessage(playerid, COLOR_RED, "You are already editing a duel!");
- new dName[90];
- if(unformat(third, "s[90]", dName)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /duel <create> <duelname>");
- else if(!strlen(dName)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /duel <create> <duelname>");
- else if(DuelNameExists(dName)) return SendClientMessage(playerid, COLOR_RED, "This duel name already exists");
- new getid = GetLowestDuelSlotID();
- format(dFile, sizeof(dFile), DUELFILES, getid);
- new Float:X, Float:Y, Float:Z, Float:A;
- GetPlayerPos(playerid, X, Y, Z);
- GetPlayerFacingAngle(playerid, A);
- new dInterior = GetPlayerInterior(playerid);
- dini_Create(dFile);
- dini_IntSet(dFile, "duelID", getid);
- dini_Set(dFile, "duelName", dName);
- dini_FloatSet(dFile, "duelX", X);
- dini_FloatSet(dFile, "duelY", Y);
- dini_FloatSet(dFile, "duelZ", Z);
- dini_FloatSet(dFile, "duelA", A);
- dini_IntSet(dFile, "duelInt", dInterior);
- SetPVarInt(playerid, "DuelEdit", 1);
- SetPVarInt(playerid, "DuelID", getid);
- new str[200];
- format(str, sizeof(str), "Duel \"%s\" (ID: %d) created at: %f, %f, %f (Interior: %d)", dName, getid, X, Y, Z, dInterior);
- SendClientMessage(playerid, COLOR_DUEL, str);
- SendClientMessage(playerid, COLOR_DUEL, "Now go the second duelist position and type \"/duel <save>\" to set the position.");
- return 1;
- }
- if(strfind(params, "save", true) != -1)
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You are not an admin!");
- if(GetPVarInt(playerid, "DuelEdit") == 0) return SendClientMessage(playerid, COLOR_RED, "You are not editing a duel.");
- new duelID = GetPVarInt(playerid, "DuelID");
- format(dFile, sizeof(dFile), DUELFILES, duelID);
- new Float:X, Float:Y, Float:Z, Float:A;
- GetPlayerPos(playerid, X, Y, Z);
- GetPlayerFacingAngle(playerid, A);
- dini_FloatSet(dFile, "duel2X", X);
- dini_FloatSet(dFile, "duel2Y", Y);
- dini_FloatSet(dFile, "duel2Z", Z);
- dini_FloatSet(dFile, "duel2A", A);
- new str[180];
- format(str, sizeof(str), "Duel \"%s\" (ID: %d) second position set at: %f, %f, %f", ReturnDuelNameFromID(duelID), duelID, X, Y, Z);
- SendClientMessage(playerid, COLOR_DUEL, str);
- SetPVarInt(playerid, "DuelEdit", 0);
- SetPVarInt(playerid, "DuelID", -1);
- return 1;
- }
- if(strfind(params, "invite", true) != -1)
- {
- new third[60];
- sscanf(params[7], "s[60]", third);
- new gTarget, gBet, gDuelSpot[85], gWeap[85], gWeap2[85], gWeap3[85];
- sscanf(third, "uis[85]s[85]s[85]s[85]", gTarget, gBet, gDuelSpot, gWeap, gWeap2, gWeap3);
- if(gTarget == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "Duel | Player not found");
- if(GetPVarInt(playerid, "InDuel") == 1) return SendClientMessage(playerid, COLOR_DUEL, "Duel | You are already in a duel!");
- if(GetPVarInt(playerid, "DInvited") == 1 || GetPVarInt(playerid, "DInvited") == 2) return SendClientMessage(playerid, COLOR_DUEL, "Duel | You can't invite someone when you have been invited!");
- if(gBet < 500) return SendClientMessage(playerid, COLOR_RED, "Duel | Minimum bet amount is 500");
- if(MINMONEY != 0 && Money_GetPlayerMoney(playerid) < gBet) return SendClientMessage(playerid, COLOR_RED, "Duel | You don't have that amount of money to bet");
- if(MINMONEY != 0 && Money_GetPlayerMoney(gTarget) < gBet) return SendClientMessage(playerid, COLOR_RED, "Duel | This player does not have that amount of money!");
- if(ReturnDuelIDOrName(gDuelSpot) == -1) return SendClientMessage(playerid, COLOR_RED, "The duel id/name you entered does not exist!");
- if(ReturnWeaponIDOrName(gWeap) == -1) return SendClientMessage(playerid, COLOR_RED, "Slot 1: Invalid Weapon ID or Name");
- if(GetPlayerState(gTarget) == 9) return SendClientMessage(playerid, COLOR_RED, "Duel | This player is in spectate mode!");
- if(!strlen(gWeap2)) format(gWeap2, sizeof(gWeap2), "48");
- if(!strlen(gWeap3)) format(gWeap3, sizeof(gWeap3), "48");
- new duelID = ReturnDuelIDOrName(gDuelSpot);
- if(GetPVarInt(gTarget, "DInvited") == 1 || GetPVarInt(gTarget, "DInvited") == 2) return SendClientMessage(playerid, COLOR_DUEL, "Duel | This player has already been invited to a duel");
- if(GetPVarInt(gTarget, "InDuel") == 1) return SendClientMessage(playerid, COLOR_DUEL, "Duel | This player is currently in a duel!");
- SetPVarInt(playerid, "DInvited", 1);
- SetPVarInt(playerid, "InviterID", gTarget);
- SetPVarInt(playerid, "DuelBet", gBet);
- SetPVarInt(playerid, "DuelSpot", duelID);
- SetPVarInt(gTarget, "DInvited", 2);
- SetPVarInt(gTarget, "InviterID", playerid);
- SetPVarInt(gTarget, "DuelBet", gBet);
- SetPVarInt(gTarget, "DuelSpot", duelID);
- DuelTimer[playerid] = SetTimerEx("DuelReset", 15000, 0, "ii", playerid, gTarget);
- new Slot[3];
- Slot[0] = ReturnWeaponIDOrName(gWeap);
- Slot[1] = ReturnWeaponIDOrName(gWeap2);
- Slot[2] = ReturnWeaponIDOrName(gWeap3);
- SetPVarInt(gTarget, "dWeap1", Slot[0]);
- SetPVarInt(gTarget, "dWeap2", Slot[1]);
- SetPVarInt(gTarget, "dWeap3", Slot[2]);
- SetPVarInt(playerid, "dWeap1", Slot[0]);
- SetPVarInt(playerid, "dWeap2", Slot[1]);
- SetPVarInt(playerid, "dWeap3", Slot[2]);
- new str[150];
- format(str, sizeof(str), "Duel invite from %s | (Bet: $%d) (%s %s %s) (%s [ID %d])", pName(playerid), gBet, weaponNames(Slot[0]), weaponNames(Slot[1]), weaponNames(Slot[2]), ReturnDuelNameFromID(duelID), duelID);
- SendClientMessage(gTarget, COLOR_DUEL, str);
- SendClientMessage(gTarget, COLOR_DUEL, "Type /yes or /no to accept/deny the duel invite");
- format(str, sizeof(str), "Duel | Waiting for %s's response to your duel invite", pName(gTarget));
- SendClientMessage(playerid, COLOR_DUEL, str);
- return 1;
- }
- if(strfind(params, "edit", true) != -1)
- {
- new third[60];
- sscanf(params[5], "s[60]", third);
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You are not an admin!");
- if(GetPVarInt(playerid, "DuelEdit") == 1) return SendClientMessage(playerid, COLOR_RED, "You are already editing a duel!");
- new dName[90];
- if(unformat(third, "s[90]", dName)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /duel <edit> <duelid/name>");
- else if(!strlen(dName)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /duel <edit> <duelid/name>");
- else if(ReturnDuelIDOrName(dName) == -1) return SendClientMessage(playerid, COLOR_RED, "The duelid/name specified does not exist!");
- new getid = ReturnDuelIDOrName(dName);
- format(dFile, sizeof(dFile), DUELFILES, getid);
- new Float:X, Float:Y, Float:Z, Float:A;
- GetPlayerPos(playerid, X, Y, Z);
- GetPlayerFacingAngle(playerid, A);
- new dInterior = GetPlayerInterior(playerid);
- dini_FloatSet(dFile, "duelX", X);
- dini_FloatSet(dFile, "duelY", Y);
- dini_FloatSet(dFile, "duelZ", Z);
- dini_FloatSet(dFile, "duelA", A);
- dini_FloatSet(dFile, "duelInt", -dInterior);
- SetPVarInt(playerid, "DuelEdit", 1);
- SetPVarInt(playerid, "DuelID", getid);
- new str[200];
- format(str, sizeof(str), "Duel \"%s\" (ID: %d) edited at: %f, %f, %f (Interior: %d)", dName, getid, X, Y, Z, dInterior);
- SendClientMessage(playerid, COLOR_DUEL, str);
- SendClientMessage(playerid, COLOR_DUEL, "Now go the second duelist position and type \"/duel save\" to set the position.");
- return 1;
- }
- if(strfind(params, "setname", true) != -1)
- {
- new third[60];
- sscanf(params[8], "s[60]", third);
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You are not an admin!");
- new dName[90], dNewName[35];
- if(unformat(third, "s[90]s[35]", dName, dNewName)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /duel <setname> <duelid/name> <newduelname>");
- else if(!strlen(dName)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /duel <setname> <duelid/name> <newduelname>");
- else if(ReturnDuelIDOrName(dName) == -1) return SendClientMessage(playerid, COLOR_RED, "The duelid/name specified does not exist!");
- else if(strlen(dNewName) > 35) return SendClientMessage(playerid, COLOR_RED, "Max duel name length is 50 characters");
- new getid = ReturnDuelIDOrName(dName);
- format(dFile, sizeof(dFile), DUELFILES, getid);
- dini_Set(dFile, "duelName", dNewName);
- new str[200];
- format(str, sizeof(str), "Duel \"%s\" (ID: %d) is now named \"%s\"", dName, getid, dNewName);
- SendClientMessage(playerid, COLOR_DUEL, str);
- return 1;
- }
- if(strfind(params, "remove", true) != -1)
- {
- new third[60];
- sscanf(params[7], "s[60]", third);
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "ERROR: You are not an admin!");
- new dName[90];
- if(unformat(third, "s[90]", dName)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /duel <remove> <duelid/name>");
- else if(!strlen(dName)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /duel <remove> <duelid/name>");
- else if(!DuelNameExists(dName)) return SendClientMessage(playerid, COLOR_RED, "The duel id/name specified does not exist");
- else if(ReturnDuelIDOrName(dName) == -1) return SendClientMessage(playerid, COLOR_RED, "The duel id/name specified does not exist");
- new duelID = ReturnDuelIDOrName(dName);
- format(dFile, sizeof(dFile), DUELFILES, duelID);
- dini_Remove(dFile);
- new str[100];
- format(str, sizeof(str), "Duel \"%s\" (ID: %d) has been removed!", dName, duelID);
- SendClientMessage(playerid, COLOR_DUEL, str);
- return 1;
- }
- if(strfind(params, "help", true) != -1)
- {
- ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "Duel Help", "Invite someone to a duel:\n/duel <invite> <playerid/name> <betamount> <duelspot> <wep1> <wep2> <wep3>\n\nExample: \"/duel invite Noob 500 SFBridge spas deagle\"\nYou may enter partial weapon names.\nYou may use a minimum of 1 weapon and a max of 3.", "Ok", "");
- return 1;
- }
- if(strfind(params, "cmds", true) != -1)
- {
- if(!IsPlayerAdmin(playerid)) ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "Duel Commands", "User Commands:\n\n/duel <cmds>, /duel <help>, /duel <invite>", "Ok", "");
- else ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "Duel Commands", "User Commands:\n\n/duel <cmds>, /duel <help>, /duel <invite>\n\nBuilder Commands\n\n/duel <create>\n/duel <save>\n/duel <edit>\n/duel <setname>\n/duel <remove>", "Ok", "");
- return 1;
- }
- if(strfind(params, "spec", true) != -1)
- {
- new third[60];
- sscanf(params[5], "s[60]", third);
- new target;
- sscanf(third, "u", target);
- if(target == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "Duel | Player not found");
- if(GetPVarInt(target, "InDuel") == 0) return SendClientMessage(playerid, COLOR_DUEL, "Duel | This player is not currently in a duel!");
- /*new str[150];
- format(str, sizeof(str), "Duel invite from %s | (Bet: $%d) (Weapons: %s, %s, %s) (Place: %s [ID: %d])", pName(playerid), gBet, weaponNames(Slot[0]), weaponNames(Slot[1]), weaponNames(Slot[2]), ReturnDuelNameFromID(duelID), duelID);
- SendClientMessage(gTarget, COLOR_DUEL, str);
- SendClientMessage(gTarget, COLOR_DUEL, "Type /yes or /no to accept/deny the duel invite");
- format(str, sizeof(str), "Duel | Waiting for %s's response to your duel invite", pName(gTarget));
- SendClientMessage(playerid, COLOR_DUEL, str);*/
- SetPlayerSpectatingDuel(playerid, target);
- return 1;
- }
- else ShowDuelSettingsDialog(playerid);
- return 1;
- }
- CMD:yes(playerid, params[])
- {
- if(GetPVarInt(playerid, "DInvited") != 2) return SendClientMessage(playerid, COLOR_RED, "You haven't been invited to a duel!");
- if(GetPVarInt(playerid, "InDuel") == 1) return SendClientMessage(playerid, COLOR_RED, "You are already in a duel");
- new gPlayer = GetPVarInt(playerid, "InviterID");
- new gBet = GetPVarInt(playerid, "DuelBet");
- if(MINMONEY != 0 && Money_GetPlayerMoney(playerid) < gBet)
- {
- SendClientMessage(playerid, COLOR_RED, "Duel | You don't have that amount of money!");
- SendClientMessage(gPlayer, COLOR_RED, "Duel | The player you invited no longer has that amount of money to bet!");
- SetPlayerArmour(playerid, 0);
- SetPlayerArmour(gPlayer, 0);
- RemoveFromDuel(playerid);
- RemoveFromDuel(gPlayer);
- return 1;
- }
- new gDuelSpot = GetPVarInt(playerid, "DuelSpot");
- format(dFile, sizeof(dFile), DUELFILES, gDuelSpot);
- new Interior = dini_Int(dFile, "duelInt");
- new Float:X, Float:Y, Float:Z, Float:A;
- X = dini_Float(dFile, "duelX");
- Y = dini_Float(dFile, "duelY");
- Z = dini_Float(dFile, "duelZ");
- A = dini_Float(dFile, "duelA");
- new Float:X2, Float:Y2, Float:Z2, Float:A2;
- X2 = dini_Float(dFile, "duel2X");
- Y2 = dini_Float(dFile, "duel2Y");
- Z2 = dini_Float(dFile, "duel2Z");
- A2 = dini_Float(dFile, "duelA2");
- new Slot[3];
- Slot[0] = GetPVarInt(playerid, "dWeap1");
- Slot[1] = GetPVarInt(playerid, "dWeap2");
- Slot[2] = GetPVarInt(playerid, "dWeap3");
- new world = playerid;
- if(gPlayer > playerid) world = gPlayer;
- else if(playerid > gPlayer) world = playerid;
- AddToDuel(gPlayer, X2, Y2, Z2, A2, Interior, world, Slot[0], Slot[1], Slot[2]);
- AddToDuel(playerid, X, Y, Z, A, Interior, world, Slot[0], Slot[1], Slot[2]);
- new str[150];
- format(str, sizeof(str), "Duel | %s vs %s {0004B6}(Weapons: %s, %s, %s) {009900}(Bet: $%d) {F8FF3D}(Place: %s [ID: %d])", pName(gPlayer), pName(playerid), weaponNames(Slot[0]), weaponNames(Slot[1]), weaponNames(Slot[2]), gBet, ReturnDuelNameFromID(gDuelSpot), gDuelSpot);
- SendClientMessageToAll(COLOR_DUEL, str);
- return 1;
- }
- CMD:no(playerid, params[])
- {
- if(GetPVarInt(playerid, "DInvited") != 2) return SendClientMessage(playerid, COLOR_RED, "You haven't been invited to a duel!");
- if(GetPVarInt(playerid, "InDuel") == 1) return SendClientMessage(playerid, COLOR_RED, "You are currently in a duel");
- new gDueler = GetPVarInt(playerid, "InviterID");
- new str[50];
- format(str, sizeof(str), "Duel | %s has declined your duel invite", pName(playerid));
- SendClientMessage(gDueler, COLOR_DUEL, str);
- SetPlayerArmour(playerid, 0);
- SetPlayerArmour(gDueler, 0);
- RemoveFromDuel(playerid);
- RemoveFromDuel(gDueler);
- return 1;
- }
- stock ShowDuelSettingsDialog(playerid)
- {
- new str[255], wepstr[3][40], key[7];
- new dPID = GetPVarInt(playerid, "dPID");
- new dLoc = GetPVarInt(playerid, "dLoc");
- for(new x=0; x<=2; x++)
- {
- format(key, sizeof(key), "dWep%d", x);
- new wep = GetPVarInt(playerid, key);
- format(wepstr[x], 40, "%s", weaponNames(wep));
- }
- format(str, sizeof(str), "{009900}Player:\t\t{0004B6}%s [%d]\n{009900}Location:\t{0004B6}%s [%d]\n{009900}Weapons:\t{0004B6}%s/%s/%s\n{009900}Bet Money:{009900}\t{0004B6}$%d\n{009900}Send Invite\n{009900}Cancel Invite", pName(dPID), dPID, ReturnDuelNameFromID(dLoc), dLoc, wepstr[0], wepstr[1], wepstr[2], GetPVarInt(playerid, "dBet"));
- ShowPlayerDialog(playerid, DUELDIAG, DIALOG_STYLE_LIST, "Duel Settings", str, "Select", "Cancel");
- return 1;
- }
- //=========[Duel Callbacks]========
- public DuelReset(player1, player2)
- {
- new str[50];
- format(str, sizeof(str), "%s didn't respond to your duel invite", pName(player2));
- SendClientMessage(player1, COLOR_DUEL, str);
- SetPlayerArmour(player1, 0);
- SetPlayerArmour(player2, 0);
- RemoveFromDuel(player1);
- RemoveFromDuel(player2);
- return 1;
- }
- public DuelCDUpdate(playerid)
- {
- SetPVarInt(playerid, "CDTick", GetPVarInt(playerid, "CDTick")+1);
- if(GetPVarInt(playerid, "CDTick") > 3)
- {
- TogglePlayerControllable(playerid, 1);
- GameTextForPlayer(playerid, "~R~Fight!", 1000, 6);
- SetPVarInt(playerid, "CDTick", 0);
- KillTimer(DuelTimer[playerid]);
- PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
- }
- else
- {
- GameTextForPlayer(playerid, "~P~Starting...", 500, 6);
- PlayerPlaySound(playerid, 1056, 0.0, 0.0, 0.0);
- }
- return 1;
- }
- //=========[Duel Callbacks - END]==========
- stock AddToDuel(playerid, Float:X, Float:Y, Float:Z, Float:A, interior, world, wep1, wep2, wep3)
- {
- KillTimer(DuelTimer[playerid]);
- SetPVarInt(playerid, "CDTick", 0);
- SetPVarInt(playerid, "InDuel", 1);
- SetPVarInt(playerid, "ArmourReport", 1);
- SetPVarInt(playerid, "DInvited", 0);
- SetPlayerPosEx(playerid, X, Y, Z, A, interior, world);
- SetPlayerArmour(playerid, 100);
- SetPlayerHealth(playerid, 100);
- ResetPlayerWeapons(playerid);
- GivePlayerWeapon(playerid, wep1, 1337);
- GivePlayerWeapon(playerid, wep2, 1337);
- GivePlayerWeapon(playerid, wep3, 1337);
- TogglePlayerControllable(playerid, 0);
- SetCameraBehindPlayer(playerid);
- DuelTimer[playerid] = SetTimerEx("DuelCDUpdate", 1000, 1, "i", playerid);
- SetPlayerColor(playerid, COLOR_DUEL);
- return 1;
- }
- stock RemoveFromDuel(playerid)
- {
- KillTimer(DuelTimer[playerid]);
- SetPlayerArmour(playerid, 0);
- SetPlayerVirtualWorld(playerid, 0);
- SetPVarInt(playerid, "DInvited", 0);
- SetPVarInt(playerid, "InviterID", -1);
- SetPVarInt(playerid, "DuelBet", -1);
- SetPVarInt(playerid, "DuelSpot", -1);
- SetPVarInt(playerid, "dWeap1", -1);
- SetPVarInt(playerid, "dWeap2", -1);
- SetPVarInt(playerid, "dWeap3", -1);
- SetPVarInt(playerid, "ArmorReport", 0);
- SetPVarInt(playerid, "InDuel", 0);
- return 1;
- }
- stock SetPlayerPosEx(playerid, Float:X, Float:Y, Float:Z, Float:angle, interior, world)
- {
- SetPlayerPos(playerid, X, Y, Z);
- SetPlayerFacingAngle(playerid, angle);
- SetPlayerInterior(playerid, interior);
- SetPlayerVirtualWorld(playerid, world);
- return 1;
- }
- stock IsValidWeapon(weaponid)
- {
- switch(weaponid)
- {
- case 0, 19, 20, 21, 35..46: return 0;
- }
- if(weaponid < 0 || weaponid > 48) return 0;
- return 1;
- }
- //=========[Duel Spectate Functions]==========
- stock LoadDuelSpecTextdraw(playerid)
- {
- SpecTD[playerid][0] = TextDrawCreate(180.000000, 364.000000, "_");
- TextDrawBackgroundColor(SpecTD[playerid][0], 255);
- TextDrawFont(SpecTD[playerid][0], 3);
- TextDrawLetterSize(SpecTD[playerid][0], 0.469999, 1.200000);
- TextDrawColor(SpecTD[playerid][0], 52479);
- TextDrawSetOutline(SpecTD[playerid][0], 0);
- TextDrawSetProportional(SpecTD[playerid][0], 1);
- TextDrawSetShadow(SpecTD[playerid][0], 1);
- SpecTD[playerid][1] = TextDrawCreate(180.000000, 387.000000, "_");
- TextDrawBackgroundColor(SpecTD[playerid][1], 255);
- TextDrawFont(SpecTD[playerid][1], 3);
- TextDrawLetterSize(SpecTD[playerid][1], 0.469999, 1.200000);
- TextDrawColor(SpecTD[playerid][1], -1);
- TextDrawSetOutline(SpecTD[playerid][1], 0);
- TextDrawSetProportional(SpecTD[playerid][1], 1);
- TextDrawSetShadow(SpecTD[playerid][1], 1);
- TextDrawHideForAll(SpecTD[playerid][0]);
- TextDrawHideForAll(SpecTD[playerid][1]);
- }
- public UpdateSpectate(playerid)
- {
- new specid = GetPVarInt(playerid, "DuelSpecID");
- if(!IsPlayerInDuel(specid)) return EndDuelSpectate(playerid);
- else ShowDuelSpecTextdraw(playerid, specid);
- SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(specid));
- SetPlayerInterior(playerid, GetPlayerInterior(specid));
- return 1;
- }
- stock EndDuelSpectate(playerid)
- {
- KillTimer(UpdateSpecTimer[playerid]);
- SetPVarInt(playerid, "DuelSpecID", -1);
- SetPVarInt(playerid, "DuelSpec", 0);
- SendClientMessage(playerid, COLOR_DUEL, "Duel spectate ended, duel is no longer in progress.");
- TogglePlayerSpectating(playerid, 0);
- KillTimer(UpdateSpecTimer[playerid]);
- TextDrawHideForPlayer(playerid, SpecTD[playerid][0]);
- TextDrawHideForPlayer(playerid, SpecTD[playerid][1]);
- return 1;
- }
- stock SetPlayerSpectatingDuel(playerid, duelerid)
- {
- TogglePlayerSpectating(playerid, 1);
- SendClientMessage(playerid, COLOR_DUEL, "You have entered duel spectate mode!");
- SendClientMessage(playerid, COLOR_DUEL, "Press ~k~~PED_FIREWEAPON~ to switch between duelists.");
- ShowDuelSpecTextdraw(playerid, duelerid);
- KillTimer(UpdateSpecTimer[playerid]);
- UpdateSpecTimer[playerid] = SetTimerEx("UpdateSpectate", 1000, 1, "d", playerid);
- SetPVarInt(playerid, "DuelSpecID", duelerid);
- SetPVarInt(playerid, "DuelSpec", 1);
- SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(duelerid));
- SetPlayerInterior(playerid, GetPlayerInterior(duelerid));
- PlayerSpectatePlayer(playerid, duelerid, SPECTATE_MODE_NORMAL);
- }
- stock ShowDuelSpecTextdraw(playerid, duelerid)
- {
- new sstr[100], sstr2[140];
- new duelid[40];
- new gBet = GetPVarInt(duelerid, "DuelBet");
- new gDuelSpot = GetPVarInt(duelerid, "DuelSpot");
- new dueler = GetPVarInt(duelerid, "InviterID");
- format(duelid, sizeof(duelid), "%s", ReturnDuelNameFromID(gDuelSpot));
- new Slot[3];
- Slot[0] = GetPVarInt(duelerid, "dWeap1");
- Slot[1] = GetPVarInt(duelerid, "dWeap2");
- Slot[2] = GetPVarInt(duelerid, "dWeap3");
- format(sstr, sizeof(sstr), "%s vs %s~n~~R~HP ~W~%d %d", pName(duelerid), pName(dueler), GetRoundedTotalHP(duelerid), GetRoundedTotalHP(dueler));
- format(sstr2, sizeof(sstr2), "~Y~Location ~w~%s~n~~p~Weapons ~w~%s %s %s~n~~g~Bet Money ~w~$%d",
- duelid, weaponNames(Slot[0]), weaponNames(Slot[1]), weaponNames(Slot[2]), gBet);
- TextDrawHideForPlayer(playerid, SpecTD[playerid][0]);
- TextDrawHideForPlayer(playerid, SpecTD[playerid][1]);
- TextDrawSetString(SpecTD[playerid][0], sstr);
- TextDrawSetString(SpecTD[playerid][1], sstr2);
- TextDrawShowForPlayer(playerid, SpecTD[playerid][0]);
- TextDrawShowForPlayer(playerid, SpecTD[playerid][1]);
- }
- //=======================[Spectate -END-]==========================
- stock IsPlayerInDuel(playerid)
- {
- if(GetPVarInt(playerid, "InDuel") == 1) return 1;
- return 0;
- }
- stock ReturnWeaponIDOrName(idname[])
- {
- if(!IsNumeric(idname))
- {
- new gWeap = GetWeaponModelIDFromName(idname);
- if(IsValidWeapon(gWeap)) return gWeap;
- }
- else if(IsNumeric(idname))
- {
- new gWeap = strval(idname);
- if(IsValidWeapon(gWeap)) return gWeap;
- }
- return -1;
- }
- stock GetRoundedTotalHP(playerid)
- {
- new Float:HP, Float:Armour, HPT;
- GetPlayerHealth(playerid, HP);
- GetPlayerArmour(playerid, Armour);
- HPT = floatround(HP) + floatround(Armour);
- return HPT;
- }
- GetWeaponModelIDFromName(wname[])
- {
- for(new i=0; i<49; i++)
- {
- if(i == 19 || i == 20 || i == 21) continue;
- if(strfind(weaponNames(i), wname, true) != -1) return i;
- }
- return -1;
- }
- stock GetLowestDuelSlotID()
- {
- for(new x=0; x<MAX_DUELS; x++)
- {
- format(dFile, sizeof(dFile), DUELFILES, x);
- if(!dini_Exists(dFile)) return x;
- }
- return 1;
- }
- stock DuelNameExists(duelname[])
- {
- for(new x=0; x<MAX_DUELS; x++)
- {
- format(dFile, sizeof(dFile), DUELFILES, x);
- if(strfind(duelname, dini_Get(dFile, "duelName"), true) != -1) return 1;
- break;
- }
- return 0;
- }
- stock ReturnDuelIDOrName(duelname[])
- {
- if(!IsNumeric(duelname))
- {
- for(new x=0; x<MAX_DUELS; x++)
- {
- new dName[128];
- new idfromname = x;
- format(dFile, sizeof(dFile), DUELFILES, x);
- format(dName, sizeof(dName), "%s", dini_Get(dFile, "duelName"));
- if(strfind(dName, duelname, true) != -1) return idfromname;
- break;
- }
- }
- else if(IsNumeric(duelname))
- {
- new dName = strval(duelname);
- format(dFile, sizeof(dFile), DUELFILES, dName);
- if(fexist(dFile)) return dName;
- }
- return -1;
- }
- stock weaponNames(weaponid)
- {
- new str[25];
- switch(weaponid)
- {
- case 0: str = "Fist";
- case 1: str = "Brass Knuckles";
- case 2: str = "Golf Club";
- case 3: str = "Night Stick";
- case 4: str = "Knife";
- case 5: str = "Baseball Bat";
- case 6: str = "Shovel";
- case 7: str = "Pool Cue";
- case 8: str = "Katana";
- case 9: str = "Chainsaw";
- case 10: str = "Purple Dildo";
- case 11: str = "Vibrator";
- case 12: str = "Vibrator";
- case 13: str = "Vibrator";
- case 14: str = "Flowers";
- case 15: str = "Cane";
- case 16: str = "Grenade";
- case 17: str = "Teargas";
- case 18: str = "Molotov";
- case 19: str = " ";
- case 20: str = " ";
- case 21: str = " ";
- case 22: str = "Colt 45";
- case 23: str = "Silenced Pistol";
- case 24: str = "Deagle";
- case 25: str = "Shotgun";
- case 26: str = "Sawns";
- case 27: str = "Spas";
- case 28: str = "Uzi";
- case 29: str = "MP5";
- case 30: str = "AK47";
- case 31: str = "M4";
- case 32: str = "Tec9";
- case 33: str = "County Rifle";
- case 34: str = "Sniper Rifle";
- case 35: str = "Rocket Launcher";
- case 36: str = "Heat-Seeker";
- case 37: str = "Flamethrower";
- case 38: str = "Minigun";
- case 39: str = "Satchel Charge";
- case 40: str = "Detonator";
- case 41: str = "Spray Can";
- case 42: str = "Fire Extinguisher";
- case 43: str = "Camera";
- case 44: str = "Night Vision Goggles";
- case 45: str = "Infrared Goggles";
- case 46: str = "Parachute";
- case 47: str = "Fake Pistol";
- case 48: str = "None"; //For duel msgs
- }
- return str;
- }
- stock ReturnDuelNameFromID(duelid)
- {
- format(dFile, sizeof(dFile), DUELFILES, duelid);
- new dName[80];
- format(dName, sizeof(dName), "%s", dini_Get(dFile, "duelName"));
- return dName;
- }
- stock pName(playerid)
- {
- new paname[MAX_PLAYER_NAME];
- GetPlayerName(playerid, paname, sizeof(paname));
- return paname;
- }
- stock IsNumeric(string[])
- {
- for(new i=0, j=strlen(string); i<j; i++)
- {
- if(string[i] > '9' || string[i] < '0') return 0;
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment