Solved Request convert to ze

Unpaid Requests, Public Plugins
Post Reply
imSpartan
Member
Member
Malaysia
Posts: 22
Joined: 4 years ago
Contact:

Request convert to ze

#1

Post by imSpartan » 4 years ago

Code: Select all

#include < amxmodx >
#include < hamsandwich >
#include < fakemeta >

new const MESSAGE[ ] = "Cover me... I'm reloading!";

new const SOUNDS[ ][ ] = {
	"radio/reloading01.wav",
	"radio/reloading02.wav"
};

new const Float:g_iMaxClip[ CSW_P90 + 1 ] = {
	0.0, 13.0, 0.0, 10.0, 1.0,  7.0, 1.0, 30.0, 30.0, 1.0, 30.0, 
	20.0, 25.0, 30.0, 35.0, 25.0, 12.0, 20.0, 10.0, 30.0, 100.0, 
	8.0, 30.0, 30.0, 20.0, 2.0, 7.0, 30.0, 30.0, 0.0, 50.0 };

const m_iTeam            = 114;
const m_pPlayer          = 41;
const m_fInReload        = 54;
const m_fInSpecialReload = 55;
const m_flTimeWeaponIdle = 48;

new bool:g_bLocation, g_iMsgTextMsg, g_iMsgSendAudio, g_szLocation[ 33 ][ 32 ];
new g_pChat, g_pPercent;

public plugin_init( ) {
	register_plugin( "Reload radio", "1.0", "xPaw" );
	
	g_pChat    = register_cvar( "rr_chat",    "1" );
	g_pPercent = register_cvar( "rr_percent", "55" );
	
	g_iMsgTextMsg   = get_user_msgid( "TextMsg" );
	g_iMsgSendAudio = get_user_msgid( "SendAudio" );
	
	// 2 = CSW_SHIELD = UNDEFINED | PUT SHOTGUNS HERE TO SKIP IN LOOP AND REGISTER MANUALLY
	new const NO_RELOAD = ( 1 << 2 ) | ( 1 << CSW_KNIFE ) | ( 1 << CSW_C4 ) | ( 1 << CSW_M3 ) |
		( 1 << CSW_XM1014 ) | ( 1 << CSW_HEGRENADE ) | ( 1 << CSW_FLASHBANG ) | ( 1 << CSW_SMOKEGRENADE );
	
	new szWeaponName[ 20 ];
	for( new i = CSW_P228; i <= CSW_P90; i++ ) {
		if( NO_RELOAD & ( 1 << i ) )
			continue;
		
		get_weaponname( i, szWeaponName, 19 );
		
		RegisterHam( Ham_Weapon_Reload, szWeaponName, "FwdHamWeaponReload", 1 );
	}
	
	RegisterHam( Ham_Weapon_Reload, "weapon_m3",     "FwdHamShotgunReload", 1 );
	RegisterHam( Ham_Weapon_Reload, "weapon_xm1014", "FwdHamShotgunReload", 1 );
	
	new szModName[ 6 ];
	get_modname( szModName, 5 );
	
	if( equal( szModName, "czero" ) )
		register_event( "Location", "EventLocation", "be" );
}

public plugin_precache( )
	for( new i; i < sizeof SOUNDS; i++ )
		precache_sound( SOUNDS[ i ] );

public EventLocation( const id ) { // Condition Zero
	if( !g_bLocation )
		g_bLocation = true;
	
	if( read_data( 1 ) == id )
		read_data( 2, g_szLocation[ id ], 31 );
}

public FwdHamWeaponReload( const iWeapon )
	if( get_pdata_int( iWeapon, m_fInReload, 4 ) ) // m_fInReload is set to TRUE in DefaultReload( )
		DoRadio( get_pdata_cbase( iWeapon, m_pPlayer, 4 ) );

public FwdHamShotgunReload( const iWeapon ) {
	if( get_pdata_int( iWeapon, m_fInSpecialReload, 4 ) != 1 )
		return;
	
	// The first set of m_fInSpecialReload to 1. m_flTimeWeaponIdle remains 0.55 set from Reload( )
	new Float:flTimeWeaponIdle = get_pdata_float( iWeapon, m_flTimeWeaponIdle, 4 );
	
	if( flTimeWeaponIdle != 0.55 )
		return;
	
	DoRadio( get_pdata_cbase( iWeapon, m_pPlayer, 4 ) );
}

DoRadio( const id ) {
	new iClip, iWeapon  = get_user_weapon( id, iClip );
	new Float:flPercent = floatmul( float( iClip ) / g_iMaxClip[ iWeapon ], 100.0 );
	new Float:flCvar    = get_pcvar_float( g_pPercent );
	
	if( flPercent > flCvar )
		return;
	
	new iPlayers[ 32 ], szId[ 3 ], szName[ 32 ], iNum, iPlayer, iTeam = get_pdata_int( id, m_iTeam, 5 );
	get_players( iPlayers, iNum, "c" );
	get_user_name( id, szName, 31 );
	num_to_str( id, szId, 2 );
	
	new szSound[ 32 ];
	copy( szSound, 31, SOUNDS[ random( sizeof( SOUNDS ) ) ] );
	
	new bool:bChat = bool:!!get_pcvar_num( g_pChat );
	
	for( new i; i < iNum; i++ ) {
		iPlayer = iPlayers[ i ];
		
		if( iTeam != get_pdata_int( iPlayer, m_iTeam, 5 ) )
			continue;
		
		if( bChat ) {
			emessage_begin( MSG_ONE_UNRELIABLE, g_iMsgTextMsg, _, iPlayer );
			ewrite_byte( 5 );
			ewrite_string( szId );
			ewrite_string( g_bLocation ? "#Game_radio_location" : "#Game_radio" );
			ewrite_string( szName );
			
			if( g_bLocation )
				ewrite_string( g_szLocation[ id ] );
			
			ewrite_string( MESSAGE );
			emessage_end( );
		}
		
		emessage_begin( MSG_ONE_UNRELIABLE, g_iMsgSendAudio, _, iPlayer );
		ewrite_byte( id );
		ewrite_string( szSound );
		ewrite_short( PITCH_NORM );
		emessage_end( );
	}
}
Can this convert to ze? thank you

