Command.
#1

I use one duel system from this forum. There is an command to accept duel /acceptduel playerid, I want player just need to type /acceptduel without player ID.

Code:
//Duel_System
CMD:duel(playerid, params[])
{
new duelbet, userid;
if(sscanf(params, "ui", userid, duelbet)) return SCM(playerid, COLOR_GREY, "Usage: {FFFFFF}/duel <playerid> <bet>");
if(userid == INVALID_PLAYER_ID) return SCM(playerid, COLOR_GREY, "Error: {FFFFFF}Player is not connected.");
if(InDuel[playerid] == 1) return SCM(playerid, COLOR_GREY, "Error: {FFFFFF}You are already in a duel.");
if(InDuel[userid] == 1) return SCM(playerid, COLOR_GREY, "Error: {FFFFFF}Player is already in a duel.");
if(userid == playerid) return SendClientMessage(playerid, -1,"(ERROR): {FFFFFF}You can`t duel with yourself!" );

if(GetPlayerMoney(playerid) < duelbet && duelbet != 0) return SCM(playerid, -1, "* You don`t have that much money!");
if(GetPlayerMoney(userid) < duelbet && duelbet != 0) return SCM(playerid, -1, "* That player doesn`t have that much amount of money!");
if(duelbet < 0) return SCM(playerid, -1, "* Bet Range: $0-25000");
if(duelbet > 25000) return SCM(playerid, -1, "* Bet Range: $0-25000");


	DuelInvite[userid] = playerid;
	DuelAccepter[playerid] = userid;
	Bet = duelbet;

	ShowPlayerDialog(playerid, DIALOG_DUEL_WEAPON, DIALOG_STYLE_LIST, "Duel System [Weapon Select]", "Desert Eagle\nM4\nShotgun\nMP5\nSniper", "Select", "");

return 1;
}
CMD:acceptduel(playerid, params[])
{
if(InDuel[playerid] == 1) return SCM(playerid, COLOR_GREY, "Error: {FFFFFF}You are already in a duel.");
if(DuelInvite[playerid] == -1)return SCM(playerid, COLOR_GREY, "Error: {FFFFFF}You haven`t been invited in a duel.");
if(DuelInvite[playerid] != -1 && DuelInvite[playerid] == INVALID_PLAYER_ID) return SCM(playerid, COLOR_GREY, "Error: {FFFFFF}Player is not connected.");
new userid, string[256];

if(sscanf(params, "u", userid)) return SCM(playerid, COLOR_GREY, "Usage: {FFFFFF}/acceptduel <playerid>");

if(userid != DuelInvite[playerid] ) return SCM(playerid, COLOR_GREY, "Error: {FFFFFF}You haven`t been invited to duel by that player.");
	userid = DuelInvite[playerid];
	DuelInvite[playerid] = userid;
format(string, sizeof(string), "Duel-System: {FFFFFF}%s (%d) has accepted the duel. You are being teleported in the arena.(BET: %d)", GetName(playerid), playerid, Bet);
	SCM(userid, COLOR_GREY, string);
format(string, sizeof(string), "Duel-System: {FFFFFF}You have accepted the duel from  %s (%d). You are being teleported in the arena.(BET: %d)", GetName(userid), userid, Bet);
Code:
new string[256];
format(string, sizeof(string), "Duel-System: {FFFFFF}%s (%d) has invited you to a duel. Usage (/acceptduel <playerid>) to accept it.", GetName(playerid), playerid);
			SCM(DuelAccepter[playerid], COLOR_GREY, string);
format(string, sizeof(string), "Duel-System: {FFFFFF}You have invited %s (%d) to a duel.", GetName(DuelAccepter[playerid]), DuelAccepter[playerid]);
			SCM(playerid, COLOR_GREY, string);
Reply
#2

Bump
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)