[Tirant 6.5] Base Builder Ammo Pack

В този раздел се качват всякакви съб-плъгини, тоест добавки за такива плъгини, които имат собствено API и позволяват изработката на съб-плъгини работещи с тях.
Аватар
cstrikekappa
Извън линия
Потребител
Потребител
Мнения: 18
Регистриран на: 06 Ное 2016, 03:10
Обратна връзка:

[Tirant 6.5] Base Builder Ammo Pack

Мнение от cstrikekappa » 08 Ное 2016, 15:19

Това е плъгин, предназначен за сървъри с BaseBuilder модем ammopacks (мод трябва да предостави два native BB_get_user_ap и BB_set_user_ap).

Plugin поддържа банка, предназначени за играчи, където те могат да съхраняват своите ammo, за да ги плати и сигурна от кражба.

Цялата плъгин е подкрепена от командата:

/bank в чата.

След изпълнение на менюто команда ще се появи, когато можете да:

депозитни монети
заплащането монети
промяна на настройките
подобряване на профила
Проверете най-богатият играч сървър
заеме една монета
Ако не сте се регистрирали чрез въвеждане на командата ще бъде създадена нашата сметка.

Цялата сметка е защитен от играч регулируема щифт.

Код за потвърждение: Избери целия код

/* Script generated by Pawn Studio */

#include <amxmodx>
#include <amxmisc>
#include <nvault>
#include <nvault_util>

#define PLUGIN	"Bank AmmoPacks"
#define AUTHOR	"DarkGL"
#define VERSION	"1.0"

native BB_get_user_ap( id );
native BB_set_user_ap( id , amount );

const maxPlayer = 33;

const MAX_LEN_STRUCT = 256;

enum structPlayer {
	accountCreated,
	accountName[ MAX_LEN_STRUCT ],
	accountPin[ MAX_LEN_STRUCT ],
	accountValue,
	accountLogged,
	accountTry,
	accountLimitValue,
	accountAuth,
	accountDebt
}

new vaultHandle;

new playersInformations[ maxPlayer ][ structPlayer ];

new iTransfer[ maxPlayer ];

public plugin_init(){
	
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	register_clcmd( "say /bank" , "bankMenu" );
	register_clcmd( "say_team /bank" , "bankMenu" );
	
	register_clcmd( "NumerPin" , "handlePinNumber" );
	register_clcmd( "PinNumberOld" , "handlePinNumberOld" );
	register_clcmd( "WplacMonety" , "handleWplacAmmo" );
	register_clcmd( "WyplacMonety" , "handleWyplacAmmo" );
	
	register_clcmd( "DebtGet" , "handleDebt" );
	
	vaultHandle = nvault_open( "BankDataBase" );
}

public plugin_end(){
	nvault_close( vaultHandle );
}

public client_connect( id ){
	clearUserInformations( id );
	
	new szName[ 256 ];
	
	get_user_name( id , szName , charsmax( szName ) );
	
	setAccountName( id , szName );
	
	loadUserInformations( id );
}

public client_disconnect( id ){
	saveUserInformations( id );
	
	clearUserInformations( id );
}

public bankMenu( id ){
	if( !getAccountCreated( id ) ){
		menuCreateAccount( id );
		
		return PLUGIN_HANDLED;
	}
	
	if( !getAccountLogged( id ) ){
	
		client_cmd( id , "messagemode NumerPin" );
	
		client_print( id , print_chat , "[BANK] Please enter pin number" );
	
		return PLUGIN_HANDLED;
	}
	
	mainMenu( id );
	
	return PLUGIN_HANDLED;
}

public menuCreateAccount( id ){
	new pMenu = menu_create( "Create an account" , "menuCreateHandle" );
	
	menu_additem( pMenu , "Do you want to create an account?" );
	
	menu_setprop( pMenu , MPROP_BACKNAME , "Quit" );
	
	menu_display( id , pMenu );
}

public menuCreateHandle( id , menu , item ){
	if( item == MENU_EXIT ){
		menu_destroy( menu );
		return PLUGIN_HANDLED;
	}
	
	if( item == 0 ){
		client_cmd( id , "messagemode NumerPin" );
		
		client_print( id , print_chat , "[BANK] Enter the pin code to your account" );
	}
	
	menu_destroy( menu );
	return PLUGIN_HANDLED;
}

