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

Suggestion / Subplugin Request [REQ] Ammo Pack Bank


Post New Thread Reply   
 
Thread Tools Display Modes
AmineKyo
فوق سريرك
Join Date: Oct 2011
Location: Morocco
Old 03-12-2012 , 15:29   Re: [REQ] Ammo Pack Bank
Reply With Quote #21

Quote:
//// zp50_ammopacks_bank.sma
// C:\Documents and Settings\MedAmine\Desktop\pawn.compiler\zp50_ ammopacks_bank.
sma(342) : error 029: invalid expression, assumed zero
// C:\Documents and Settings\MedAmine\Desktop\pawn.compiler\zp50_ ammopacks_bank.
sma(342 -- 343) : warning 215: expression has no effect
// C:\Documents and Settings\MedAmine\Desktop\pawn.compiler\zp50_ ammopacks_bank.
sma(343) : error 010: invalid function or declaration
// C:\Documents and Settings\MedAmine\Desktop\pawn.compiler\zp50_ ammopacks_bank.
sma(346) : error 010: invalid function or declaration
// C:\Documents and Settings\MedAmine\Desktop\pawn.compiler\zp50_ ammopacks_bank.
sma(350) : error 010: invalid function or declaration
// C:\Documents and Settings\MedAmine\Desktop\pawn.compiler\zp50_ ammopacks_bank.
sma(353) : error 010: invalid function or declaration
// C:\Documents and Settings\MedAmine\Desktop\pawn.compiler\zp50_ ammopacks_bank.
sma(355) : error 010: invalid function or declaration
// C:\Documents and Settings\MedAmine\Desktop\pawn.compiler\zp50_ ammopacks_bank.
sma(356) : error 010: invalid function or declaration
// C:\Documents and Settings\MedAmine\Desktop\pawn.compiler\zp50_ ammopacks_bank.
sma(359) : error 021: symbol already defined: "read_argv"
// C:\Documents and Settings\MedAmine\Desktop\pawn.compiler\zp50_ ammopacks_bank.
sma(363) : error 010: invalid function or declaration
// C:\Documents and Settings\MedAmine\Desktop\pawn.compiler\zp50_ ammopacks_bank.
sma(370) : error 021: symbol already defined: "nvault_prune"
// C:\Documents and Settings\MedAmine\Desktop\pawn.compiler\zp50_ ammopacks_bank.
sma(374) : error 021: symbol already defined: "get_players"
// C:\Documents and Settings\MedAmine\Desktop\pawn.compiler\zp50_ ammopacks_bank.
sma(377) : error 010: invalid function or declaration
// C:\Documents and Settings\MedAmine\Desktop\pawn.compiler\zp50_ ammopacks_bank.
sma(381) : error 010: invalid function or declaration
// C:\Documents and Settings\MedAmine\Desktop\pawn.compiler\zp50_ ammopacks_bank.
sma(384) : error 010: invalid function or declaration
// C:\Documents and Settings\MedAmine\Desktop\pawn.compiler\zp50_ ammopacks_bank.
sma(392) : error 021: symbol already defined: "nvault_prune"
// C:\Documents and Settings\MedAmine\Desktop\pawn.compiler\zp50_ ammopacks_bank.
sma(394) : error 054: unmatched closing brace
// C:\Documents and Settings\MedAmine\Desktop\pawn.compiler\zp50_ ammopacks_bank.
sma(395) : warning 203: symbol is never used: "iNum"
// C:\Documents and Settings\MedAmine\Desktop\pawn.compiler\zp50_ ammopacks_bank.
sma(395) : warning 203: symbol is never used: "iPlayers"
// C:\Documents and Settings\MedAmine\Desktop\pawn.compiler\zp50_ ammopacks_bank.
sma(395) : warning 203: symbol is never used: "iTime"
// C:\Documents and Settings\MedAmine\Desktop\pawn.compiler\zp50_ ammopacks_bank.
sma(395) : warning 203: symbol is never used: "player2"
// C:\Documents and Settings\MedAmine\Desktop\pawn.compiler\zp50_ ammopacks_bank.
sma(395) : warning 203: symbol is never used: "szArgc"
// C:\Documents and Settings\MedAmine\Desktop\pawn.compiler\zp50_ ammopacks_bank.
sma(395) : warning 203: symbol is never used: "szTemp"
//
// 16 Errors.
// Could not locate output file compiled\zp50_ammopacks_bank.amx (compile failed
).
//
// Compilation Time: 0,27 sec
// ----------------------------------------
What a Fu***** Day
__________________
AmineKyo is offline
gogicaa
Veteran Member
Join Date: Aug 2011
Location: //
Old 03-12-2012 , 15:37   Re: [REQ] Ammo Pack Bank
Reply With Quote #22