Muhammet20
Veteran Member
Veteran Member
Posts: 408
Joined: 5 years ago
Contact:

#2

Post by Muhammet20 » 4 years ago

imSpartan wrote: 4 years ago

Code: Select all

#include < amxmodx >
#include < hamsandwich >
#include < fakemeta >

new const MESSAGE[ ] = "Cover me... I'm reloading!";

new const SOUNDS[ ][ ] = {
	"radio/reloading01.wav",
	"radio/reloading02.wav"
};

new const Float:g_iMaxClip[ CSW_P90 + 1 ] = {
	0.0, 13.0, 0.0, 10.0, 1.0,  7.0, 1.0, 30.0, 30.0, 1.0, 30.0, 
	20.0, 25.0, 30.0, 35.0, 25.0, 12.0, 20.0, 10.0, 30.0, 100.0, 
	8.0, 30.0, 30.0, 20.0, 2.0, 7.0, 30.0, 30.0, 0.0, 50.0 };

const m_iTeam            = 114;
const m_pPlayer          = 41;
const m_fInReload        = 54;
const m_fInSpecialReload = 55;
const m_flTimeWeaponIdle = 48;

new bool:g_bLocation, g_iMsgTextMsg, g_iMsgSendAudio, g_szLocation[ 33 ][ 32 ];
new g_pChat, g_pPercent;

public plugin_init( ) {
	register_plugin( "Reload radio", "1.0", "xPaw" );
	
	g_pChat    = register_cvar( "rr_chat",    "1" );
	g_pPercent = register_cvar( "rr_percent", "55" );
	
	g_iMsgTextMsg   = get_user_msgid( "TextMsg" );
	g_iMsgSendAudio = get_user_msgid( "SendAudio" );
	
	// 2 = CSW_SHIELD = UNDEFINED | PUT SHOTGUNS HERE TO SKIP IN LOOP AND REGISTER MANUALLY
	new const NO_RELOAD = ( 1 << 2 ) | ( 1 << CSW_KNIFE ) | ( 1 << CSW_C4 ) | ( 1 << CSW_M3 ) |
		( 1 << CSW_XM1014 ) | ( 1 << CSW_HEGRENADE ) | ( 1 << CSW_FLASHBANG ) | ( 1 << CSW_SMOKEGRENADE );
	
	new szWeaponName[ 20 ];
	for( new i = CSW_P228; i <= CSW_P90; i++ ) {
		if( NO_RELOAD & ( 1 << i ) )
			continue;
		
		get_weaponname( i, szWeaponName, 19 );
		
		RegisterHam( Ham_Weapon_Reload, szWeaponName, "FwdHamWeaponReload", 1 );
	}
	
	RegisterHam( Ham_Weapon_Reload, "weapon_m3",     "FwdHamShotgunReload", 1 );
	RegisterHam( Ham_Weapon_Reload, "weapon_xm1014", "FwdHamShotgunReload", 1 );
	
	new szModName[ 6 ];
	get_modname( szModName, 5 );
	
	if( equal( szModName, "czero" ) )
		register_event( "Location", "EventLocation", "be" );
}

public plugin_precache( )
	for( new i; i < sizeof SOUNDS; i++ )
		precache_sound( SOUNDS[ i ] );

public EventLocation( const id ) { // Condition Zero
	if( !g_bLocation )
		g_bLocation = true;
	
	if( read_data( 1 ) == id )
		read_data( 2, g_szLocation[ id ], 31 );
}

public FwdHamWeaponReload( const iWeapon )
	if( get_pdata_int( iWeapon, m_fInReload, 4 ) ) // m_fInReload is set to TRUE in DefaultReload( )
		DoRadio( get_pdata_cbase( iWeapon, m_pPlayer, 4 ) );

public FwdHamShotgunReload( const iWeapon ) {
	if( get_pdata_int( iWeapon, m_fInSpecialReload, 4 ) != 1 )
		return;
	
	// The first set of m_fInSpecialReload to 1. m_flTimeWeaponIdle remains 0.55 set from Reload( )
	new Float:flTimeWeaponIdle = get_pdata_float( iWeapon, m_flTimeWeaponIdle, 4 );
	
	if( flTimeWeaponIdle != 0.55 )
		return;
	
	DoRadio( get_pdata_cbase( iWeapon, m_pPlayer, 4 ) );
}