public handlePinNumberOld( id ){
	new szData[ 128 ];
	
	read_argv( 1 , szData , charsmax( szData ) );
	
	trim( szData );
	
	if( strlen( szData ) == 0 ){
		return PLUGIN_HANDLED;
	}
	
	new szPin[ MAX_LEN_STRUCT ];
	
	getAccountPin( id , szPin , charsmax( szPin ) );
	
	if( strcmp( szPin , szData ) != 0 ){
		client_print( id , print_chat , "[BANK] Bad old pin" );
		
		setAccountAuth( id , false );
		
		return PLUGIN_HANDLED;
	}
	
	setAccountAuth( id , true );
	
	client_cmd( id , "messagemode NumerPin" );
	
	return PLUGIN_HANDLED;
}

public handlePinNumber( id ){
	new szData[ 128 ];
	
	read_argv( 1 , szData , charsmax( szData ) );
	
	trim( szData );
	
	if( strlen( szData ) == 0 ){
		return PLUGIN_HANDLED;
	}
	
	if( getAccountLogged( id ) ){
		if( getAccountAuth( id ) ){
			setAccountPin( id , szData );
			
			setAccountAuth( id , false );
		}
	}
	else if( getAccountCreated( id ) ){
		if( loginToAccount( id , szData ) ){
			client_print( id , print_chat , "[BANK] You are logged in" );
		}
		else{
			client_print( id , print_chat , "[BANK] Evil Code pin" );
			
			setAccountTry( id , getAccountTry( id ) + 1 );
			
			if( getAccountTry( id ) >= 3 ){
				new playerName[ 256 ];
				
				get_user_name( id , playerName , charsmax( playerName ) );
				
				server_cmd( "kick ^"%s^" ^"Too many times you typed a wrong PIN^"" , playerName );
			}
		}
	}
	else {
		if( createAccount( id , szData) ){
			client_print( id , print_chat , "The account has been set up and are logged in" );
		}
	}
	
	return PLUGIN_HANDLED;
}

public handleWplacAmmo( id ){
	if( !getAccountLogged( id ) ){
		return PLUGIN_HANDLED;
	}
	
	new szAmmount[ 16 ] ,
		iAmmount = 0,
		iDiffrenceAccount;
	
	read_argv( 1 , szAmmount , charsmax( szAmmount ) );
	
	trim( szAmmount );
	
	iAmmount = str_to_num( szAmmount );
	
	if( iAmmount <= 0 ){
		client_print( id , print_chat , "[BANK] Invalid number of coins" );
		
		return PLUGIN_HANDLED;
	}
	
	if( iAmmount > BB_get_user_ap( id ) ){
		iAmmount = BB_get_user_ap( id );
	}
	
	iDiffrenceAccount = getAccountLimit( id ) - getAccountValue( id );
	
	if( iDiffrenceAccount < iAmmount ){
		iAmmount = iDiffrenceAccount;
	}
	
	client_print( id , print_chat , "[BANK] On account was transferred %d coins. To limit your account has been %d many" , getAccountLimit( id ) - getAccountValue( id ) ); 
	
	BB_set_user_ap( id , BB_get_user_ap( id ) - iAmmount );
	
	if( getAccountDebt( id ) > 0 ){
		if( getAccountDebt( id ) < iAmmount ){
			iAmmount -= getAccountDebt( id );
			
			setAccountDebt( id , 0 );
		}
		else {
			setAccountDebt( id , getAccountDebt( id ) - iAmmount );
			
			iAmmount = 0;
		}
	}
	
	setAccountValue( id , getAccountValue( id ) + iAmmount );
	
	return PLUGIN_HANDLED;
}