show me code
gogicaa is offline
AmineKyo
فوق سريرك
Join Date: Oct 2011
Location: Morocco
Old 03-12-2012 , 15:59   Re: [REQ] Ammo Pack Bank
Reply With Quote #23

its in the attachments
Source : http://forums.alliedmods.net/showthr...highlight=Bank
Attached Files
File Type: sma Get Plugin or Get Source (zp50_ammopacks_bank.sma - 322 views - 9.5 KB)
__________________

Last edited by AmineKyo; 03-12-2012 at 16:00.
AmineKyo is offline
H.RED.ZONE
Veteran Member
Join Date: Sep 2011
Location: Serbia, Belgrade
Old 03-12-2012 , 16:54   Re: [REQ] Ammo Pack Bank
Reply With Quote #24

Did you added include?
__________________
H.RED.ZONE is offline
gogicaa
Veteran Member
Join Date: Aug 2011
Location: //
Old 03-12-2012 , 17:36   Re: [REQ] Ammo Pack Bank
Reply With Quote #25

Try this :
Code:
#include <amxmodx>
#include <amxmisc>
#include <zp50_ammopacks>
#include <zp50_colorchat>

//#define SQLX
#define ADMIN_LEVEL_TO_RESET	ADMIN_BAN

new const PLUGIN_VERSION[] = "1.1.5"

#if defined SQLX
	new SQL_HOST[] = "127.0.0.1"
	new SQL_USER[] = "root"
	new SQL_PASS[] = "yoursqlpasswordhere"
	new SQL_DB[] = "amx"
	
	new Handle:g_SqlTuple
	new g_Error[512]
#else
	new g_hVault
#endif

const SIZE = 1536

new CvarAutoSave, CvarAutoLoad, CvarBankLimit, CvarBankBlockStart, CvarBankAdvertiseInterval

new g_iSteamID[33][32], g_iBank[33], g_iAmmoPacks[33], bool:IsManual[33], bool:IsAll[33]

#if defined SQLX
	#include <zp50_bank_sqlx>
#else
	#include <zp50_bank_nvault>
#endif

public plugin_init()
{
	register_plugin("[ZP 5.0] Ammo Packs Bank", PLUGIN_VERSION, "Excalibur.007")
	register_dictionary("zp50_bank.txt")
	
	register_clcmd("say", "OnClientChat")
	register_clcmd("say_team", "OnClientChat")
	register_concmd("zp_bank_reset", "OnAdminReset", ADMIN_LEVEL_TO_RESET, "- resets bank in terms of days. 0 to clean all.")
	
	CvarAutoSave = register_cvar("zp_bank_auto_save", "1")
	CvarAutoLoad = register_cvar("zp_bank_auto_load", "1")
	CvarBankLimit = register_cvar("zp_bank_limit", "1000000000")
	CvarBankBlockStart = register_cvar("zp_bank_block_start", "1")
	CvarBankAdvertiseInterval = register_cvar("zp_bank_advertise_interval", "0")
	
	#if defined SQLX
		set_task(0.5, "MySQL_Init")
	#else
		g_hVault = nvault_open("zp50_ammo_packs_bank")
		
		if(g_hVault == INVALID_HANDLE)
			set_fail_state("Unable to create/load vault 'zp50_ammo_packs_bank'")
	#endif
}

public plugin_cfg()
{
	set_task(get_pcvar_float(CvarBankAdvertiseInterval), "AdvertiseBankInfo", 0)
}

public AdvertiseBankInfo()
{
	new iPlayers[32], iNum
	get_players(iPlayers, iNum, "ch")
	
	new player
	for(new i = 0; i < iNum; i++)
	{
		player = iPlayers[i]
		
		zp_colored_print(player, "%L", player, "BANK_ADVERTISE")
	}
}