DoRadio( const id ) {
	new iClip, iWeapon  = get_user_weapon( id, iClip );
	new Float:flPercent = floatmul( float( iClip ) / g_iMaxClip[ iWeapon ], 100.0 );
	new Float:flCvar    = get_pcvar_float( g_pPercent );
	
	if( flPercent > flCvar )
		return;
	
	new iPlayers[ 32 ], szId[ 3 ], szName[ 32 ], iNum, iPlayer, iTeam = get_pdata_int( id, m_iTeam, 5 );
	get_players( iPlayers, iNum, "c" );
	get_user_name( id, szName, 31 );
	num_to_str( id, szId, 2 );
	
	new szSound[ 32 ];
	copy( szSound, 31, SOUNDS[ random( sizeof( SOUNDS ) ) ] );
	
	new bool:bChat = bool:!!get_pcvar_num( g_pChat );
	
	for( new i; i < iNum; i++ ) {
		iPlayer = iPlayers[ i ];
		
		if( iTeam != get_pdata_int( iPlayer, m_iTeam, 5 ) )
			continue;
		
		if( bChat ) {
			emessage_begin( MSG_ONE_UNRELIABLE, g_iMsgTextMsg, _, iPlayer );
			ewrite_byte( 5 );
			ewrite_string( szId );
			ewrite_string( g_bLocation ? "#Game_radio_location" : "#Game_radio" );
			ewrite_string( szName );
			
			if( g_bLocation )
				ewrite_string( g_szLocation[ id ] );
			
			ewrite_string( MESSAGE );
			emessage_end( );
		}
		
		emessage_begin( MSG_ONE_UNRELIABLE, g_iMsgSendAudio, _, iPlayer );
		ewrite_byte( id );
		ewrite_string( szSound );
		ewrite_short( PITCH_NORM );
		emessage_end( );
	}
}
Can this convert to ze? thank you
this plugin is no need to convert
just change the include files
if yo don't understand just copy this code and replace with your code:

Code: Select all

#include <zombie_escape>

new const MESSAGE[ ] = "Cover me... I'm reloading!";

new const SOUNDS[ ][ ] = {
	"radio/reloading01.wav",
	"radio/reloading02.wav"
};

new const Float:g_iMaxClip[ CSW_P90 + 1 ] = {
	0.0, 13.0, 0.0, 10.0, 1.0,  7.0, 1.0, 30.0, 30.0, 1.0, 30.0, 
	20.0, 25.0, 30.0, 35.0, 25.0, 12.0, 20.0, 10.0, 30.0, 100.0, 
	8.0, 30.0, 30.0, 20.0, 2.0, 7.0, 30.0, 30.0, 0.0, 50.0 };

const m_iTeam            = 114;
const m_pPlayer          = 41;
const m_fInReload        = 54;
const m_fInSpecialReload = 55;
const m_flTimeWeaponIdle = 48;

new bool:g_bLocation, g_iMsgTextMsg, g_iMsgSendAudio, g_szLocation[ 33 ][ 32 ];
new g_pChat, g_pPercent;

public plugin_init( ) {
	register_plugin( "Reload radio", "1.0", "xPaw" );
	
	g_pChat    = register_cvar( "rr_chat",    "1" );
	g_pPercent = register_cvar( "rr_percent", "55" );
	
	g_iMsgTextMsg   = get_user_msgid( "TextMsg" );
	g_iMsgSendAudio = get_user_msgid( "SendAudio" );
	
	// 2 = CSW_SHIELD = UNDEFINED | PUT SHOTGUNS HERE TO SKIP IN LOOP AND REGISTER MANUALLY
	new const NO_RELOAD = ( 1 << 2 ) | ( 1 << CSW_KNIFE ) | ( 1 << CSW_C4 ) | ( 1 << CSW_M3 ) |
		( 1 << CSW_XM1014 ) | ( 1 << CSW_HEGRENADE ) | ( 1 << CSW_FLASHBANG ) | ( 1 << CSW_SMOKEGRENADE );
	
	new szWeaponName[ 20 ];
	for( new i = CSW_P228; i <= CSW_P90; i++ ) {
		if( NO_RELOAD & ( 1 << i ) )
			continue;
		
		get_weaponname( i, szWeaponName, 19 );
		
		RegisterHam( Ham_Weapon_Reload, szWeaponName, "FwdHamWeaponReload", 1 );
	}
	
	RegisterHam( Ham_Weapon_Reload, "weapon_m3",     "FwdHamShotgunReload", 1 );
	RegisterHam( Ham_Weapon_Reload, "weapon_xm1014", "FwdHamShotgunReload", 1 );
	
	new szModName[ 6 ];
	get_modname( szModName, 5 );
	
	if( equal( szModName, "czero" ) )
		register_event( "Location", "EventLocation", "be" );
}

public plugin_precache( )
	for( new i; i < sizeof SOUNDS; i++ )
		precache_sound( SOUNDS[ i ] );

public EventLocation( const id ) { // Condition Zero
	if( !g_bLocation )
		g_bLocation = true;
	
	if( read_data( 1 ) == id )
		read_data( 2, g_szLocation[ id ], 31 );
}

public FwdHamWeaponReload( const iWeapon )
	if( get_pdata_int( iWeapon, m_fInReload, 4 ) ) // m_fInReload is set to TRUE in DefaultReload( )
		DoRadio( get_pdata_cbase( iWeapon, m_pPlayer, 4 ) );

public FwdHamShotgunReload( const iWeapon ) {
	if( get_pdata_int( iWeapon, m_fInSpecialReload, 4 ) != 1 )
		return;
	
	// The first set of m_fInSpecialReload to 1. m_flTimeWeaponIdle remains 0.55 set from Reload( )
	new Float:flTimeWeaponIdle = get_pdata_float( iWeapon, m_flTimeWeaponIdle, 4 );
	
	if( flTimeWeaponIdle != 0.55 )
		return;
	
	DoRadio( get_pdata_cbase( iWeapon, m_pPlayer, 4 ) );
}