public handleWyplacAmmo( id ){
	if( !getAccountLogged( id ) ){
		return PLUGIN_HANDLED;
	}
	
	new szAmmount[ 16 ] ,
		iAmmount = 0;
	
	read_argv( 1 , szAmmount , charsmax( szAmmount ) );
	
	trim( szAmmount );
	
	iAmmount = str_to_num( szAmmount );
	
	if( iAmmount <= 0 ){
		client_print( id , print_chat , "[BANK] Invalid number of coins" );
		
		return PLUGIN_HANDLED;
	}
	
	if( iAmmount > getAccountValue( id ) ){
		iAmmount = getAccountValue( id );
	}
	
	setAccountValue( id , getAccountValue( id ) - iAmmount );
	
	BB_set_user_ap( id , BB_get_user_ap( id ) + iAmmount );
	
	client_print( id , print_chat , "[BANK] Paid %d many" , iAmmount );
	
	return PLUGIN_HANDLED;
}

public handleDebt( id ){
	if( !getAccountLogged( id ) ){
		return PLUGIN_HANDLED;
	}
	
	new szAmmount[ 16 ] ,
		iAmmount = 0;
	
	read_argv( 1 , szAmmount , charsmax( szAmmount ) );
	
	trim( szAmmount );
	
	iAmmount = str_to_num( szAmmount );
	
	if( iAmmount <= 0 ){
		client_print( id , print_chat , "[BANK] Invalid number of coins" );
		
		return PLUGIN_HANDLED;
	}
	
	if( iAmmount > 40 || iAmmount + getAccountDebt( id ) > 40 ){
		client_print( id , print_chat , "[BANK] You can borrow up to 40 coins" );
		
		return PLUGIN_HANDLED;
	}
	
	BB_set_user_ap( id , BB_get_user_ap( id ) + iAmmount );
	
	client_print( id , print_chat , "[BANK] Borrowed %d many" , iAmmount );
	
	
	return PLUGIN_HANDLED;
}

public mainMenu( id ){
	
	new szDebt[ 128 ];
	
	formatex( szDebt , charsmax( szDebt ) , "/ Currently borrowed %d many" , getAccountDebt( id ) );
	
	new szTitle[ 256 ];
	
	formatex( szTitle , charsmax( szTitle ) , "Menu konta / LIMIT %d / number of coins %d %s" ,getAccountLimit( id ) , getAccountValue( id ) , getAccountDebt( id ) ? szDebt : "" );
	
	new pMenu = menu_create( szTitle , "mainMenuHandle" );
	
	menu_additem( pMenu , "Donate coins" );
	menu_additem( pMenu , "Withdraw coins" );
	menu_additem( pMenu , "Settings ( change pin )" );
	menu_additem( pMenu , "Improving Accounts ( Bank Limit Increase )" );
	menu_additem( pMenu , "The richest Players Server" );
	menu_additem( pMenu , "Loan" );
	
	menu_setprop( pMenu , MPROP_BACKNAME , "Back" );
	menu_setprop( pMenu , MPROP_NEXTNAME , "Further" );
	menu_setprop( pMenu , MPROP_EXITNAME , "Quit" );
	
	menu_display( id , pMenu );
}

