Raised This Month: $51 Target: $400
 12% 

Duello Plugin ERROR


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
batu07040
Junior Member
Join Date: Dec 2016
Old 08-21-2017 , 06:43   Duello Plugin ERROR
Reply With Quote #1

Code:
L 08/21/2017 - 13:34:18: [AMXX] Run time error 10 (plugin "1503298130_gelismislr.amxx") (native "cs_set_weapon_ammo") - debug not enabled
Plugin:
Code:
// Includes
////////////

#include < amxmodx >
#include < cstrike >
#include < fun >
#include < fakemeta >
#include < fakemeta_util >
#include < hamsandwich >

// Enums
/////////

enum
{
LR_NONE=-1,
LR_S4S,
LR_SPRAY,
LR_RACE,
LR_GUNTOSS,
LR_KNIFE,
LR_NADETOSS,
LR_SHOTGUN,

MAX_GAMES
};

enum
{
GREY = 0,
RED,
BLUE,
NORMAL
};

enum
{
ALIVE, 
DEAD, 
ALL	
};

enum
{
LR_PRISONER,
LR_GUARD
};

enum ( += 100 )
{
TASK_BEACON,
TASK_ENDLR
};

// Consts
//////////

new const g_szPrefix[ ] = "!g[- !tHasik[TR] !g-]!n";

new const g_szBeaconSound[ ] = "buttons/blip1.wav";
new const g_szBeaconSprite[ ] = "sprites/white.spr";

new const g_szGameNames[ MAX_GAMES ][ ] = 
{
"DEAGLE ILE KALEDEN KALEYE",
"En Yuksege Sprey Basmaca",
"Maptaki Oyunlardan Birini CT Ile Yap",
"En Uzaga Silahi Atmaca",
"BICAK",
"Bombayi En Uzaga Firlatmaca",
"POMPALI"
};

new const g_szDescription[ MAX_GAMES ][ ] = 
{
"Deagle ile kaleden kaleye kozlarinizi paylasin.",
"Sectigin Kisi Ile Sprey Basin En Yukari Basan KAZANIR.",
"Sectigin Kisi Ile Maptaki Bir Oyunu Yap Kazanan Hayatta KALIR.",
"Sectigin Kisi Ile Silahinizi Atacaksiniz En Uzaga Atan KAZANIR.",
"BICAK Ile Kozlarinizi paylasin.",
"Sectigin Kisi Ile Bombani Firlat En Uzaga Atan KAZANIR.",
"POMPALI ile kozlarinizi paylasin."
};

new const g_szTeamName[ ][ ] = 
{
"",
"TERRORIST",
"CT",
"SPECTATOR"
};

new const g_szPlugin[ ] = "Duello[ CSDuragi.com ]";
new const g_szVersion[ ] = "2.0";
new const g_szAuthor[ ] = "TEST";

// Integers
////////////

new g_iCurrentGame = LR_NONE;
new g_iLastRequest[ 2 ];
new g_iCurrentPage[ 33 ];
new g_iChosenGame[ 33 ];

new g_iSprite;

new g_iMaxPlayers;

// Booleans
///////////

new g_maxPlayers, g_msgSayText, beacon_sprite

new cvar_granadas_bpammo, cvar_scout_bpammo, cvar_effect

new bool:touch_weapons[33], bool:once[33], bool:player_challenged[33], bool:duel_active,
bool:knife_duel[33] ,bool:deagle_duel[33], bool:grenade_duel[33], bool:scout_duel[33]

new bool:g_bAlive[ 33 ];
new bool:g_bConnected[ 33 ];

new bool:g_bLastRequestAllowed;

// Messages
////////////

new g_msgTeamInfo;


public plugin_precache()
{
precache_sound( g_szBeaconSound );

precache_sound("lrsesleri/vahsibati.wav")
precache_sound("lrsesleri/levelup.wav")
//precache_sound("lrsesleri/kazandilaa.wav")

g_iSprite = precache_model( g_szBeaconSprite );
beacon_sprite = precache_model("sprites/shockwave.spr")
}