DoRadio( const id ) {
	new iClip, iWeapon  = get_user_weapon( id, iClip );
	new Float:flPercent = floatmul( float( iClip ) / g_iMaxClip[ iWeapon ], 100.0 );
	new Float:flCvar    = get_pcvar_float( g_pPercent );
	
	if( flPercent > flCvar )
		return;
	
	new iPlayers[ 32 ], szId[ 3 ], szName[ 32 ], iNum, iPlayer, iTeam = get_pdata_int( id, m_iTeam, 5 );
	get_players( iPlayers, iNum, "c" );
	get_user_name( id, szName, 31 );
	num_to_str( id, szId, 2 );
	
	new szSound[ 32 ];
	copy( szSound, 31, SOUNDS[ random( sizeof( SOUNDS ) ) ] );
	
	new bool:bChat = bool:!!get_pcvar_num( g_pChat );
	
	for( new i; i < iNum; i++ ) {
		iPlayer = iPlayers[ i ];
		
		if( iTeam != get_pdata_int( iPlayer, m_iTeam, 5 ) )
			continue;
		
		if( bChat ) {
			emessage_begin( MSG_ONE_UNRELIABLE, g_iMsgTextMsg, _, iPlayer );
			ewrite_byte( 5 );
			ewrite_string( szId );
			ewrite_string( g_bLocation ? "#Game_radio_location" : "#Game_radio" );
			ewrite_string( szName );
			
			if( g_bLocation )
				ewrite_string( g_szLocation[ id ] );
			
			ewrite_string( MESSAGE );
			emessage_end( );
		}
		
		emessage_begin( MSG_ONE_UNRELIABLE, g_iMsgSendAudio, _, iPlayer );
		ewrite_byte( id );
		ewrite_string( szSound );
		ewrite_short( PITCH_NORM );
		emessage_end( );
	}
}

imSpartan
Member
Member
Malaysia
Posts: 22
Joined: 4 years ago
Contact:

#3

Post by imSpartan » 4 years ago

Ok i'll try

Code: Select all

//AMXXPC compile.exe
// by the AMX Mod X Dev Team


//// Reloading_sound.sma
//
// C:\Users\Dell\Desktop\ze 1.4 (17072019)\Version 1.4 Compiler\scripting\Reloading_sound.sma(71) : warning 213: tag mismatch
// C:\Users\Dell\Desktop\ze 1.4 (17072019)\Version 1.4 Compiler\scripting\Reloading_sound.sma(78) : warning 213: tag mismatch
// C:\Users\Dell\Desktop\ze 1.4 (17072019)\Version 1.4 Compiler\scripting\Reloading_sound.sma(83) : warning 213: tag mismatch
// C:\Users\Dell\Desktop\ze 1.4 (17072019)\Version 1.4 Compiler\scripting\Reloading_sound.sma(94) : warning 213: tag mismatch
// C:\Users\Dell\Desktop\ze 1.4 (17072019)\Version 1.4 Compiler\scripting\Reloading_sound.sma(107) : warning 213: tag mismatch
// Header size:           1276 bytes
// Code size:             4648 bytes
// Data size:             6228 bytes
// Stack/heap size:      16384 bytes
// Total requirements:   28536 bytes
//
// 5 Warnings.
// Done.
//
// Compilation Time: 0.75 sec
// ----------------------------------------

Press enter to exit ...
I get this error.

Muhammet20
Veteran Member
Veteran Member
Posts: 408
Joined: 5 years ago
Contact:

#4

Post by Muhammet20 » 4 years ago

imSpartan wrote: 4 years ago Ok i'll try

Code: Select all

//AMXXPC compile.exe
// by the AMX Mod X Dev Team


//// Reloading_sound.sma
//
// C:\Users\Dell\Desktop\ze 1.4 (17072019)\Version 1.4 Compiler\scripting\Reloading_sound.sma(71) : warning 213: tag mismatch
// C:\Users\Dell\Desktop\ze 1.4 (17072019)\Version 1.4 Compiler\scripting\Reloading_sound.sma(78) : warning 213: tag mismatch
// C:\Users\Dell\Desktop\ze 1.4 (17072019)\Version 1.4 Compiler\scripting\Reloading_sound.sma(83) : warning 213: tag mismatch
// C:\Users\Dell\Desktop\ze 1.4 (17072019)\Version 1.4 Compiler\scripting\Reloading_sound.sma(94) : warning 213: tag mismatch
// C:\Users\Dell\Desktop\ze 1.4 (17072019)\Version 1.4 Compiler\scripting\Reloading_sound.sma(107) : warning 213: tag mismatch
// Header size:           1276 bytes
// Code size:             4648 bytes
// Data size:             6228 bytes
// Stack/heap size:      16384 bytes
// Total requirements:   28536 bytes
//
// 5 Warnings.
// Done.
//
// Compilation Time: 0.75 sec
// ----------------------------------------

Press enter to exit ...
I get this error.
idk about this warnings ask @Raheem

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#5

Post by Raheem » 4 years ago

Also you can just compile it without need to change the includes and will work fine in zombie escape mod.