public client_putinserver(player)
{
	if(get_pcvar_num(CvarBankBlockStart))
		zp_ammopacks_set(player, 0)
}

public client_disconnect(player)
{
	if(get_pcvar_num(CvarAutoSave))
	{
		#if defined SQLX
			Save_MySQL(player)
		#else
			Save_nVault(player)
		#endif
	}
	
	g_iSteamID[player][0] = 0
	g_iBank[player] = 0
	g_iAmmoPacks[player] = 0
	IsManual[player] = false
	IsAll[player] = false
}

public client_authorized(player)
{
	get_user_authid(player, g_iSteamID[player], 31)
	
	if(get_pcvar_num(CvarAutoLoad))
	{
		#if defined SQLX
			Load_MySQL(player)
		#else
			Load_nVault(player)
		#endif
	}
}

public OnClientChat(player)
{
	static szArgs[32]
	read_args(szArgs, 31)
	remove_quotes(szArgs)
	
	static szArg1[32], szArg2[32], szArg3[32]
	
	szArg1[0] = '^0'
	szArg2[0] = '^0'
	szArg3[0] = '^0'
	
	parse(szArgs, szArg1, 31, szArg2, 31, szArg3, 32)
	
	new iValue = str_to_num(szArg2)
	
	g_iAmmoPacks[player] = zp_ammopacks_get(player)
	
	new iBankLimit = get_pcvar_num(CvarBankLimit)
	
	if(equali(szArg1, "/deposit", 8) || equali(szArg1, "deposit", 7))
	{
		if(iValue > g_iAmmoPacks[player])
		{
			iValue = g_iAmmoPacks[player]
		}
		else if(equali(szArg2, "all", 3))
		{
			iValue = g_iAmmoPacks[player]
			IsAll[player] = true
		}
		
		if(iValue <= 0 && !IsAll[player])
		{
			zp_colored_print(player, "%L", player, "BANK_INVALID_AMOUNT")
			return PLUGIN_HANDLED
		}
		
		IsAll[player] = false
		IsManual[player] = true
		
		new iTemp = g_iBank[player]
		
		g_iBank[player] += iValue
		
		if(g_iBank[player] > iBankLimit)
		{
			zp_ammopacks_set(player, g_iAmmoPacks[player] + g_iBank[player] - iBankLimit)
			
			iValue = iBankLimit - iTemp
			
			g_iBank[player] = iBankLimit
		}
		else
		{
			zp_ammopacks_set(player, g_iAmmoPacks[player] - iValue)
		}
		
		g_iAmmoPacks[player] -= iValue
		
		if(get_pcvar_num(CvarAutoSave))
		{
			#if defined SQLX
				Save_MySQL(player)
			#else
				Save_nVault(player)
			#endif
		}
		
		zp_colored_print(player, "%L", player, "BANK_DEPOSIT", iValue)
		
		return PLUGIN_HANDLED
	}
	else if(equali(szArg1, "/withdraw", 9) || equali(szArg1, "withdraw", 8))
	{
		if(iValue > g_iBank[player])
		{
			iValue = g_iBank[player]
		}
		else if(equali(szArg2, "all", 3))
		{
			iValue = g_iBank[player]
			IsAll[player] = true
		}
		
		if(iValue <= 0 && !IsAll[player])
		{
			zp_colored_print(player, "%L", player, "BANK_INVALID_AMOUNT")
			return PLUGIN_HANDLED
		}
		
		IsAll[player] = false
		IsManual[player] = true
		
		zp_ammopacks_set(player, g_iAmmoPacks[player] + iValue)
		
		g_iBank[player] -= iValue
		g_iAmmoPacks[player] += iValue
		
		if(get_pcvar_num(CvarAutoSave))
		{
			#if defined SQLX
				Save_MySQL(player)
			#else
				Save_nVault(player)
			#endif
		}
		
		zp_colored_print(player, "%L", player, "BANK_WITHDRAW", iValue)
		
		return PLUGIN_HANDLED
	}
	else if(equali(szArg1, "/bank", 5) || equali(szArg1, "bank", 4))
	{
		zp_colored_print(player, "%L", player, "BANK_BALANCE", g_iBank[player])
		
		return PLUGIN_HANDLED
	}
	else if(equali(szArg1, "/donate", 7) || equali(szArg1, "donate", 6))
	{
		new iValue = str_to_num(szArg3)
		
		if(iValue > g_iBank[player])
		{
			zp_colored_print(player, "%L", player, "BANK_DONATE_HIGHER_AMOUNT")
			return PLUGIN_HANDLED
		}
		
		if(iValue <= 0)
		{
			zp_colored_print(player, "%L", player, "BANK_INVALID_AMOUNT")
			return PLUGIN_HANDLED
		}
		
		new target = cmd_target(player, szArg2, CMDTARGET_NO_BOTS)
		
		if(!target)
		{
			zp_colored_print(player, "%L", player, "BANK_INVALID_TARGET")
			return PLUGIN_HANDLED
		}
		
		new iTemp = g_iBank[player]
		
		new szNamePlayer[32], szNameTarget[32]
		
		get_user_name(player, szNamePlayer, 31)
		get_user_name(target, szNameTarget, 31)
		
		g_iBank[player] -= iValue
		g_iBank[target] += iValue
		
		if(g_iBank[target] > iBankLimit)
		{
			g_iBank[player] += (g_iBank[target] - iBankLimit)
			g_iBank[target] = iBankLimit
			
			iValue = iBankLimit - iTemp
		}
		
		if(get_pcvar_num(CvarAutoSave))
		{
			#if defined SQLX
				Save_MySQL(player)
				Save_MySQL(target)
			#else
				Save_nVault(player)
				Save_nVault(target)
			#endif
		}
		
		zp_colored_print(player, "%L", player, "BANK_DONATE_CHAT_TO_PLAYER", iValue, szNameTarget)
		zp_colored_print(target, "%L", target, "BANK_DONATE_CHAT_TO_TARGET", szNamePlayer, iValue)
		
		return PLUGIN_HANDLED
	}
	else if(equali(szArg1, "/bankhelp", 9) || equali(szArg1, "bankhelp", 8))
	{
		new msg[SIZE + 1], len = 0

		len += format(msg[len], SIZE - len, "<html><body>")
		len += format(msg[len], SIZE - len, "<p>[BANK COMMANDS]<br/>")
		len += format(msg[len], SIZE - len, "------------------------------------------------------------------------</p>")
		len += format(msg[len], SIZE - len, "/withdraw <amount> or /withdraw all<br/>")
		len += format(msg[len], SIZE - len, "- Withdraws an amount of ammo packs from the bank storage</p>")
		len += format(msg[len], SIZE - len, "------------------------------------------------------------------------</p>")
		len += format(msg[len], SIZE - len, "/deposit <amount> or /deposit all</p>")
		len += format(msg[len], SIZE - len, "------------------------------------------------------------------------</p>")
		len += format(msg[len], SIZE - len, "- Deposits an amount of ammo packs to the bank storage</p>")
		len += format(msg[len], SIZE - len, "- Checks your bank status</p>")
		len += format(msg[len], SIZE - len, "------------------------------------------------------------------------</p>")
		len += format(msg[len], SIZE - len, "/donate <amount> <player's name> </p>")
		len += format(msg[len], SIZE - len, "- Donates an amount of ammo packs to the specified player</p>")
		len += format(msg[len], SIZE - len, "------------------------------------------------------------------------</p>")
		len += format(msg[len], SIZE - len, "Note: Commands can be entered without ^"/^" infront.</p>")
		len += format(msg[len], SIZE - len, "</body></html>")
		show_motd(player, msg, "Bank Help")
		
		return PLUGIN_CONTINUE
	}
	else if(equali(szArg1, "/banksave", 9) || equali(szArg1, "banksave", 8))
	{
		#if defined SQLX
			Save_MySQL(player)
		#else
			Save_nVault(player)
		#endif
	}
	else if(equali(szArg1, "/bankload", 9) || equali(szArg1, "bankload", 8))
	{
		#if defined SQLX
			Load_MySQL(player)
		#else
			Load_nVault(player)
		#endif
	} 
	else
	{
		return PLUGIN_CONTINUE
	}
	
	return PLUGIN_CONTINUE
}