public mainMenuHandle( id , menu , item ){
	if( item == MENU_EXIT ){
		menu_destroy( menu );
		
		return PLUGIN_HANDLED;
	}
	
	switch( item ){
		case 0 : {
			client_print( id , print_chat , "[BANK] How much you wish to deposit coins ?" );
			
			client_cmd( id , "messagemode WplacMonety" );
		}
		case 1 : {
			client_print( id , print_chat , "[BANK] How much you want to withdraw coins ?" );
			
			client_cmd( id , "messagemode WyplacMonety" );
		}
		case 2 : {
			setAccountAuth( id , false );
			
			client_print( id , print_chat , "[BANK] Enter old pin" );
			
			client_cmd( id , "messagemode PinNumberOld" );
		}
		case 3 : {
			if( BB_get_user_ap( id ) < 100 ){
				client_print( id , print_chat , "[BANK] You have too little coins need 100" );
			}
			else if( getAccountLimit( id ) >= 10000 ){
				client_print( id , print_chat , "[BANK] You can not upgrade your account" );
			}
			else {
				new iAddValue = 400;
				
				if( 10000 - getAccountLimit( id ) < 400 ){
					iAddValue = 10000 - getAccountLimit( id );
				}
				
				BB_set_user_ap( id , BB_get_user_ap( id ) - 100 );
				
				setAccountLimit( id , getAccountLimit( id ) + iAddValue );
				
				client_print( id , print_chat , "[BANK] Improved account for %d limit" , getAccountLimit( id ) );
			}
		}
		case 4 : {
			
			delete_file( "tmpAccount.html" );
			
			new handleUtil = nvault_util_open( "BankDataBase" );
			
			new iAmountTotal = nvault_util_count( handleUtil );
			
			new iRet , iPos;
			new szKey[ 256 ] , szData[ 256 ] , iTimeStamp;
			
			new szText[ 256 ];
			
			new accountInformation[ structPlayer ];
			
			new Array: arrayAccounts = ArrayCreate( 1 , sizeof accountInformation ); 
			
			new szPin[ 256 ] ,
				szValue[ 16 ] ,
				szLimit[ 16 ];
			
			for ( new iCurrent = 1 ; iCurrent <= iAmountTotal ; iCurrent++ ){
				new accountInformationSecond[ structPlayer ]; // Im really tired today sorry
				
				iPos = nvault_util_read( handleUtil , iPos , szKey , charsmax( szKey ) , szData , charsmax( szData ) , iTimeStamp );
					
				copy( accountInformationSecond[ accountName ] , MAX_LEN_STRUCT - 1 , szKey );
				
				replace_all( szData , charsmax( szData ) , "#" , " " );
	
				parse( szData , szPin , charsmax( szPin ) , szValue , charsmax( szValue ) , szLimit , charsmax( szLimit ) );
				
				accountInformationSecond[ accountValue ] = str_to_num( szValue );
				
				ArrayPushArray( arrayAccounts , accountInformationSecond );

			}
			
			new iBorder = min( 10 , ArraySize( arrayAccounts ) );
			
			for( new iCurrentElement = 0 ; iCurrentElement < iBorder ; iCurrentElement++ ){
				
				new iBiggestNow = 0 ,
					iID = -1;
				
				for( new iCurrentElement2 = 0 ; iCurrentElement2 < ArraySize( arrayAccounts ) ; iCurrentElement2++ ){
					ArrayGetArray( arrayAccounts , iCurrentElement2 , accountInformation );
					
					if( iBiggestNow < accountInformation[ accountValue ] ){
						iBiggestNow = accountInformation[ accountValue ];
						iID = iCurrentElement2;
					}
				}
				
				if( iID != -1 ){
					ArrayGetArray( arrayAccounts , iID , accountInformation );
					
					formatex( szText , charsmax( szText ) , "%d. %s - %d</br>" , iCurrentElement + 1 , accountInformation[ accountName ] , accountInformation[ accountValue ] );
				
					write_file( "tmpAccount.html" , szText ); 
					
					ArrayDeleteItem( arrayAccounts , iID );
				}
			}
			
			show_motd( id , "tmpAccount.html" , "10 Richest Players Server" );
			
			ArrayDestroy( arrayAccounts );
			
			nvault_util_close( handleUtil );
			
			#pragma unused iRet
		}
		case 5 : {
			client_print( id , print_chat , "[BANK] You can borrow up to 40 coins" );
			
			client_cmd( id , "messagemode DebtGet" );
		}
	}
	
	menu_destroy( menu );
	
	return PLUGIN_HANDLED;
}

public sortDescending( Array: array , itemFirst , itemSecond ){
	new accountInformationFirst[ structPlayer ] ,
		accountInformationSecond[ structPlayer ];
		
	ArrayGetArray( array , itemFirst , accountInformationFirst );
	ArrayGetArray( array , itemSecond , accountInformationSecond );
	
	if( accountInformationFirst[ accountValue ] > accountInformationSecond[ accountValue ] ){
		return 1;
	}
	else if( accountInformationFirst[ accountValue ] < accountInformationSecond[ accountValue ] ){
		return -1;
	}
	
	
	return 0;
}