Warnings resolved, try:
    1. #include < amxmodx >
    2. #include < hamsandwich >
    3. #include < fakemeta >
    4.  
    5. new const MESSAGE[ ] = "Cover me... I'm reloading!";
    6.  
    7. new const SOUNDS[ ][ ] = {
    8.     "radio/reloading01.wav",
    9.     "radio/reloading02.wav"
    10. };
    11.  
    12. new const Float:g_iMaxClip[ CSW_P90 + 1 ] = {
    13.     0.0, 13.0, 0.0, 10.0, 1.0,  7.0, 1.0, 30.0, 30.0, 1.0, 30.0,
    14.     20.0, 25.0, 30.0, 35.0, 25.0, 12.0, 20.0, 10.0, 30.0, 100.0,
    15.     8.0, 30.0, 30.0, 20.0, 2.0, 7.0, 30.0, 30.0, 0.0, 50.0 };
    16.  
    17. new const m_iTeam            = 114;
    18. new const m_pPlayer          = 41;
    19. new const m_fInReload        = 54;
    20. new const m_fInSpecialReload = 55;
    21. new const m_flTimeWeaponIdle = 48;
    22.  
    23. new bool:g_bLocation, g_iMsgTextMsg, g_iMsgSendAudio, g_szLocation[ 33 ][ 32 ];
    24. new g_pChat, g_pPercent;
    25.  
    26. public plugin_init( ) {
    27.     register_plugin( "Reload radio", "1.0", "xPaw" );
    28.    
    29.     g_pChat    = register_cvar( "rr_chat",    "1" );
    30.     g_pPercent = register_cvar( "rr_percent", "55" );
    31.    
    32.     g_iMsgTextMsg   = get_user_msgid( "TextMsg" );
    33.     g_iMsgSendAudio = get_user_msgid( "SendAudio" );
    34.    
    35.     // 2 = CSW_SHIELD = UNDEFINED | PUT SHOTGUNS HERE TO SKIP IN LOOP AND REGISTER MANUALLY
    36.     new const NO_RELOAD = ( 1 << 2 ) | ( 1 << CSW_KNIFE ) | ( 1 << CSW_C4 ) | ( 1 << CSW_M3 ) |
    37.         ( 1 << CSW_XM1014 ) | ( 1 << CSW_HEGRENADE ) | ( 1 << CSW_FLASHBANG ) | ( 1 << CSW_SMOKEGRENADE );
    38.    
    39.     new szWeaponName[ 20 ];
    40.     for( new i = CSW_P228; i <= CSW_P90; i++ ) {
    41.         if( NO_RELOAD & ( 1 << i ) )
    42.             continue;
    43.        
    44.         get_weaponname( i, szWeaponName, 19 );
    45.        
    46.         RegisterHam( Ham_Weapon_Reload, szWeaponName, "FwdHamWeaponReload", 1 );
    47.     }
    48.    
    49.     RegisterHam( Ham_Weapon_Reload, "weapon_m3",     "FwdHamShotgunReload", 1 );
    50.     RegisterHam( Ham_Weapon_Reload, "weapon_xm1014", "FwdHamShotgunReload", 1 );
    51.    
    52.     new szModName[ 6 ];
    53.     get_modname( szModName, 5 );
    54.    
    55.     if( equal( szModName, "czero" ) )
    56.         register_event( "Location", "EventLocation", "be" );
    57. }
    58.  
    59. public plugin_precache( )
    60.     for( new i; i < sizeof SOUNDS; i++ )
    61.         precache_sound( SOUNDS[ i ] );
    62.  
    63. public EventLocation( const id ) { // Condition Zero
    64.     if( !g_bLocation )
    65.         g_bLocation = true;
    66.    
    67.     if( read_data( 1 ) == id )
    68.         read_data( 2, g_szLocation[ id ], 31 );
    69. }
    70.  
    71. public FwdHamWeaponReload( const iWeapon )
    72.     if( get_pdata_int( iWeapon, m_fInReload, 4 ) ) // m_fInReload is set to TRUE in DefaultReload( )
    73.         DoRadio( get_pdata_cbase( iWeapon, m_pPlayer, 4 ) );
    74.  
    75. public FwdHamShotgunReload( const iWeapon ) {
    76.     if( get_pdata_int( iWeapon, m_fInSpecialReload, 4 ) != 1 )
    77.         return;
    78.    
    79.     // The first set of m_fInSpecialReload to 1. m_flTimeWeaponIdle remains 0.55 set from Reload( )
    80.     new Float:flTimeWeaponIdle = get_pdata_float( iWeapon, m_flTimeWeaponIdle, 4 );
    81.    
    82.     if( flTimeWeaponIdle != 0.55 )
    83.         return;
    84.    
    85.     DoRadio( get_pdata_cbase( iWeapon, m_pPlayer, 4 ) );
    86. }
    87.  
    88. DoRadio( const id ) {
    89.     new iClip, iWeapon  = get_user_weapon( id, iClip );
    90.     new Float:flPercent = floatmul( float( iClip ) / g_iMaxClip[ iWeapon ], 100.0 );
    91.     new Float:flCvar    = get_pcvar_float( g_pPercent );
    92.    
    93.     if( flPercent > flCvar )
    94.         return;
    95.    
    96.     new iPlayers[ 32 ], szId[ 3 ], szName[ 32 ], iNum, iPlayer, iTeam = get_pdata_int( id, m_iTeam, 5 );
    97.     get_players( iPlayers, iNum, "c" );
    98.     get_user_name( id, szName, 31 );
    99.     num_to_str( id, szId, 2 );
    100.    
    101.     new szSound[ 32 ];
    102.     copy( szSound, 31, SOUNDS[ random( sizeof( SOUNDS ) ) ] );
    103.    
    104.     new bool:bChat = bool:!!get_pcvar_num( g_pChat );
    105.    
    106.     for( new i; i < iNum; i++ ) {
    107.         iPlayer = iPlayers[ i ];
    108.        
    109.         if( iTeam != get_pdata_int( iPlayer, m_iTeam, 5 ) )
    110.             continue;
    111.        
    112.         if( bChat ) {
    113.             emessage_begin( MSG_ONE_UNRELIABLE, g_iMsgTextMsg, _, iPlayer );
    114.             ewrite_byte( 5 );
    115.             ewrite_string( szId );
    116.             ewrite_string( g_bLocation ? "#Game_radio_location" : "#Game_radio" );
    117.             ewrite_string( szName );
    118.            
    119.             if( g_bLocation )
    120.                 ewrite_string( g_szLocation[ id ] );
    121.            
    122.             ewrite_string( MESSAGE );
    123.             emessage_end( );
    124.         }
    125.        
    126.         emessage_begin( MSG_ONE_UNRELIABLE, g_iMsgSendAudio, _, iPlayer );
    127.         ewrite_byte( id );
    128.         ewrite_string( szSound );
    129.         ewrite_short( PITCH_NORM );
    130.         emessage_end( );
    131.     }
    132. }