public OnAdminReset(player, level, cid)
{
	if(!cmd_access(player, level, cid, 1))
	{
		console_print(player, "You have no access to that command")
		return
	}
	new szArgc = read_argc()
	
	if(szArgc >= 3)
	{
		console_print(player, "Too many arguments supplied.")
		return
	}
	else if(szArgc == 1)
		return
		
	new szArgv[10], szTemp[512]
	read_argv(1, szArgv, 9)
	
	new iTime = str_to_num(szArgv)
	
	if(iTime == 0)
	{
		#if defined SQLX
			formatex(szTemp, 511, "TRUNCATE TABLE `bank`")
			
			SQL_ThreadQuery(g_SqlTuple, "IgnoreHandle", szTemp)
		#else
			nvault_prune(g_hVault, 0, 0)
		#endif
		
		new iPlayers[32], iNum
		get_players(iPlayers, iNum)
		
		new player2
		for(new i = 0; i < iNum; i++)
		{
			player2 = iPlayers[i]
			
			g_iBank[player2] = 0
		}
	}
	else
	{
		#if defined SQLX
		
			formatex(szTemp, 511, "DELETE FROM `bank` WHERE last_played<(SYSDATE() - INTERVAL '%d' DAY)", iTime)
			
			SQL_ThreadQuery(g_SqlTuple, "IgnoreHandle", szTemp)
		#else
			nvault_prune(g_hVault, 0, get_systime() - (iTime * 86400))
		#endif
	}
}
gogicaa is offline
AmineKyo
فوق سريرك
Join Date: Oct 2011
Location: Morocco
Old 03-13-2012 , 16:38   Re: [REQ] Ammo Pack Bank
Reply With Quote #26