public menuTransfer( id ){
	new szName[ 256 ] ,
		szID[ 16 ];
	
	new pMenu = menu_create( "Select a Player" , "menuTransferHandle" );
	
	for( new iPlayer = 1 ; iPlayer < maxPlayer ; iPlayer++ ){
		if( !is_user_connected( iPlayer ) || id == iPlayer || !getAccountLogged( iPlayer ) ){
			continue;
		}
		
		num_to_str( iPlayer , szID , charsmax( szID ) );
		
		get_user_name( iPlayer , szName , charsmax( szName ) );
		
		menu_additem( pMenu , szName , szID );
	}
	
	menu_display( id , pMenu );
}

public menuTransferHandle( id , menu , item ){
	if( item == MENU_EXIT ){
		menu_destroy( menu );
		return PLUGIN_HANDLED;
	}
	
	new access , szInfo[ 32 ], name[ 256 ] , callback;

	menu_item_getinfo( menu , item , access, szInfo , charsmax( szInfo ) , name , charsmax( name ) , callback );
	
	new idFound = str_to_num( szInfo );
	
	if( !is_user_connected( idFound ) || !getAccountLogged( idFound ) ){
		menu_destroy( menu );
		return PLUGIN_HANDLED;
	}
	
	client_print( id , print_chat , "[BANK] How much you want to convey ?" );
	
	iTransfer[ id ] = idFound;
	
	client_cmd( id , "messagemode TransferMonet" );
	
	menu_destroy( menu );
	return PLUGIN_HANDLED;
}

bool: loginToAccount( id , szData[] ){
	if( getAccountLogged( id ) ){
		return false;
	}
	
	new szPin[ MAX_LEN_STRUCT ];
	
	getAccountPin( id , szPin , charsmax( szPin ) );
	
	if( strcmp( szPin , szData ) != 0 ){
		
		return false;
	}
	
	setAccountLogged( id , true );
	setAccountTry( id , 0 );
	
	mainMenu( id );
	
	return true;
}

bool:createAccount( id , szPin[] ){
	if( getAccountCreated( id ) ){
		return false;
	}
	
	setAccountCreated( id , true );
	setAccountPin( id , szPin );
	setAccountLogged( id , true );
	setAccountLimit( id , 400 );
	setAccountDebt( id , 0 );
	
	return true;
}

loadUserInformations( id ){
	new szData[ 256 ],
		szKey[ MAX_LEN_STRUCT ];
		
	
	getAccountName( id , szKey , charsmax( szKey ) );
	
	nvault_get( vaultHandle , szKey , szData , charsmax( szData ) );
	
	if( strcmp( szData , "" ) == 0 ){
		setAccountCreated( id , false );
		
		return;
	}
	
	new szPin[ 256 ] ,
		szValue[ 16 ] ,
		szLimit[ 16 ] ,
		szDebt[ 16 ];
	
	replace_all( szData , charsmax( szData ) , "#" , " " );
	
	parse( szData , szPin , charsmax( szPin ) , szValue , charsmax( szValue ) , szLimit , charsmax( szLimit ) , szDebt , charsmax( szDebt ) );
	
	setAccountPin( id , szPin );
	setAccountValue( id , str_to_num( szValue ) );
	setAccountLimit( id , str_to_num( szLimit ) );
	setAccountDebt( id , str_to_num( szDebt ) );
	
	setAccountCreated( id , true );
	
}

saveUserInformations( id ){
	if( !getAccountLogged( id ) ){
		return ;
	}
	
	new szData[ 256 ],
		szKey[ MAX_LEN_STRUCT ];
	
	new pinNumber[ MAX_LEN_STRUCT ];
	
	getAccountName( id , szKey , charsmax( szKey ) );
	
	getAccountPin( id , pinNumber , charsmax( pinNumber ) );
	
	formatex( szData , charsmax( szData ) , "%s#%d#%d#%d" , pinNumber , getAccountValue( id ) , getAccountLimit( id ) , getAccountDebt( id ) );
	
	nvault_set( vaultHandle , szKey , szData );
}

setAccountName( id , szName[] ){
	copy( playersInformations[ id ][ accountName ] , MAX_LEN_STRUCT - 1 , szName );
}

getAccountName( id , szName[] , maxLen ){
	copy( szName , maxLen , playersInformations[ id ][ accountName ] );
}