public plugin_init(){

register_plugin( g_szPlugin, g_szVersion, g_szAuthor );

register_clcmd( "say /lr", "Cmd_LastRequest" );
register_clcmd( "say /vs", "Cmd_LastRequest" );
RegisterHam(Ham_Touch, "weaponbox", "fw_touch_weapon")
RegisterHam(Ham_Touch, "armoury_entity", "fw_touch_weapon")
RegisterHam(Ham_Touch, "weapon_shield", "fw_touch_weapon")
RegisterHam(Ham_Spawn, "player", "fw_player_respawn", 1)
RegisterHam(Ham_Killed, "player", "fw_player_killed")	

register_forward(FM_CmdStart,"fw_cmdstart",1)

// Comando de jugador - Client commands

// Cvars
cvar_granadas_bpammo = register_cvar("jb_grenade_bpammo","11") // amount bpammo grenade | cantidad de granadas
cvar_scout_bpammo = register_cvar("jb_scout_bpammo", "15") // amount bpammo scout | cantidad de balas pa' la scout
cvar_effect = register_cvar("jb_effect", "2") // 0 = glow , 1 = beacon, 2 = glow n' beacon

g_maxPlayers = get_maxplayers()

g_msgSayText = get_user_msgid("SayText")

register_event( "HLTV", 	"Event_RoundStart", "a", "1=0", "2=0" );

register_logevent( "Logevent_RoundStart", 2, "1=Round_Start" );

RegisterHam( Ham_Spawn, "player","Ham_PlayerSpawn_Post", 1 );
RegisterHam( Ham_Weapon_PrimaryAttack, 	"weapon_deagle", "Ham_DeagleFire_Post", 1 );
RegisterHam( Ham_Killed,"player","Ham_PlayerKilled_Post",1 );
RegisterHam( Ham_TakeDamage,"player","Ham_TakeDamage_Pre",0 );

register_forward( FM_Think, "Forward_EntityThink_Pre", 0 );

register_message( get_user_msgid( "TextMsg" ), "Message_TextMsg" );

g_msgTeamInfo 	= get_user_msgid( "TeamInfo" );
g_msgSayText 	= get_user_msgid( "SayText" );

g_iMaxPlayers 	= get_maxplayers();

set_task( 2.0, "StartBeacon", .flags="b" );
}

public client_putinserver( id )
{
g_iCurrentPage[ id ] = 0;

g_bConnected[ id ] = true;
}

public client_disconnect( id )
{
g_bConnected[ id ] = false;

if( g_bAlive[ id ] )
g_bAlive[ id ] = false;

if( id == g_iLastRequest[ LR_PRISONER ] || id == g_iLastRequest[ LR_GUARD ] )
{
EndLastRequest( id == g_iLastRequest[ LR_PRISONER ] ? g_iLastRequest[ LR_GUARD ] : g_iLastRequest[ LR_PRISONER ], id );
}

remove_task( id + TASK_ENDLR );
}