gogicaa thank u so much i hope it works
can i ask a question ? .
why ambience sounds don't work ?
__________________
AmineKyo is offline
gogicaa
Veteran Member
Join Date: Aug 2011
Location: //
Old 03-15-2012 , 05:20   Re: [REQ] Ammo Pack Bank
Reply With Quote #27

Quote:
Originally Posted by AmineKyo View Post
gogicaa thank u so much i hope it works
can i ask a question ? .
why ambience sounds don't work ?
idk .
show me your ambience sounds configuration.
gogicaa is offline
AmineKyo
فوق سريرك
Join Date: Oct 2011
Location: Morocco
Old 03-15-2012 , 08:42   Re: [REQ] Ammo Pack Bank
Reply With Quote #28

Quote:
Originally Posted by gogicaa View Post
idk .
show me your ambience sounds configuration.
Quote:
Originally Posted by ZombiePlague.ini
[Ambience Sounds] (only .wav and .mp3 formats supported, duration is in seconds)
SOUNDS (Infection Mode) = HP_Zombie/zombi_ambience.mp3
DURATIONS (Infection Mode) = 184
SOUNDS (Multiple Infection Mode) =
DURATIONS (Multiple Infection Mode) =
SOUNDS (Swarm Mode) =
DURATIONS (Swarm Mode) =
SOUNDS (Nemesis Mode) =
DURATIONS (Nemesis Mode) =
SOUNDS (Survivor Mode) =
DURATIONS (Survivor Mode) =
SOUNDS (Plague Mode) =
DURATIONS (Plague Mode) =
SOUNDS (Armageddon Mode) =
DURATIONS (Armageddon Mode) =
__________________
AmineKyo is offline
H.RED.ZONE
Veteran Member
Join Date: Sep 2011
Location: Serbia, Belgrade
Old 03-15-2012 , 10:13   Re: [REQ] Ammo Pack Bank
Reply With Quote #29

Mono/Stereo.
__________________
H.RED.ZONE is offline
AmineKyo
فوق سريرك
Join Date: Oct 2011
Location: Morocco
Old 03-15-2012 , 12:14   Re: [REQ] Ammo Pack Bank
Reply With Quote #30

Bit Rate : 128KBPS
Channels : 2(Stereo)
Audio Sample Rate : 44 kHz
i take it from here : [ZP] CSO In-Game Theme ( Version 5.5 )
__________________
AmineKyo 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 01:35.


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