setAccountCreated( id , bool:stateAccount ){
	playersInformations[ id ][ accountCreated ] = stateAccount;
}

bool:getAccountCreated( id ){
	return bool:playersInformations[ id ][ accountCreated ];
}

setAccountPin( id , szPin[] ){
	copy( playersInformations[ id ][ accountPin ] , MAX_LEN_STRUCT - 1 , szPin );
}

getAccountPin( id , szPin[] , maxLen ){
	copy( szPin , maxLen , playersInformations[ id ][ accountPin ] );
}

setAccountValue( id , value ){
	playersInformations[ id ][ accountValue ] = value;
}

getAccountValue( id ){
	return playersInformations[ id ][ accountValue ];
}

setAccountLogged( id , bool:stateAccount ){
	playersInformations[ id ][ accountLogged ] = stateAccount;
}

bool:getAccountLogged( id ){
	return bool:playersInformations[ id ][ accountLogged ];
}

setAccountTry( id , numberTry ){
	playersInformations[ id ][ accountTry ] = numberTry;
}

getAccountTry( id ){
	return playersInformations[ id ][ accountTry ];
}

setAccountLimit( id , numberLimit ){
	playersInformations[ id ][ accountLimitValue ] = numberLimit;
}

getAccountLimit( id ){
	return playersInformations[ id ][ accountLimitValue ];
}

setAccountAuth( id , bool:auth ){
	playersInformations[ id ][ accountAuth ] = auth;
}

bool: getAccountAuth( id ){
	return bool:playersInformations[ id ][ accountAuth ];
}

setAccountDebt( id , value ){
	playersInformations[ id ][ accountDebt ] = value;
}

getAccountDebt( id ){
	return playersInformations[ id ][ accountDebt ];
}

clearUserInformations( id ){
	setAccountCreated( id , false );
	setAccountName( id , "" );
	setAccountPin( id , "" );
	setAccountValue( id , 0 );
	setAccountLogged( id , false );
	setAccountTry( id , 0 );
	setAccountLimit( id , 0 );
	setAccountAuth( id , false );
	setAccountDebt( id , 0 );
}
Команда: /bank (има регистрация за запазване аммо)

______________________________________________________________________________

Base Builder Various HP
Описание:
Този плъгин е добър за версия 5.4 basebuilder. Колкото повече пъти зомби умира това е по-силен.
Например, обикновено има зомби 2500 HP когато убиваш вече ще имаш 2600, след като е убил 2700 и така нататък.
ТОЗИ ПЛЪГИН РАБОТИ САМО ПРИ BASE BUILDER 5.4 (TIRANT) НЕ РАБОТИ С ТАЗИ ВЕРСИЯ 6.5,6,7

Код за потвърждение: Избери целия код

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

#define PLUGIN "Various HP"
#define VERSION "1.0"
#define AUTHOR "Zenek"
#pragma semicolon 1

#define TASK 88423

new numspawns[33];
new p_zombiehp, p_addedhp, p_numdies;
new Float:zombiehp, Float:addedhp, numdies;

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR);
	
	p_zombiehp = register_cvar("bbv_zombiehp", "3000");
	p_addedhp = register_cvar("bbv_added_health", "200");
	p_numdies = register_cvar("bbv_number_deaths", "1");
	RegisterHam(Ham_Spawn, "player", "hamspawn", 1);
}

public plugin_cfg()
{
	zombiehp = get_pcvar_float(p_zombiehp);
	addedhp = get_pcvar_float(p_addedhp);
	numdies = get_pcvar_num(p_numdies);
}

public client_connect(id)
	numspawns[id] = 0;

public hamspawn(id)
{
	if (get_user_team(id) == 1)
	{
		numspawns[id]++;
		set_task(1.5, "change_hp", TASK+id);
	}
	else
		numspawns[id] = 0;
}
		
public change_hp(id)
{
	id -= TASK;
	set_pev(id, pev_health, zombiehp+addedhp*float((numspawns[id]-1)/numdies));
}

  • Подобни теми
    Отговори
    Преглеждания
     Последно мнение

Обратно към “Съб-плъгини”

Кой е на линия

Потребители разглеждащи този форум: 0 регистрирани и 5 госта