He who fails to plan is planning to fail

imSpartan
Member
Member
Malaysia
Posts: 22
Joined: 4 years ago
Contact:

#6

Post by imSpartan » 4 years ago

Raheem wrote: 4 years ago Also, you can just compile it without need to change the includes and will work fine in zombie escape mod.

Warnings resolved, try:
    1. #include < amxmodx >
    2. #include < hamsandwich >
    3. #include < fakemeta >
    4.  
    5. new const MESSAGE[ ] = "Cover me... I'm reloading!";
    6.  
    7. new const SOUNDS[ ][ ] = {
    8.     "radio/reloading01.wav",
    9.     "radio/reloading02.wav"
    10. };
    11.  
    12. new const Float:g_iMaxClip[ CSW_P90 + 1 ] = {
    13.     0.0, 13.0, 0.0, 10.0, 1.0,  7.0, 1.0, 30.0, 30.0, 1.0, 30.0,
    14.     20.0, 25.0, 30.0, 35.0, 25.0, 12.0, 20.0, 10.0, 30.0, 100.0,
    15.     8.0, 30.0, 30.0, 20.0, 2.0, 7.0, 30.0, 30.0, 0.0, 50.0 };
    16.  
    17. new const m_iTeam            = 114;
    18. new const m_pPlayer          = 41;
    19. new const m_fInReload        = 54;
    20. new const m_fInSpecialReload = 55;
    21. new const m_flTimeWeaponIdle = 48;
    22.  
    23. new bool:g_bLocation, g_iMsgTextMsg, g_iMsgSendAudio, g_szLocation[ 33 ][ 32 ];
    24. new g_pChat, g_pPercent;
    25.  
    26. public plugin_init( ) {
    27.     register_plugin( "Reload radio", "1.0", "xPaw" );
    28.    
    29.     g_pChat    = register_cvar( "rr_chat",    "1" );
    30.     g_pPercent = register_cvar( "rr_percent", "55" );
    31.    
    32.     g_iMsgTextMsg   = get_user_msgid( "TextMsg" );
    33.     g_iMsgSendAudio = get_user_msgid( "SendAudio" );
    34.    
    35.     // 2 = CSW_SHIELD = UNDEFINED | PUT SHOTGUNS HERE TO SKIP IN LOOP AND REGISTER MANUALLY
    36.     new const NO_RELOAD = ( 1 << 2 ) | ( 1 << CSW_KNIFE ) | ( 1 << CSW_C4 ) | ( 1 << CSW_M3 ) |
    37.         ( 1 << CSW_XM1014 ) | ( 1 << CSW_HEGRENADE ) | ( 1 << CSW_FLASHBANG ) | ( 1 << CSW_SMOKEGRENADE );
    38.    
    39.     new szWeaponName[ 20 ];
    40.     for( new i = CSW_P228; i <= CSW_P90; i++ ) {
    41.         if( NO_RELOAD & ( 1 << i ) )
    42.             continue;
    43.        
    44.         get_weaponname( i, szWeaponName, 19 );
    45.        
    46.         RegisterHam( Ham_Weapon_Reload, szWeaponName, "FwdHamWeaponReload", 1 );
    47.     }
    48.    
    49.     RegisterHam( Ham_Weapon_Reload, "weapon_m3",     "FwdHamShotgunReload", 1 );
    50.     RegisterHam( Ham_Weapon_Reload, "weapon_xm1014", "FwdHamShotgunReload", 1 );
    51.    
    52.     new szModName[ 6 ];
    53.     get_modname( szModName, 5 );
    54.    
    55.     if( equal( szModName, "czero" ) )
    56.         register_event( "Location", "EventLocation", "be" );
    57. }
    58.  
    59. public plugin_precache( )
    60.     for( new i; i < sizeof SOUNDS; i++ )
    61.         precache_sound( SOUNDS[ i ] );
    62.  
    63. public EventLocation( const id ) { // Condition Zero
    64.     if( !g_bLocation )
    65.         g_bLocation = true;
    66.    
    67.     if( read_data( 1 ) == id )
    68.         read_data( 2, g_szLocation[ id ], 31 );
    69. }
    70.  
    71. public FwdHamWeaponReload( const iWeapon )
    72.     if( get_pdata_int( iWeapon, m_fInReload, 4 ) ) // m_fInReload is set to TRUE in DefaultReload( )
    73.         DoRadio( get_pdata_cbase( iWeapon, m_pPlayer, 4 ) );
    74.  
    75. public FwdHamShotgunReload( const iWeapon ) {
    76.     if( get_pdata_int( iWeapon, m_fInSpecialReload, 4 ) != 1 )
    77.         return;
    78.    
    79.     // The first set of m_fInSpecialReload to 1. m_flTimeWeaponIdle remains 0.55 set from Reload( )
    80.     new Float:flTimeWeaponIdle = get_pdata_float( iWeapon, m_flTimeWeaponIdle, 4 );
    81.    
    82.     if( flTimeWeaponIdle != 0.55 )
    83.         return;
    84.    
    85.     DoRadio( get_pdata_cbase( iWeapon, m_pPlayer, 4 ) );
    86. }
    87.  
    88. DoRadio( const id ) {
    89.     new iClip, iWeapon  = get_user_weapon( id, iClip );
    90.     new Float:flPercent = floatmul( float( iClip ) / g_iMaxClip[ iWeapon ], 100.0 );
    91.     new Float:flCvar    = get_pcvar_float( g_pPercent );
    92.    
    93.     if( flPercent > flCvar )
    94.         return;
    95.    
    96.     new iPlayers[ 32 ], szId[ 3 ], szName[ 32 ], iNum, iPlayer, iTeam = get_pdata_int( id, m_iTeam, 5 );
    97.     get_players( iPlayers, iNum, "c" );
    98.     get_user_name( id, szName, 31 );
    99.     num_to_str( id, szId, 2 );
    100.    
    101.     new szSound[ 32 ];
    102.     copy( szSound, 31, SOUNDS[ random( sizeof( SOUNDS ) ) ] );
    103.    
    104.     new bool:bChat = bool:!!get_pcvar_num( g_pChat );
    105.    
    106.     for( new i; i < iNum; i++ ) {
    107.         iPlayer = iPlayers[ i ];
    108.        
    109.         if( iTeam != get_pdata_int( iPlayer, m_iTeam, 5 ) )
    110.             continue;
    111.        
    112.         if( bChat ) {
    113.             emessage_begin( MSG_ONE_UNRELIABLE, g_iMsgTextMsg, _, iPlayer );
    114.             ewrite_byte( 5 );
    115.             ewrite_string( szId );
    116.             ewrite_string( g_bLocation ? "#Game_radio_location" : "#Game_radio" );
    117.             ewrite_string( szName );
    118.            
    119.             if( g_bLocation )
    120.                 ewrite_string( g_szLocation[ id ] );
    121.            
    122.             ewrite_string( MESSAGE );
    123.             emessage_end( );
    124.         }
    125.        
    126.         emessage_begin( MSG_ONE_UNRELIABLE, g_iMsgSendAudio, _, iPlayer );
    127.         ewrite_byte( id );
    128.         ewrite_string( szSound );
    129.         ewrite_short( PITCH_NORM );
    130.         emessage_end( );
    131.     }
    132. }