public Ham_PlayerSpawn_Post( id )
{
if( !is_user_alive( id ) )
return HAM_IGNORED;

g_bAlive[ id ] = true;

return HAM_IGNORED;
}
public Ham_PlayerKilled_Post( iVictim, iKiller, iShouldGib )
{	
g_bAlive[ iVictim ] = false;

if( iVictim == g_iLastRequest[ LR_PRISONER ] )
{
EndLastRequest( g_iLastRequest[ LR_GUARD ], iVictim );
}

else if( iVictim == g_iLastRequest[ LR_GUARD ] )
{
EndLastRequest( g_iLastRequest[ LR_PRISONER ], iVictim );
}

if( !g_bLastRequestAllowed && cs_get_user_team( iVictim ) == CS_TEAM_T )
{
if( get_playercount( CS_TEAM_T, ALIVE ) == 1 )
{
emit_sound(0, CHAN_AUTO, "lrsesleri/levelup.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);
ColorChat( 0,NORMAL, "%s !nHayatta kalan tek bir mahkum var.", g_szPrefix );		
g_bLastRequestAllowed = true;
}
}
}

public Ham_DeagleFire_Post( iEnt )
{
if( g_iCurrentGame != LR_S4S )
{
return;
}

new id = pev( iEnt, pev_owner );
new iOpponentEnt;

if( cs_get_weapon_ammo( iEnt ) == 0 )
{
if( id == g_iLastRequest[ LR_PRISONER ] )
{
iOpponentEnt = fm_find_ent_by_owner( -1, "weapon_deagle", g_iLastRequest[ LR_GUARD ] );

if( pev_valid( iOpponentEnt ) )
cs_set_weapon_ammo( iOpponentEnt, 1 );
}

else if( id == g_iLastRequest[ LR_GUARD ] )
{
iOpponentEnt = fm_find_ent_by_owner( -1, "weapon_deagle", g_iLastRequest[ LR_PRISONER ] );

if( pev_valid( iOpponentEnt ) )
cs_set_weapon_ammo( iOpponentEnt, 1 );
}
}
}

public Ham_TakeDamage_Pre( iVictim, iInflictor, iAttacker, Float:flDamage, iBits )
{
if( !( 1 <= iAttacker <= g_iMaxPlayers ) )
return HAM_IGNORED;

new bool:g_bVictimLR = iVictim == g_iLastRequest[ LR_PRISONER ] || iVictim == g_iLastRequest[ LR_GUARD ];
new bool:g_bAttackerLR = iAttacker == g_iLastRequest[ LR_PRISONER ] || iAttacker == g_iLastRequest[ LR_GUARD ];

if( g_bVictimLR && !g_bAttackerLR )
{
return HAM_SUPERCEDE;
}

else if( !g_bVictimLR && g_bAttackerLR )
{
return HAM_SUPERCEDE;
}

return HAM_IGNORED;
}

public Event_RoundStart()
{
g_bLastRequestAllowed = false;
g_iCurrentGame = LR_NONE;
client_cmd(0, "stopsound");

}
public Logevent_RoundStart()
{
if( !g_bLastRequestAllowed && get_playercount( CS_TEAM_T, ALIVE ) == 1 )
{
g_bLastRequestAllowed = true;
ColorChat( 0, NORMAL, "Mahkumlardan Biri Hayatta, !gLr Atabilirsin Sona Kalan.");
ColorChat( 0, NORMAL, "!gGardiyanlar !nSona Kalan Mahkumun !nKomutunu Dinlemek !tZORUNDADIR.");
emit_sound(0, CHAN_AUTO, "lrsesleri/levelup.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);
}
}

public Forward_EntityThink_Pre( iEnt )
{
if( !pev_valid( iEnt ) || g_iCurrentGame != LR_NADETOSS )
return FMRES_IGNORED;

new id = pev( iEnt, pev_owner );

if( id != g_iLastRequest[ LR_PRISONER ] && id != g_iLastRequest[ LR_GUARD ] )
return FMRES_IGNORED;

new szModel[ 32 ];

pev( iEnt, pev_model, szModel, charsmax( szModel ) );

if( equal( szModel, "models/w_smokegrenade.mdl" ) )
{
	set_pev( iEnt, pev_renderfx, kRenderFxGlowShell );
	set_pev( iEnt, pev_renderamt, 125.0 );
	set_pev( iEnt, pev_rendermode, kRenderTransAlpha );
	
	set_pev( iEnt, pev_rendercolor, id == g_iLastRequest[ LR_GUARD ] ? { 0.0, 0.0, 255.0 } : { 255.0, 0.0, 0.0 } );
	
	return FMRES_SUPERCEDE;
}	

return FMRES_IGNORED;
}	



public Message_TextMsg()
{
if( g_iCurrentGame == LR_NONE )
{
	return PLUGIN_CONTINUE;
}

static szText[ 25 ];
get_msg_arg_string( 2, szText, charsmax( szText ) );

if( equal( szText, "#Round_Draw" ) || equal( szText, "#Game_will_restart_in" ) || equal( szText, "#Game_Commencing" ) )
{
	g_iCurrentGame = LR_NONE;
	
	strip_user_weapons( g_iLastRequest[ LR_PRISONER ] );
	strip_user_weapons( g_iLastRequest[ LR_GUARD ] );
	
	GiveWeapons( g_iLastRequest[ LR_GUARD ] );
	
	g_iLastRequest[ LR_PRISONER ] = 0;
	g_iLastRequest[ LR_GUARD ] = 0;
}

return PLUGIN_CONTINUE;
}

public Cmd_LastRequest( id )
{
if( !g_bAlive[ id ] )
{
	ColorChat( id, NORMAL, "%s Lr Atmak Icin!t Yasiyor!n Olman Gerekiyor.", g_szPrefix );
	return PLUGIN_HANDLED;
}

else if( cs_get_user_team( id ) != CS_TEAM_T )
{
	ColorChat( id, NORMAL, "%s Sen Gardiyansin!", g_szPrefix );
	return PLUGIN_HANDLED;
}

else if( !g_bLastRequestAllowed )
{
	ColorChat( id, NORMAL, "%s Yalnizca Sona Kalan Kisi Gardiyanlarla Duello Yapabilir.", g_szPrefix );
	return PLUGIN_HANDLED;
}

else if( g_iCurrentGame != LR_NONE )
{
	ColorChat( id, NORMAL, "", g_szPrefix );
	return PLUGIN_HANDLED;
}

else turunusec(id);

return PLUGIN_HANDLED;
}

public LastRequestMenu( id )
{
new hMenu = menu_create( "\yDuello Turunu Sec:", "LastRequestMenu_Handler" );

new szInfo[ 6 ];

for( new i = 0; i < MAX_GAMES; i++ )
{
	num_to_str( i, szInfo, charsmax( szInfo ) );
	
	menu_additem( hMenu, g_szGameNames[ i ], szInfo );
}

menu_setprop( hMenu, MPROP_NEXTNAME, "Diger Sayfa" );
menu_setprop( hMenu, MPROP_BACKNAME, "Onceki Sayfa" );

menu_display( id, hMenu, 0 );
}

public LastRequestMenu_Handler( id, hMenu, iItem )
{
if( iItem == MENU_EXIT )
{
	menu_destroy( hMenu );
	return PLUGIN_HANDLED;
}

new szData[ 6 ];
new iAccess, hCallback;
menu_item_getinfo( hMenu, iItem, iAccess, szData, charsmax( szData ), _, _, hCallback );

g_iChosenGame[ id ] = str_to_num( szData );

if( g_iCurrentGame != LR_NONE )
{
	menu_destroy( hMenu );
	g_iChosenGame[ id ] = LR_NONE;
	ColorChat( id, NORMAL, "", g_szPrefix );
	return PLUGIN_HANDLED;
}

ShowPlayerMenu( id );

menu_destroy( hMenu );
return PLUGIN_HANDLED;
}


public ShowPlayerMenu( id )
{
	new hMenu = menu_create( "\yGardiyan Sec:", "PlayerMenu_Handler" );

	new szPlayerName[ 32 ], szInfo[ 6 ];

	for( new i = 1; i < g_iMaxPlayers; i++ )
	{
		if( !g_bAlive[ i ] || cs_get_user_team( i ) != CS_TEAM_CT )
		{
		
			get_user_name( i, szPlayerName, charsmax( szPlayerName ) );
			
			num_to_str( i, szInfo, charsmax( szInfo ) );
			
			menu_additem( hMenu, szPlayerName, szInfo );
		}
	}
	
	menu_setprop( hMenu, MPROP_NEXTNAME, "Diger Sayfa" );
	menu_setprop( hMenu, MPROP_BACKNAME, "Onceki Sayfa" );
	
	menu_display( id, hMenu, 0 );
}

public PlayerMenu_Handler( id, hMenu, iItem )
{	
	if( iItem == MENU_EXIT || !g_bAlive[ id ] || !g_bLastRequestAllowed || g_iCurrentGame != LR_NONE )
	{
		g_iChosenGame[ id ] = LR_NONE;
		
		menu_destroy( hMenu );
		return PLUGIN_HANDLED;
	}
	
	new szData[ 6 ], szPlayerName[ 64 ];
	new iAccess, hCallback;
	
	menu_item_getinfo( hMenu, iItem, iAccess, szData, charsmax( szData ), szPlayerName, charsmax( szPlayerName ), hCallback );
	
	new iGuard = str_to_num( szData );
	
	if( !g_bAlive[ iGuard ] || cs_get_user_team( iGuard ) != CS_TEAM_CT )
	{
		ColorChat( id, NORMAL, "", g_szPrefix );
		menu_destroy( hMenu );
		
		ShowPlayerMenu( id );
		return PLUGIN_HANDLED;
	}
	
	StartGame( g_iChosenGame[ id ], id, iGuard );
	
	menu_destroy( hMenu );
	return PLUGIN_HANDLED;
}

public StartGame( iGame, iPrisoner, iGuard )
{
	g_iCurrentGame = iGame;
	
	g_iLastRequest[ LR_PRISONER ] = iPrisoner;
	g_iLastRequest[ LR_GUARD ] = iGuard;
	
	new szPrisonerName[ 32 ], szGuardName[ 32 ];
	
	get_user_name( iPrisoner, szPrisonerName, charsmax( szPrisonerName ) );
	get_user_name( iGuard, szGuardName, charsmax( szGuardName ) );
	
	ColorChat( 0, NORMAL, "!g[KURALLI DUELLO] !t%s!n ile !t%s!n !g%s!n! Duellosu .", szPrisonerName, szGuardName, g_szGameNames[ iGame ] );
	server_cmd("amx_show_activity 0");
	server_cmd("bh_enabled 0");
	server_cmd("amx_show_activity 2");	
	emit_sound(0, CHAN_AUTO, "lrsesleri/vahsibati.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);
	
	strip_user_weapons( iPrisoner );
	strip_user_weapons( iGuard );
	
	set_user_health( iPrisoner, 100 );
	set_user_health( iGuard, 100 );
	
	set_user_armor( iPrisoner, 0 );
	set_user_armor( iGuard, 0 );
	
	StartBeacon();
	
	ColorChat( iPrisoner, NORMAL, "%s !tGorevin: %s", g_szPrefix, g_szDescription[ iGame ] );
	ColorChat( iGuard, NORMAL, "%s !tGorevin: %s", g_szPrefix, g_szDescription[ iGame ] );
	
	switch( iGame )
	{	
		case LR_S4S:
		{
			LR_Shot4Shot( iPrisoner );
			LR_Shot4Shot( iGuard );
		}
		
		case LR_RACE:
		{
			LR_Race( iPrisoner );
			LR_Race( iGuard );
		}
		
		case LR_KNIFE:
		{
			LR_Knife( iPrisoner );
			LR_Knife( iGuard );
		}
		
		case LR_SPRAY:
		{
			LR_Spray( iPrisoner );
			LR_Spray( iGuard );
		}
		
		case LR_GUNTOSS:
		{
			LR_GunToss( iPrisoner );
			LR_GunToss( iGuard );
		}
		
		case LR_NADETOSS:
		{
			LR_NadeToss( iPrisoner );
			LR_NadeToss( iGuard );
		}
		
		case LR_SHOTGUN:
		{
			LR_Shotgun( iPrisoner );
			LR_Shotgun( iGuard );
		}
	}
}

public StartBeacon()
{
	if( g_iCurrentGame == LR_NONE )
	{
		return;
	}
	
	new id;
	
	for( new i = 0; i < 2; i++ )
	{
		id = g_iLastRequest[ i ];
		
		static origin[3]
		emit_sound( id, CHAN_ITEM, g_szBeaconSound, 1.0, ATTN_NORM, 0, PITCH_NORM )
		
		get_user_origin( id, origin )
		message_begin( MSG_BROADCAST, SVC_TEMPENTITY )
		write_byte( TE_BEAMCYLINDER )
		write_coord( origin[0] )	//position.x
		write_coord( origin[1] )	//position.y
		write_coord( origin[2]-20 )	//position.z
		write_coord( origin[0] )    	//axis.x
		write_coord( origin[1] )    	//axis.y
		write_coord( origin[2]+200 )	//axis.z
		write_short( g_iSprite )	//sprite index
		write_byte( 0 )       	//starting frame
		write_byte( 1 )       	//frame rate in 0.1's
		write_byte( 6 )        	//life in 0.1's
		write_byte( 10 )        	//line width in 0.1's
		write_byte( 1 )        	//noise amplitude in 0.01's
		
		switch( cs_get_user_team( id ) )
		{
			case CS_TEAM_CT:
			{
				write_byte( 0 );
				write_byte( 0 );
				write_byte( 255 );
			}
			
			case CS_TEAM_T:
			{
				write_byte( 255 );
				write_byte( 0 );
				write_byte( 0 );
			}
		}
		
		write_byte( 255 );			// brightness
		write_byte( 0 );			// scroll speed in 0.1's
		message_end();
	}
}

public EndLastRequest( iWinner, iLoser )
{
	new szWinnerName[ 32 ], szLoserName[ 32 ];
	
	get_user_name( iWinner, szWinnerName, 31 );
	get_user_name( iLoser, szLoserName, 31 );
	//emit_sound(0, CHAN_AUTO, "lrsesleri/kazandilaa.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);
	ColorChat( 0, NORMAL, "!t%s!n !t%s!n tarafindan !golduruldu.", szLoserName, szWinnerName );
	server_cmd("amx_show_activity 0");
	server_cmd("bh_enabled 1");
	server_cmd("amx_show_activity 2");
	strip_user_weapons( iLoser );
	
	
	g_iCurrentGame = LR_NONE;
	
	g_iLastRequest[ LR_PRISONER ] = 0;
	g_iLastRequest[ LR_GUARD ] = 0;
	
	set_task( 0.1, "Task_EndLR", TASK_ENDLR + iWinner );
	
}

public Task_EndLR( iTaskID )
{
	new id = iTaskID - TASK_ENDLR;
	
	strip_user_weapons( id );
	set_user_health( id, 100 );
	give_item( id,"weapon_knife" );
	
	if( cs_get_user_team( id ) == CS_TEAM_CT )
		GiveWeapons( id );
}

//////////////////////////////
//			LR Games		//
//////////////////////////////

LR_Knife( id )
{
new szMapName[ 32 ], iCTOrigin[ 3 ], iTOrigin[ 3 ];

give_item( id, "weapon_knife" );
set_user_health( id, 30 );
get_mapname( szMapName, charsmax( szMapName ) );

if( equali( szMapName, "some1s_jailbreak" ) )
{
	iCTOrigin = { -759, 1047, 100 };
	iTOrigin = { -585, 867, 100 };
	
	if( id == g_iLastRequest[ LR_PRISONER ] )
		set_user_origin( id, iTOrigin );
		
		else
			set_user_origin( id, iCTOrigin );
	}
}

LR_Shotgun( id )
{
give_item( id, "weapon_m3" );
cs_set_user_bpammo( id, CSW_M3, 28 );
}
LR_Shot4Shot( id )
{
new szMapName[ 32 ], iCTOrigin[ 3 ], iTOrigin[ 3 ];

if( id == g_iLastRequest[ LR_PRISONER ] )
{
cs_set_weapon_ammo( give_item( id, "weapon_deagle" ), 1 );
}

else cs_set_weapon_ammo( give_item( id, "weapon_deagle" ), 0 );

get_mapname( szMapName, charsmax( szMapName ) );

if( equali( szMapName, "some1s_jailbreak" ) )
{
iCTOrigin = { -1352, 271, 38 };
iTOrigin = { -1338, -782, 38 };

if( id == g_iLastRequest[ LR_PRISONER ] )
	set_user_origin( id, iTOrigin );
	
	else
		set_user_origin( id, iCTOrigin );
	}
}

LR_Race( id )
{
give_item( id, "weapon_knife" );
}

LR_Spray( id )
{
give_item( id, "weapon_knife" );
}

LR_GunToss( id )
{
give_item( id, "weapon_knife" );
cs_set_weapon_ammo( give_item( id, "weapon_deagle" ), 0 );
}

LR_NadeToss( id )
{
give_item( id, "weapon_knife" );
give_item( id, "weapon_smokegrenade" );
}
GiveWeapons( id )
{
give_item( id, "weapon_m4a1" );
give_item( id, "weapon_deagle" );
give_item( id, "weapon_smokegrenade" );

cs_set_user_bpammo( id, CSW_M4A1, 200 );
cs_set_user_bpammo( id, CSW_DEAGLE, 200 );
}

ColorChat( id, colour, const text[], any:... )
{
if( !get_playersnum() )
{
return;
}

static message[192];

message[0] = 0x01;
vformat(message[1], sizeof(message) - 1, text, 4);

replace_all(message, sizeof(message) - 1, "!g", "^x04");
replace_all(message, sizeof(message) - 1, "!n", "^x01");
replace_all(message, sizeof(message) - 1, "!t", "^x03");

static index, MSG_Type;

if( !id )
{
static i;
for(i = 1; i <= g_iMaxPlayers; i++)
{
if( g_bConnected[i] )
{
index = i;
break;
}
}

MSG_Type = MSG_ALL;
}
else
{
MSG_Type = MSG_ONE;
index = id;
}

static bool:bChanged;
if( colour == GREY || colour == RED || colour == BLUE )
{
message_begin(MSG_Type, g_msgTeamInfo, _, index);
write_byte(index);
write_string(g_szTeamName[colour]);
message_end();

bChanged = true;
}

message_begin(MSG_Type, g_msgSayText, _, index);
write_byte(index);
write_string(message);
message_end();

if( bChanged )
{
message_begin(MSG_Type, g_msgTeamInfo, _, index);
write_byte(index);
write_string(g_szTeamName[_:cs_get_user_team(index)]);
message_end();
}
}

/*================================================================================
Round Start				
=================================================================================*/

public event_round_start()
{
duel_active = false
}

/*================================================================================
forwards				
=================================================================================*/

public fw_player_respawn(id)
{
if(!is_user_alive(id) || !cs_get_user_team(id))
return

set_user_rendering(id)
remove_task(id)
touch_weapons[id] = false 
once[id] = false 
knife_duel[id] = false
deagle_duel[id] = false
grenade_duel[id] = false
scout_duel[id] = false	
player_challenged[id] = false
}

public fw_touch_weapon(weapon, id)
{
if (!is_user_connected(id))
return HAM_IGNORED;

new players[32], pnum, tempid;
get_players(players, pnum, "a");
for( new i; i<pnum; i++ )
{        
tempid = players[i];
}

if (touch_weapons[id] || touch_weapons[tempid])
return HAM_SUPERCEDE;

return HAM_IGNORED;
}


public fw_cmdstart(player,uc_handle,random_seed)
{
if(deagle_duel[player])
{
cs_set_user_bpammo(player, CSW_DEAGLE, 1)
}
}

public fw_player_killed(victim, attacker, shouldgib)
{
new name[32]
get_user_name(attacker, name, 31)

if(duel_active)
{
if(cs_get_user_team(victim) == CS_TEAM_CT && player_challenged[victim])
{
deagle_duel[attacker] = false
grenade_duel[attacker] = false
scout_duel[attacker] = false
once[attacker] = false
strip_user_weapons(attacker)
give_item(attacker, "weapon_knife")
set_user_rendering(attacker)
turunusec(attacker)
//emit_sound(0, CHAN_AUTO, "lrsesleri/kazandilaa.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);
}
else if(cs_get_user_team(victim) == CS_TEAM_CT && !player_challenged[victim])
{
set_task(0.4, "kill_player",attacker)

}
else if(cs_get_user_team(victim) == CS_TEAM_T && player_challenged[victim])
{
deagle_duel[attacker] = false
grenade_duel[attacker] = false
scout_duel[attacker] = false
once[attacker] = false
strip_user_weapons(attacker)
give_item(attacker, "weapon_knife")
set_user_rendering(attacker)
turunusec(attacker)
//emit_sound(0, CHAN_AUTO, "lrsesleri/kazandilaa.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);
}
else if(cs_get_user_team(victim) == CS_TEAM_T && !player_challenged[victim])
{
set_task(0.4, "kill_player",attacker)

}
}	

server_cmd("amx_show_activity 0");
server_cmd("bh_enabled 1");
server_cmd("amx_show_activity 2");
remove_task(attacker)
remove_task(victim)
}

public kill_player(id)
{
user_kill(id)
}

/*================================================================================
Main Menu				
=================================================================================*/

public turunusec(id)
{	
if (!once[id])
{
new cts[32], ts[32], ctsnum, tsnum 

for (new id=1; id <= g_maxPlayers; id++)
{
if (!is_user_connected(id) || !is_user_alive(id)) 
{ 
	continue 
} 

if (cs_get_user_team(id) == CS_TEAM_T) 
{ 
	ts[tsnum++] = id
} 
else if (cs_get_user_team(id) == CS_TEAM_CT) 
{ 
	cts[ctsnum++] = id
} 
} 
if (tsnum == 1 && ctsnum >= 1) 
{  

static opcion[64]

formatex(opcion, charsmax(opcion),"\yDuello Turunu Sec")
new iMenu = menu_create(opcion, "sub_duel_menu")	

formatex(opcion, charsmax(opcion),"\wDeagle Duellosu")
menu_additem(iMenu, opcion, "1")

formatex(opcion, charsmax(opcion),"\wEl Bombasi Duellosu")
menu_additem(iMenu, opcion, "2")	

formatex(opcion, charsmax(opcion),"\wScout Duellosu")
menu_additem(iMenu, opcion, "3")

formatex(opcion, charsmax(opcion),"\wGelismis Kuralli Duello \rKurallara Uymak Zorunlu")
menu_additem(iMenu, opcion, "4")


menu_setprop(iMenu, MPROP_EXIT, MEXIT_ALL)
menu_display(id, iMenu, 0)

}
}
return PLUGIN_HANDLED;
}

public sub_duel_menu(id, menu, item)
{

if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}

new Data[6], Name[64]
new Access, Callback

menu_item_getinfo(menu, item, Access, Data,5, Name, 63, Callback)

new Key = str_to_num(Data)

switch (Key)
{
case 1: 
{
deagle_duel[id] = true
choose_enemy(id)
}
case 2: 
{
grenade_duel[id] = true
choose_enemy(id)
}
case 3: 
{
scout_duel[id] = true
choose_enemy(id)
}
case 4:
{
LastRequestMenu( id )
}
}

menu_destroy(menu)	
return PLUGIN_HANDLED
}

/*================================================================================
Menu of challenges				
=================================================================================*/

public choose_enemy(id)
{
static opcion[64]

formatex(opcion, charsmax(opcion),"\yGardiyan Sec")
new iMenu = menu_create(opcion, "sub_choose_enemy")

new players[32], pnum, tempid
new szName[32], szTempid[10]

get_players(players, pnum, "a")

for( new i; i<pnum; i++ )
{
tempid = players[i]

if (cs_get_user_team(tempid) != CS_TEAM_CT)
{
continue
}

get_user_name(tempid, szName, 31)
num_to_str(tempid, szTempid, 9)
menu_additem(iMenu, szName, szTempid, 0)
}

menu_display(id, iMenu)
return PLUGIN_HANDLED
}

public sub_choose_enemy(id, menu, item)
{
if( item == MENU_EXIT )
{
menu_destroy(menu)
return PLUGIN_HANDLED
}

new Data[6], Name[64]
new Access, Callback
menu_item_getinfo(menu, item, Access, Data,5, Name, 63, Callback)

new tempid = str_to_num(Data)

new mapname[32], challenger[32], challenged[32], ct_origin[3], te_origin[3]

get_mapname(mapname,31)
get_user_name(id, challenger, 31)
get_user_name(tempid, challenged, 31)

// strip weapons
strip_user_weapons(id)
strip_user_weapons(tempid)

// health
set_user_health(id, 100)
set_user_health(tempid, 100)

// effects
switch (get_pcvar_num(cvar_effect))
{
case 0: // glow
{
set_user_rendering(id, kRenderFxGlowShell, 250, 0, 0, kRenderNormal, 20)	
set_user_rendering(tempid, kRenderFxGlowShell, 0, 0, 250, kRenderNormal, 20)
}
case 1: // beacon
{
set_task(1.0, "beacon", id)
set_task(1.0, "beacon", tempid)
}
case 2: // glow n' beacon
{
set_user_rendering(id, kRenderFxGlowShell, 250, 0, 0, kRenderNormal, 20)	
set_task(1.0, "beacon", id)
set_user_rendering(tempid, kRenderFxGlowShell, 0, 0, 250, kRenderNormal, 20)
set_task(1.0, "beacon", tempid)
}
}

// player challenged
player_challenged[tempid] = true

// lr menu once until he kills the player challenged
once[id] = true 

// unable pick up weapon (only the 2 players on duel)
touch_weapons[id] = true
touch_weapons[tempid] = true

if(deagle_duel[id])
{
deagle_duel[tempid] = true

cs_set_weapon_ammo(give_item(id, "weapon_deagle"), 1)
cs_set_weapon_ammo(give_item(tempid, "weapon_deagle"), 1)

if(equali(mapname,"some1s_jailbreak"))
{
ct_origin[0] = -1352, ct_origin[1] = 271, ct_origin[2] = 38
te_origin[0] = -1338, te_origin[1] = -782, te_origin[2] = 38
set_user_origin(id,te_origin)
set_user_origin(tempid,ct_origin)
}		
ColorChat( 0, NORMAL, "!t%s!n ile !t%s!n !gDeagle!n! duellosu yapiyor.",challenger, challenged);

}
else if(grenade_duel[id])
{
give_item(id, "weapon_hegrenade")
give_item(tempid, "weapon_hegrenade")
cs_set_user_bpammo(id, CSW_HEGRENADE,get_pcvar_num(cvar_granadas_bpammo))		
cs_set_user_bpammo(tempid, CSW_HEGRENADE,get_pcvar_num(cvar_granadas_bpammo))

if(equali(mapname,"some1s_jailbreak"))
{
ct_origin[0] = -1756, ct_origin[1] = -2526, ct_origin[2] = 36
te_origin[0] = -3020, te_origin[1] = -2529, te_origin[2] = 36
set_user_origin(id,te_origin)
set_user_origin(tempid,ct_origin)
}	
ColorChat( 0, NORMAL, "!t%s!n ile !t%s!n !gEl Bombasi!n! duellosu yapiyor.",challenger, challenged);
}
else if(scout_duel[id])
{
give_item(id, "weapon_scout")
give_item(tempid, "weapon_scout")
cs_set_user_bpammo(id, CSW_SCOUT, get_pcvar_num(cvar_scout_bpammo))
cs_set_user_bpammo(tempid, CSW_SCOUT, get_pcvar_num(cvar_scout_bpammo))

if(equali(mapname,"some1s_jailbreak"))
{
ct_origin[0] = -2898, ct_origin[1] = -2040, ct_origin[2] = 37
te_origin[0] = -2908, te_origin[1] = 905, te_origin[2] = 37
set_user_origin(id,te_origin)
set_user_origin(tempid,ct_origin)
}		
ColorChat( 0, NORMAL, "!t%s!n ile !t%s!n !gScout!n! duellosu yapiyor.",challenger, challenged);

}
server_cmd("amx_show_activity 0");
server_cmd("bh_enabled 0");
server_cmd("amx_show_activity 2");
//emit_sound(0, CHAN_AUTO, "lrsesleri/vahsibati.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);
duel_active = true

menu_destroy(menu)
return PLUGIN_HANDLED
}

public beacon(id)
{
if(cs_get_user_team(id) == CS_TEAM_CT)
{
static origin[3]
get_user_origin(id, origin)
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_BEAMCYLINDER)	// TE id
write_coord(origin[0])	 	// x
write_coord(origin[1])		// y
write_coord(origin[2]-20)	// z
write_coord(origin[0])    	// x axis
write_coord(origin[1])    	// y axis
write_coord(origin[2]+200)	// z axis
write_short(beacon_sprite)	// sprite
write_byte(0)			// startframe   
write_byte(1)			// framerate   
write_byte(6)			// life
write_byte(2)  			// width
write_byte(1)   			// noise    
write_byte(0)  			// red  
write_byte(0)   			// green 
write_byte(250) 		// blue
write_byte(200)			// brightness
write_byte(0)			// speed
message_end()
}
else
{
static origin[3]
get_user_origin(id, origin)
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_BEAMCYLINDER)	// TE id
write_coord(origin[0])	 	// x
write_coord(origin[1])		// y
write_coord(origin[2]-20)	// z
write_coord(origin[0])    	// x axis
write_coord(origin[1])    	// y axis
write_coord(origin[2]+200)	// z axis
write_short(beacon_sprite)	// sprite
write_byte(0)			// startframe   
write_byte(1)			// framerate   
write_byte(6)			// life
write_byte(2)  			// width
write_byte(1)   			// noise    
write_byte(250)			// red  
write_byte(0)   			// green 
write_byte(0) 			// blue
write_byte(200)			// brightness
write_byte(0)			// speed
message_end()
}
set_task(1.0, "beacon", id)

}
get_playercount( CsTeams:iTeam, iStatus )
{
new iPlayerCount;

for( new i = 1; i <= g_iMaxPlayers; i++ )
{
if( !g_bConnected[ i ] || cs_get_user_team( i ) != iTeam ) continue;

switch( iStatus )
{
case DEAD: if( g_bAlive[ i ] ) continue;
case ALIVE: if( !g_bAlive[ i ] ) continue;
}

iPlayerCount++;
}

return iPlayerCount;
}
batu07040 is offline
Reply



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

Forum Jump


All times are GMT -4. The time now is 10:04.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode