SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts

Reply
 
Thread Tools Display Modes
Old 19/03/2010, 10:47 AM   #21
sushihusi
Big Clucker
 
Join Date: Mar 2009
Posts: 168
Reputation: 2
Default Re: [FS] Duel Filterscript

Nice.
sushihusi is offline   Reply With Quote
Old 23/03/2010, 04:04 AM   #22
JPs_
Big Clucker
 
Join Date: Feb 2010
Posts: 91
Reputation: 0
Default Re: [FS] Duel Filterscript

Quote:
Originally Posted by LifestealeR
Nice but gives 26 error's
JPs_ is offline   Reply With Quote
Old 31/03/2010, 04:04 PM   #23
Tenshi
Huge Clucker
 
Join Date: Feb 2007
Location: USA/East Coast (for now)
Posts: 211
Reputation: 32
Default Re: [FS] Duel Filterscript

I hope someone can fix this issue:

Quote:
Originally Posted by cas126
When I start the duel filterscript the gamemode cmds didnt work.
why??
i didnt edit this script into my gamemode.
can some1 help me plz??
Using this FS makes other commands for GM not functional, so any updates or fixes? or must dcmd must turned into if (!strcmp ?

Code:
#include <a_samp>

/*

	Duel Filterscript (Ripped from LW_LVDM)
	Brought to you by [NB]Sneaky

	www.99BlaZed.com
	www.sneakyhost.net

	You will need to edit line 184,185,201,202

*/

#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
#define SendError(%1,%2) SendClientMessage(%1,COLOR_RED,"ERROR: " %2)
#define SendUsage(%1,%2) SendClientMessage(%1,COLOR_WHITE,"USAGE: " %2)

#define COLOR_ORANGE 	0xFF8040FF
#define COLOR_YELLOW 	0xFFFF00AA
#define COLOR_RED 		0xFF0000AA
#define COLOR_WHITE 	0xFFFFFFAA


stock
	g_GotInvitedToDuel[MAX_PLAYERS],
	g_HasInvitedToDuel[MAX_PLAYERS],
	g_IsPlayerDueling[MAX_PLAYERS],
	g_DuelCountDown[MAX_PLAYERS],
	g_DuelTimer[MAX_PLAYERS],
	g_DuelInProgress,
	g_DuelingID1,
	g_DuelingID2;

public OnFilterScriptInit()
{
	print("\t============================================");
	print("\tDuel Filterscript (Ripped from LW_LVDM)");
	print("\tBy: Sneaky");
	print("\t-");
	print("\tLoaded");
	print("\t============================================");
	return 1;
}

public OnFilterScriptExit()
{
	print("\t============================================");
	print("\tDuel Filterscript (Ripped from LW_LVDM)");
	print("\tBy: Sneaky");
	print("\t-");
	print("\tLoaded");
	print("\t============================================");
	return 1;
}

public OnPlayerConnect(playerid)
{
	g_GotInvitedToDuel[playerid] = 0;
	g_HasInvitedToDuel[playerid] = 0;
	g_IsPlayerDueling[playerid] = 0;
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	if(playerid == g_DuelingID1 || playerid == g_DuelingID2)
	{
	  g_DuelInProgress = 0;
	}
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	dcmd(duel,4,cmdtext);
	dcmd(cduel,5,cmdtext);
	dcmd(duelaccept,10,cmdtext);
	return 1;
}

dcmd_cduel(playerid, params[])
{
	#pragma unused params

	if(g_HasInvitedToDuel[playerid] == 0)
		return SendError(playerid, "You did not invite anyone to a duel!");

	SendClientMessage(playerid, COLOR_YELLOW, "You have reset your duel invite, you can now use /duel [playerid] again.");
	g_HasInvitedToDuel[playerid] = 0;

	return 1;
}

dcmd_duelaccept(playerid, params[])
{
	if(params[0] == '\0' || !IsNumeric(params))
	  return SendUsage(playerid, "/duelaccept [playerid]");

	if(g_DuelInProgress == 1)
		return SendError(playerid, "Another duel is in progress at the moment, wait till that duel is finished!");

  new
		DuelID = strvalEx(params),
		pName[MAX_PLAYER_NAME],
		zName[MAX_PLAYER_NAME],
		tString[128];

  if(DuelID != g_GotInvitedToDuel[playerid])
  	return SendError(playerid, "That player did not invite you to a duel!");

	GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
	GetPlayerName(DuelID, zName, MAX_PLAYER_NAME);

 	format(tString, sizeof(tString), "You accepted the duel with %s (ID:%d), duel will start in 10 seconds..",zName,DuelID);
 	SendClientMessage(playerid, COLOR_YELLOW, tString);

 	format(tString, sizeof(tString), "%s (ID:%d), accepted the duel with you, duel will start in 10 seconds..",pName,playerid);
 	SendClientMessage(DuelID, COLOR_YELLOW, tString);

 	format(tString, sizeof(tString), "(News) Duel between %s and %s will start in 10 seconds",pName,zName);
 	SendClientMessageToAll(COLOR_ORANGE, tString);

 	InitializeDuel(playerid);
 	InitializeDuelEx( DuelID);

 	g_IsPlayerDueling[playerid] = 1;
 	g_IsPlayerDueling[DuelID] = 1;

 	g_DuelingID1 = playerid;
  g_DuelingID2 = DuelID;

	g_DuelInProgress = 1;

	return 1;
}

dcmd_duel(playerid, params[])
{
	if(params[0] == '\0' || !IsNumeric(params))
	  return SendUsage(playerid, "/duel [playerid]");

	if(g_HasInvitedToDuel[playerid] == 1)
		return SendError(playerid, "You already invited someone to a duel! (Type, /cduel to reset your invite)");

	new
		DuelID = strvalEx(params),
		pName[MAX_PLAYER_NAME],
		zName[MAX_PLAYER_NAME],
		tString[128];

	GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
	GetPlayerName(DuelID, zName, MAX_PLAYER_NAME);

	if (!IsPlayerConnected(DuelID))
	  return SendError(playerid, "Player is not connected.");

 	if(	g_HasInvitedToDuel[DuelID] == 1)
 		return SendError(playerid, "That player is already invited to a duel!");

	if(	DuelID == playerid)
 		return SendError(playerid, "You can not duel yourself!");

 	format(tString, sizeof(tString), "You invited %s (ID:%d) to a 1 on 1 duel, wait till %s accepts your invite.",zName, DuelID, zName);
 	SendClientMessage(playerid, COLOR_YELLOW, tString);

 	format(tString, sizeof(tString), "You got invited by %s (ID:%d) to a 1 on 1 duel, type /duelaccept [playerid] to accept and start the duel. ",pName, playerid);
 	SendClientMessage(DuelID, COLOR_YELLOW, tString);

 	g_GotInvitedToDuel[DuelID] = playerid;
	g_HasInvitedToDuel[playerid] = 1;

	return 1;
}

forward InitializeDuel(playerid);
public InitializeDuel(playerid)
{
  g_DuelTimer[playerid] = SetTimerEx("DuelCountDown", 1000, 1, "i", playerid);

	SetPlayerHealth(playerid, 100);
	SetPlayerArmour(playerid, 100);

	//SetPlayerPos(playerid, X, Y, Z); // da1
	//SetPlayerFacingAngle(playerid, A);
  SetCameraBehindPlayer(playerid);
  TogglePlayerControllable(playerid, 0);
  g_DuelCountDown[playerid] = 11;

	return 1;
}

forward InitializeDuelEx(playerid);
public InitializeDuelEx(playerid)
{
  g_DuelTimer[playerid] = SetTimerEx("DuelCountDown", 1000, 1, "i", playerid);

	SetPlayerHealth(playerid, 100);
	SetPlayerArmour(playerid, 100);

  //SetPlayerPos(playerid, X, Y, Z);
  //SetPlayerFacingAngle(playerid, A);
  SetCameraBehindPlayer(playerid);
  TogglePlayerControllable(playerid, 0);
  g_DuelCountDown[playerid] = 11;

	return 1;
}

forward DuelCountDown(playerid);
public DuelCountDown(playerid)
{
	new
		tString[128] ;

	g_DuelCountDown[playerid] --;

	PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);

	format(tString, sizeof(tString), "~w~%d", g_DuelCountDown[playerid]);
	GameTextForPlayer(playerid, tString, 900, 3);

  if(g_DuelCountDown[playerid] == 0)
  {
    KillTimer(g_DuelTimer[playerid]);
    TogglePlayerControllable(playerid, 1);
    GameTextForPlayer(playerid,"~g~GO GO GO", 900, 3);
    return 1;
  }

	return 1;
}

strvalEx(xxx[])
{
	if(strlen(xxx) > 9)
	return 0;
	return strval(xxx);
}

IsNumeric(const string[])
{
	for (new i = 0, j = strlen(string); i < j; i++)
	{
		if (string[i] > '9' || string[i] < '0') return false;
	}
	return true;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	new
	 	sString[128],
	  	pName[MAX_PLAYER_NAME],
	  	zName[MAX_PLAYER_NAME],
	  	Float:Health,
	  	Float:Armor;

	if(g_IsPlayerDueling[playerid] == 1 && g_IsPlayerDueling[killerid] == 1)
	{
		GetPlayerHealth(killerid, Health);
	 	GetPlayerArmour(killerid, Armor);

		GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
	 	GetPlayerName(killerid, zName, MAX_PLAYER_NAME);

		if(Health > 90.0 && Armor > 90.0)
	 	{
	  	format(sString, sizeof(sString),"(News) %s has \"OWNED\" %s in the duel and has %.2f health and %.2f armor left!", zName,pName,Health,Armor);
	   	SendClientMessageToAll(COLOR_ORANGE, sString);

			g_GotInvitedToDuel[playerid] = 0;g_HasInvitedToDuel[playerid] = 0;g_IsPlayerDueling[playerid] = 0;
	  		g_GotInvitedToDuel[killerid] = 0;g_HasInvitedToDuel[killerid] = 0;g_IsPlayerDueling[killerid] = 0;
	   	g_DuelInProgress = 0;
			return 1;
	  	}
	  	else
	  	{
  		format(sString, sizeof(sString),"(News) %s has won the duel from %s and has %.2f health and %.2f armor left!", zName,pName,Health,Armor);
	    	SendClientMessageToAll(COLOR_ORANGE, sString);

			g_GotInvitedToDuel[playerid] = 0;g_HasInvitedToDuel[playerid] = 0;g_IsPlayerDueling[playerid] = 0;
	  		g_GotInvitedToDuel[killerid] = 0;g_HasInvitedToDuel[killerid] = 0;g_IsPlayerDueling[killerid] = 0;
			g_DuelInProgress = 0;
			return 1;
	  }
	}
	return 1;
}
__________________
Quote:
* 07:52:58 [AM] * You were kicked from #sa-mp by JailBait (Refusing to get naked.)
Tenshi is offline   Reply With Quote
Old 19/04/2010, 07:50 PM   #24
[HLF]Southclaw
High-roller
 