Ok thanks raheem, so some plugin can be use without the need to convert it to ze?

Muhammet20
Veteran Member
Veteran Member
Posts: 408
Joined: 5 years ago
Contact:

#7

Post by Muhammet20 » 4 years ago

imSpartan wrote: 4 years ago
Raheem wrote: 4 years ago Also, you can just compile it without need to change the includes and will work fine in zombie escape mod.

Warnings resolved, try:
    1. #include < amxmodx >
    2. #include < hamsandwich >
    3. #include < fakemeta >
    4.  
    5. new const MESSAGE[ ] = "Cover me... I'm reloading!";
    6.  
    7. new const SOUNDS[ ][ ] = {
    8.     "radio/reloading01.wav",
    9.     "radio/reloading02.wav"
    10. };
    11.  
    12. new const Float:g_iMaxClip[ CSW_P90 + 1 ] = {
    13.     0.0, 13.0, 0.0, 10.0, 1.0,  7.0, 1.0, 30.0, 30.0, 1.0, 30.0,
    14.     20.0, 25.0, 30.0, 35.0, 25.0, 12.0, 20.0, 10.0, 30.0, 100.0,
    15.     8.0, 30.0, 30.0, 20.0, 2.0, 7.0, 30.0, 30.0, 0.0, 50.0 };
    16.  
    17. new const m_iTeam            = 114;
    18. new const m_pPlayer          = 41;
    19. new const m_fInReload        = 54;
    20. new const m_fInSpecialReload = 55;
    21. new const m_flTimeWeaponIdle = 48;
    22.  
    23. new bool:g_bLocation, g_iMsgTextMsg, g_iMsgSendAudio, g_szLocation[ 33 ][ 32 ];
    24. new g_pChat, g_pPercent;
    25.  
    26. public plugin_init( ) {
    27.     register_plugin( "Reload radio", "1.0", "xPaw" );
    28.    
    29.     g_pChat    = register_cvar( "rr_chat",    "1" );
    30.     g_pPercent = register_cvar( "rr_percent", "55" );
    31.    
    32.     g_iMsgTextMsg   = get_user_msgid( "TextMsg" );
    33.     g_iMsgSendAudio = get_user_msgid( "SendAudio" );
    34.    
    35.     // 2 = CSW_SHIELD = UNDEFINED | PUT SHOTGUNS HERE TO SKIP IN LOOP AND REGISTER MANUALLY
    36.     new const NO_RELOAD = ( 1 << 2 ) | ( 1 << CSW_KNIFE ) | ( 1 << CSW_C4 ) | ( 1 << CSW_M3 ) |
    37.         ( 1 << CSW_XM1014 ) | ( 1 << CSW_HEGRENADE ) | ( 1 << CSW_FLASHBANG ) | ( 1 << CSW_SMOKEGRENADE );
    38.    
    39.     new szWeaponName[ 20 ];
    40.     for( new i = CSW_P228; i <= CSW_P90; i++ ) {
    41.         if( NO_RELOAD & ( 1 << i ) )
    42.             continue;
    43.        
    44.         get_weaponname( i, szWeaponName, 19 );
    45.        
    46.         RegisterHam( Ham_Weapon_Reload, szWeaponName, "FwdHamWeaponReload", 1 );
    47.     }
    48.    
    49.     RegisterHam( Ham_Weapon_Reload, "weapon_m3",     "FwdHamShotgunReload", 1 );
    50.     RegisterHam( Ham_Weapon_Reload, "weapon_xm1014", "FwdHamShotgunReload", 1 );
    51.    
    52.     new szModName[ 6 ];
    53.     get_modname( szModName, 5 );
    54.    
    55.     if( equal( szModName, "czero" ) )
    56.         register_event( "Location", "EventLocation", "be" );
    57. }
    58.  
    59. public plugin_precache( )
    60.     for( new i; i < sizeof SOUNDS; i++ )
    61.         precache_sound( SOUNDS[ i ] );
    62.  
    63. public EventLocation( const id ) { // Condition Zero
    64.     if( !g_bLocation )
    65.         g_bLocation = true;
    66.    
    67.     if( read_data( 1 ) == id )
    68.         read_data( 2, g_szLocation[ id ], 31 );
    69. }
    70.  
    71. public FwdHamWeaponReload( const iWeapon )
    72.     if( get_pdata_int( iWeapon, m_fInReload, 4 ) ) // m_fInReload is set to TRUE in DefaultReload( )
    73.         DoRadio( get_pdata_cbase( iWeapon, m_pPlayer, 4 ) );
    74.  
    75. public FwdHamShotgunReload( const iWeapon ) {
    76.     if( get_pdata_int( iWeapon, m_fInSpecialReload, 4 ) != 1 )
    77.         return;
    78.    
    79.     // The first set of m_fInSpecialReload to 1. m_flTimeWeaponIdle remains 0.55 set from Reload( )
    80.     new Float:flTimeWeaponIdle = get_pdata_float( iWeapon, m_flTimeWeaponIdle, 4 );
    81.    
    82.     if( flTimeWeaponIdle != 0.55 )
    83.         return;
    84.    
    85.     DoRadio( get_pdata_cbase( iWeapon, m_pPlayer, 4 ) );
    86. }
    87.  
    88. DoRadio( const id ) {
    89.     new iClip, iWeapon  = get_user_weapon( id, iClip );
    90.     new Float:flPercent = floatmul( float( iClip ) / g_iMaxClip[ iWeapon ], 100.0 );
    91.     new Float:flCvar    = get_pcvar_float( g_pPercent );
    92.    
    93.     if( flPercent > flCvar )
    94.         return;
    95.    
    96.     new iPlayers[ 32 ], szId[ 3 ], szName[ 32 ], iNum, iPlayer, iTeam = get_pdata_int( id, m_iTeam, 5 );
    97.     get_players( iPlayers, iNum, "c" );
    98.     get_user_name( id, szName, 31 );
    99.     num_to_str( id, szId, 2 );
    100.    
    101.     new szSound[ 32 ];
    102.     copy( szSound, 31, SOUNDS[ random( sizeof( SOUNDS ) ) ] );
    103.    
    104.     new bool:bChat = bool:!!get_pcvar_num( g_pChat );
    105.    
    106.     for( new i; i < iNum; i++ ) {
    107.         iPlayer = iPlayers[ i ];
    108.        
    109.         if( iTeam != get_pdata_int( iPlayer, m_iTeam, 5 ) )
    110.             continue;
    111.        
    112.         if( bChat ) {
    113.             emessage_begin( MSG_ONE_UNRELIABLE, g_iMsgTextMsg, _, iPlayer );
    114.             ewrite_byte( 5 );
    115.             ewrite_string( szId );
    116.             ewrite_string( g_bLocation ? "#Game_radio_location" : "#Game_radio" );
    117.             ewrite_string( szName );
    118.            
    119.             if( g_bLocation )
    120.                 ewrite_string( g_szLocation[ id ] );
    121.            
    122.             ewrite_string( MESSAGE );
    123.             emessage_end( );
    124.         }
    125.        
    126.         emessage_begin( MSG_ONE_UNRELIABLE, g_iMsgSendAudio, _, iPlayer );
    127.         ewrite_byte( id );
    128.         ewrite_string( szSound );
    129.         ewrite_short( PITCH_NORM );
    130.         emessage_end( );
    131.     }
    132. }
Ok thanks raheem, so some plugin can be use without the need to convert it to ze?
not all plugins
look, the AMXX plugin no need to conver to ZE
but ZP Plugins it need convert to ZE

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#8

Post by Raheem » 4 years ago

Right as [mention]Muhammet20[/mention] said.
He who fails to plan is planning to fail

imSpartan
Member
Member
Malaysia
Posts: 22
Joined: 4 years ago
Contact:

#9

Post by imSpartan » 4 years ago

Ok guys, thank you. noted.

Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Who is online

Users browsing this forum: No registered users and 7 guests