SA-MP Forums Archive
[Help] FlashBang & autojail - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [Help] FlashBang & autojail (/showthread.php?tid=381894)



[Help] FlashBang & autojail - bk360 - 01.10.2012

Hey guys, Okay so How would I remove the stun affect
and instead of the flashbang affect being 10seconds, change it to 5
and add a "annoucement screen" like /adan that says "FlashBang!" and only to that player id
and remove giving the player the flashbang item.

So like a normal flashbang but no item required and instead add the command /fh

Код:
#define FILTERSCRIPT
#define COLOR_GRAY 0xC0C0C0FF
#define COLOR_RED 0xAA3333AA
#include <a_samp>
forward textdraw();
new flashbang[MAX_PLAYERS];
new Text:Efecto;
new Text:Efecto2;
forward Flashbang(playerid);
forward Flashbang2(playerid);;
#if defined FILTERSCRIPT
#pragma tabsize 0
public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Bk360's Flash Bang Filterscript");
	print("--------------------------------------\n");
	textdraw();
	return 1;
}
#else
public OnFilterScriptExit()
{
	return 1;
}

main()
{
	print("\n----------------------------------");
	print(" Bk360's Flash Bang Script");
	print("----------------------------------\n");
}

#endif
public textdraw()
{

	Efecto = TextDrawCreate(1.000000,1.000000,"~FLASHBANG!~");//Creates a textdraw.
	TextDrawUseBox(Efecto,1);   	//Toggle whether a textdraw should have a box or not 
	TextDrawBoxColor(Efecto,0xffffffff);		//Set the color of a textdraw's box
	TextDrawTextSize(Efecto,950.000000,0.000000); //Set the size of a textdraw
	TextDrawAlignment(Efecto,0);		//Set a textdraw's alignment 
	TextDrawBackgroundColor(Efecto,0x000000ff);		//Adjusts the text draw area background color
	TextDrawFont(Efecto,3);			//Set a textdraw's font
	TextDrawLetterSize(Efecto,1.000000,70.000000);		//Set the size of a textdraw's text 
	TextDrawColor(Efecto,0xffffffff);		// Color white durp
	TextDrawSetOutline(Efecto,1);//Set the outline thickness of a textdraw 
	TextDrawSetProportional(Efecto,1);		//Set a textdraw's text proportion 
	TextDrawSetShadow(Efecto,1);		//Toggle a shadow behind a textdraw's text 

	Efecto2 = TextDrawCreate(1.000000,1.000000,"~FLASHBANG!~");//Creates a textdraw.
	TextDrawUseBox(Efecto2,1);   	//Toggle whether a textdraw should have a box or not 
	TextDrawBoxColor(Efecto2,0xffffffcc);		//Set the color of a textdraw's box
	TextDrawTextSize(Efecto2,950.000000,0.000000);//Set the size of a textdraw
	TextDrawAlignment(Efecto2,0);		//Set a textdraw's alignment 
	TextDrawBackgroundColor(Efecto2,0x000000ff);		//Adjusts the text draw area background color
	TextDrawFont(Efecto2,3);			//Set a textdraw's font
	TextDrawLetterSize(Efecto2,1.000000,70.000000);		//Set the size of a textdraw's text 
	TextDrawColor(Efecto2,0xffffffff);		// Color white durp
	TextDrawSetOutline(Efecto2,1);//Set the outline thickness of a textdraw 
	TextDrawSetProportional(Efecto2,1);		//Set a textdraw's text proportion 
	TextDrawSetShadow(Efecto2,1);		//Toggle a shadow behind a textdraw's text 

return 1;
}
public OnGameModeInit()
{
	// Don't use these lines if it's a filterscript
	SetGameModeText("Bk360s FlashBang Script");
	AddPlayerClass(CLASS_POLI);
	AddPlayerClass(CLASS_SWAT);
	AddPlayerClass(CLASS_ARMY);
      return SendClientMessage(playerid, COLOR_GRAY, "Law enforcement officers can only use this command.");
	return 1;
}
public OnPlayerConnect(playerid)
{
	flashbang[playerid]=0;
	return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
     	//new cmd[256];
	if (strcmp("/flashbang", cmdtext, true, 10) == 0)
	{
	if(flashbang[playerid]==0){
	GivePlayerWeapon(playerid,17,1);
	flashbang[playerid]=1;
	//player[playerid]=1;
	}else{
	SendClientMessage(playerid,COLOR_RED,"~FLASHBANG TIME!~");
	}
	return 1;

}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
		if (oldkeys & KEY_FIRE)
	    {

		if (flashbang[playerid]==1){


		flashbang[playerid]=0;
		new Float:X,Float:Y,Float:Z;
		GetPlayerPos(playerid,X,Y,Z);
		 for(new i=0; i < MAX_PLAYERS; i++) 
        {
        if(IsPlayerInRangeOfPoint(i,30.0,X,Y,Z)){

        SetTimerEx("Flashbang",5000,0,"i",i);

		}
		}}
public Flashbang(playerid){

TextDrawShowForPlayer(playerid,Efecto);
SetTimerEx("Flashbang2", 5000, false, "i", playerid); //settimerex, flashbang2, 5000milliseconds, i = integer, player id
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid,X,Y,Z);
PlayerPlaySound(playerid,1159,X,Y,Z);
return 1;
}
public Flashbang2(playerid){
TextDrawHideForPlayer(playerid,Efecto2);
return 1;
}
Edited from original post, take a look now


Re: [Help] FlashBang & autojail - bk360 - 01.10.2012

anyone?


Re: [Help] FlashBang & autojail - Face9000 - 01.10.2012

Just post the flashbang part.


Re: [Help] FlashBang & autojail - bk360 - 01.10.2012

but it still gives a stun affect..


Re: [Help] FlashBang & autojail - bk360 - 01.10.2012

removed


Re: [Help] FlashBang & autojail - bk360 - 01.10.2012

okay, I've edited it a bit, im doing what you said now ill be back :]


Re: [Help] FlashBang & autojail - bk360 - 02.10.2012

okay, I have cleaned it up