[HLF]Southclaw's Avatar
 
Join Date: Apr 2009
Location: England
Posts: 4,766
Reputation: 1305
Default Re: [FS] Duel Filterscript

End of OnPlayerCommandText should be return 0; This way it can carry on processing commands form the GM or other scripts and it can also return a 'unknown command' message.
__________________



[HLF]Southclaw is offline   Reply With Quote
Old 19/04/2010, 08:10 PM   #25
park4bmx
High-roller
 
park4bmx's Avatar
 
Join Date: Dec 2009
Location: Samokov,Bulgaria
Posts: 2,531
Reputation: 232
Default Re: [FS] Duel Filterscript

Quote:
Originally Posted by [ĦŁ₣
ǾǖŦĦŁΛẄ ]
End of OnPlayerCommandText should be return 0; This way it can carry on processing commands form the GM or other scripts and it can also return a 'unknown command' message.
TY
park4bmx is offline   Reply With Quote
Old 19/04/2010, 08:41 PM   #26
JPs_
Big Clucker
 
Join Date: Feb 2010
Posts: 91
Reputation: 0
Default Re: [FS] Duel Filterscript

Quote:
Originally Posted by klavins

Which server ? :P :P
JPs_ is offline   Reply With Quote
Old 22/04/2010, 12:59 PM   #27
omid
Little Clucker
 
Join Date: Apr 2010
Posts: 6
Reputation: 0
Default Re: [FS] Duel Filterscript

BUG : when player enter the car its shows fuel but when he get out from car the fuel msg still on display its must hide .. fix it plz
omid is offline   Reply With Quote
Old 22/04/2010, 01:27 PM   #28
ViruZZzZ_ChiLLL
High-roller
 
ViruZZzZ_ChiLLL's Avatar
 
Join Date: Aug 2009
Location: I don't know
Posts: 1,675
Reputation: 8
Default Re: [FS] Duel Filterscript

Nice I'll be using this
________
IOLITE VAPORIZER

Last edited by ViruZZzZ_ChiLLL; 25/02/2011 at 01:11 AM.
ViruZZzZ_ChiLLL is offline   Reply With Quote
Old 22/05/2010, 03:47 AM   #29
BurrodaZero
Big Clucker
 
Join Date: Apr 2010
Posts: 108
Reputation: 0
Default Re: [FS] Duel Filterscript

You do not have the fs without dcmd? I put it in my GM over this impossible
BurrodaZero is offline   Reply With Quote
Old 22/05/2010, 07:54 AM   #30
Mr L
Huge Clucker
 
Mr L's Avatar
 
Join Date: Jan 2010
Posts: 321
Reputation: 7
Default Re: [FS] Duel Filterscript

Very nice Duel System.
Mr L is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Duel Zone Map v1.0 Fresh9884 Maps 13 06/12/2011 07:55 PM
[NEED]I need AAD duel system Nightmare[TR] Help Archive 5 30/04/2010 08:29 PM
Duel Countdown DarkPower Help Archive 1 01/04/2010 03:10 PM
Help with duel Aram555 Help Archive 0 22/01/2010 05:58 PM
Duel Saving Screenshots and Videos 4 24/06/2009 06:28 PM


All times are GMT. The time now is 04:03 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.