Moderator
M
Moderator
18:27, 19th Aug 2013
PurgeandFire: Changes made, approved.
PurgeandFire: Changes made, approved.
GoldBankingSystemConfig

Events


Map initialization

Conditions

Actions


-------- To withdraw or deposit certain amounts type in the desired chat like -wgold then the number u want to deposit or withdraw. Example -wgold 1000 will withdraw 1000 gold from the bank. --------


-------- --------


-------- --------


-------- This is for the withdraw string. Currently it is set to -wgold --------


Set withdrawGoldString = -wgold


-------- --------


-------- --------


-------- This is for the withdraw all string. This withdraws all of the gold in ur bank. Currently it is set to -wagold --------


Set withdrawAllGoldString = -wagold


-------- --------


-------- --------


-------- This is for the deposit string. Currently it is set to -dgold --------


Set depositGoldString = -dgold


-------- --------


-------- --------


-------- This is for the deposit all string. This deposits all of the current gold you have. Currently it is set to -dagold --------


Set depositAllGoldString = -dagold


-------- --------


-------- --------


-------- This is for the check string. This checks the amount of gold you have in the bank. Currently it is set to -checkgold --------


Set checkBankGoldString = -checkgold


-------- --------


-------- --------


-------- This variable allows you to stop a player from withdrawing from their bank. To do this set the index for the player number and set the variable to false. example index 1 is for player 1 red --------


Set withdrawGoldBoolPlayer[1] = True


-------- --------


-------- --------


-------- This variable allows you to stop a player from depositing from their bank. To do this set the index for the player number and set the variable to false. example index 1 is for player 1 red --------


Set depositGoldBoolPlayer[1] = True


Set depositGoldBoolPlayer[1] = True


-------- --------


-------- --------


-------- This function allows you to display to a player their gold in the bank. I have the check chat message for the player to use but if you want to display it for a specific player at any given time use this. --------


-------- function CheckGoldBankSinglePlayer takes player pl returns nothing --------


-------- To use this function you use custom script: and do this. --------


-------- call CheckGoldBankSinglePlayer( udg_tempPlayer) --------


-------- As you can see i put tempPlayer variable in there. just put the player you want to show this to into the tempPlayer variable. --------


-------- --------


-------- --------


-------- This function allows you to display every players bank gold with a simple value. --------


-------- function DisplayGoldBankStatusAll takes nothing returns nothing --------


-------- To use this function you use custom script: and do this. --------


-------- call DisplayGoldBankStatusAll() --------


-------- It will then display to each player their own bank value. --------


-------- --------


-------- --------


-------- This function allows you to increase a certain players bank value based on a percent value. --------


-------- function GoldBankInterestIncSinglePlayer takes player pl, real r returns nothing --------


-------- To use this function you use custom script: and do this. --------


-------- call GoldBankInterestIncSinglePlayer( udg_tempPlayer, udg_tempReal) --------


-------- it will then increase a single players bank value based on the real value you put in. this is based on a percentage value so 20% is .20 --------


-------- --------


-------- --------


-------- This function allows you to increase all players bank value based on a percent value. --------


-------- function GoldBankInterestIncAll takes real r returns nothing --------


-------- To use this function you use custom script: and do this. --------


-------- GoldBankInterestIncAll( udg_tempReal) --------


-------- it will then increase all players bank value based on the real value you put in. this is based on a percentage value so 20% is .20 --------


-------- --------


-------- --------


-------- --------


-------- This function allows you to store a certain amount of gold from the player. --------


-------- function GoldBankForcedBanking takes player P, integer amount returns nothing --------


-------- To use this function you use custom script: and do this. --------


-------- GoldBankForcedBanking( player, amount) --------


-------- It will automatically remove the gold from the player and store it in there bank. There is not a check to see if that player has the amount of gold that is being added so be careful using this. --------


-------- --------


-------- --------


-------- --------


-------- Delete everything after this point after posting into your map --------


Set checkGoldBankSystemInt = 0


Set depositGoldAllBankSystemInt = 0


Set depositGoldBankSystemInt = 0


Set withdrawGoldAllBankSystemInt = 0


Set withdrawGoldBankSystemInt = 0


Set goldBankGold[1] = 0
// Gold Banking System version 1.0.0.6
// by deathismyfriend
function GoldBankForcedBuying takes player P, integer amount returns boolean
local integer p = GetPlayerId( P)
local integer i
if udg_goldBankGold[ p] >= amount then
set udg_goldBankGold[ p] = udg_goldBankGold[ p] - amount
return true
elseif udg_goldBankGold[ p] + GetPlayerState( P, PLAYER_STATE_RESOURCE_GOLD) >= amount then
set i = amount - udg_goldBankGold[ p]
set udg_goldBankGold[ p] = 0
call SetPlayerState( P, PLAYER_STATE_RESOURCE_GOLD, GetPlayerState( P, PLAYER_STATE_RESOURCE_GOLD) - i)
return true
endif
return false
endfunction
function GoldBankForcedBanking takes player P, integer amount returns nothing
local integer p = GetPlayerId( P)
call SetPlayerState( P, PLAYER_STATE_RESOURCE_GOLD, GetPlayerState( P, PLAYER_STATE_RESOURCE_GOLD) - amount)
set udg_goldBankGold[ p] = udg_goldBankGold[ p] + amount
endfunction
function CheckGoldBankSinglePlayer takes player pl returns nothing
local integer p = GetPlayerId( pl)
call DisplayTextToPlayer( Player( p), 0 , 0, "You have " + I2S( udg_goldBankGold[ p]) + " gold in your bank")
endfunction
function DisplayGoldBankStatusAll takes nothing returns nothing
local integer L = 0
loop
exitwhen L > 11
call CheckGoldBankSinglePlayer( Player( L))
set L = L + 1
endloop
endfunction
function GoldBankInterestIncSinglePlayer takes player pl, real r returns nothing
local integer p = GetPlayerId( pl)
set r = r + 1.00
set udg_goldBankGold[ p] = R2I( udg_goldBankGold[ p] * r)
endfunction
function GoldBankInterestIncAll takes real r returns nothing
local integer L = 0
loop
exitwhen L > 11
call GoldBankInterestIncSinglePlayer( Player( L), r)
set L = L + 1
endloop
endfunction
function GoldBankingSystemWithdraw takes nothing returns boolean
local string entered = GetEventPlayerChatString()
local string sub1 = SubString( entered, 0, udg_withdrawGoldBankSystemInt)
local string sub2 = SubString( entered, 0, udg_withdrawGoldAllBankSystemInt)
local integer p = GetPlayerId( GetTriggerPlayer())
local integer gold
local playerstate psrg = PLAYER_STATE_RESOURCE_GOLD
local player pl = Player( p)
if udg_withdrawGoldBoolPlayer[ p + 1] then
if sub1 == udg_withdrawGoldString then
set gold = S2I( SubString( entered, udg_depositGoldBankSystemInt, StringLength( entered)))
if udg_goldBankGold[ p] > gold then
call SetPlayerState( pl, psrg, GetPlayerState( pl, psrg) + gold)
set udg_goldBankGold[ p] = udg_goldBankGold[ p] - gold
else
set gold = udg_goldBankGold[ p]
call SetPlayerState( pl, psrg, GetPlayerState( pl, psrg) + gold)
set udg_goldBankGold[ p] = 0
endif
elseif sub2 == udg_withdrawAllGoldString then
call SetPlayerState( pl, psrg, GetPlayerState( pl, psrg) + udg_goldBankGold[ p])
set udg_goldBankGold[ p] = 0
endif
endif
call CheckGoldBankSinglePlayer( pl)
set pl = null
set psrg = null
return false
endfunction
function GoldBankingSystemDeposit takes nothing returns boolean
local string entered = GetEventPlayerChatString()
local string sub1 = SubString( entered, 0, udg_depositGoldBankSystemInt)
local string sub2 = SubString( entered, 0, udg_depositGoldAllBankSystemInt)
local integer p = GetPlayerId( GetTriggerPlayer())
local integer gold
local playerstate psrg = PLAYER_STATE_RESOURCE_GOLD
local integer i
local player pl = Player( p)
if udg_depositGoldBoolPlayer[ p + 1] then
if sub1 == udg_depositGoldString then
set gold = S2I( SubString( entered, udg_depositGoldBankSystemInt, StringLength( entered)))
set i = GetPlayerState( pl, psrg)
if gold > i then
call SetPlayerState( pl, psrg, 0)
set udg_goldBankGold[ p] = udg_goldBankGold[ p] + i
else
call SetPlayerState( pl, psrg, i - gold)
set udg_goldBankGold[ p] = udg_goldBankGold[ p] + gold
endif
elseif sub2 == udg_depositAllGoldString then
set i = GetPlayerState( pl, psrg)
call SetPlayerState( pl, psrg, 0)
set udg_goldBankGold[ p] = udg_goldBankGold[ p] + i
endif
endif
call CheckGoldBankSinglePlayer( pl)
set pl = null
set psrg = null
return false
endfunction
function GoldBankingSystemCheck takes nothing returns boolean
if SubString( GetEventPlayerChatString(), 0, udg_checkGoldBankSystemInt) == udg_checkBankGoldString then
call CheckGoldBankSinglePlayer( GetTriggerPlayer())
endif
return false
endfunction
function GoldBankingSystemSetup takes nothing returns nothing
local trigger t1 = CreateTrigger()
local trigger t2 = CreateTrigger()
local trigger t3 = CreateTrigger()
local integer L = 0
local player P
loop
exitwhen L > 11
set P = Player( L)
// Check if the player is playing and if that player is a user so this will only register the actual players.
if GetPlayerSlotState( P) == PLAYER_SLOT_STATE_PLAYING and GetPlayerController( P) == MAP_CONTROL_USER then
call TriggerRegisterPlayerChatEvent( t1, P, udg_withdrawGoldString, false)
call TriggerRegisterPlayerChatEvent( t1, P, udg_withdrawAllGoldString, false)
call TriggerRegisterPlayerChatEvent( t2, P, udg_depositGoldString, false)
call TriggerRegisterPlayerChatEvent( t2, P, udg_depositAllGoldString, false)
call TriggerRegisterPlayerChatEvent( t3, P, udg_checkBankGoldString, false)
endif
set L = L + 1
endloop
set udg_withdrawGoldBankSystemInt = StringLength( udg_withdrawGoldString)
set udg_withdrawGoldAllBankSystemInt = StringLength( udg_withdrawAllGoldString)
set udg_depositGoldBankSystemInt = StringLength( udg_depositGoldString)
set udg_depositGoldAllBankSystemInt = StringLength( udg_depositAllGoldString)
set udg_checkGoldBankSystemInt = StringLength( udg_checkBankGoldString)
call TriggerAddCondition( t1, Condition( function GoldBankingSystemWithdraw))
call TriggerAddCondition( t2, Condition( function GoldBankingSystemDeposit))
call TriggerAddCondition( t3, Condition( function GoldBankingSystemCheck))
call DestroyTimer( GetExpiredTimer())
set P = null
set t1 = null
set t2 = null
set t3 = null
endfunction
//===========================================================================
function InitTrig_GoldBankingSystemCode takes nothing returns nothing
call TimerStart( CreateTimer(), 0.00, false, function GoldBankingSystemSetup)
endfunction
LumberBankingSystemConfig

Events


Map initialization

Conditions

Actions


-------- To withdraw or deposit certain amounts type in the desired chat like -wlumber then the number u want to deposit or withdraw. Example -wlumber 1000 will withdraw 1000 lumber from the bank. --------


-------- --------


-------- --------


-------- This is for the withdraw string. Currently it is set to -wlumber --------


Set withdrawLumberString = -wlumber


-------- --------


-------- --------


-------- This is for the withdraw all string. This withdraws all of the lumber in ur bank. Currently it is set to -walumber --------


Set withdrawAllLumberString = -walumber


-------- --------


-------- --------


-------- This is for the deposit string. Currently it is set to -dlumber --------


Set depositLumberString = -dlumber


-------- --------


-------- --------


-------- This is for the deposit all string. This deposits all of the current lumber you have. Currently it is set to -dalumber --------


Set depositAllLumberString = -dalumber


-------- --------


-------- --------


-------- This is for the check string. This checks the amount of lumber you have in the bank. Currently it is set to -checklumber --------


Set checkBankLumberString = -checklumber


-------- --------


-------- --------


-------- This variable allows you to stop a player from withdrawing from their bank. To do this set the index for the player number and set the variable to false. example index 1 is for player 1 red --------


Set withdrawLumberBoolPlayer[1] = True


-------- --------


-------- --------


-------- This variable allows you to stop a player from depositing from their bank. To do this set the index for the player number and set the variable to false. example index 1 is for player 1 red --------


Set depositLumberBoolPlayer[1] = True


-------- --------


-------- --------


-------- This function allows you to display to a player their lumber in the bank. I have the check chat message for the player to use but if you want to display it for a specific player at any given time use this. --------


-------- function CheckLumberBankSinglePlayer takes player pl returns nothing --------


-------- To use this function you use custom script: and do this. --------


-------- call CheckLumberBankSinglePlayer( udg_tempPlayer) --------


-------- As you can see i put tempPlayer variable in there. just put the player you want to show this to into the tempPlayer variable. --------


-------- --------


-------- --------


-------- This function allows you to display every players bank lumber with a simple value. --------


-------- function DisplayLumberBankStatusAll takes nothing returns nothing --------


-------- To use this function you use custom script: and do this. --------


-------- call DisplayLumberBankStatusAll() --------


-------- It will then display to each player their own bank value. --------


-------- --------


-------- --------


-------- This function allows you to increase a certain players bank value based on a percent value. --------


-------- function LumberBankInterestIncSinglePlayer takes player pl, real r returns nothing --------


-------- To use this function you use custom script: and do this. --------


-------- call LumberBankInterestIncSinglePlayer( udg_tempPlayer, udg_tempReal) --------


-------- it will then increase a single players bank value based on the real value you put in. this is based on a percentage value so 20% is .20 --------


-------- --------


-------- --------


-------- This function allows you to increase all players bank value based on a percent value. --------


-------- function LumberBankInterestIncAll takes real r returns nothing --------


-------- To use this function you use custom script: and do this. --------


-------- call LumberBankInterestIncAll( udg_tempReal) --------


-------- it will then increase all players bank value based on the real value you put in. this is based on a percentage value so 20% is .20 --------


-------- --------


-------- --------


-------- --------


-------- This function allows you to store a certain amount of lumber from the player. --------


-------- function LumberBankForcedBanking takes player P, integer amount returns nothing --------


-------- To use this function you use custom script: and do this. --------


-------- call LumberBankForcedBanking( player, amount) --------


-------- It will automatically remove the lumber from the player and store it in there bank. There is not a check to see if that player has the amount of lumber that is being added so be careful using this. --------


-------- --------


-------- --------


-------- --------


-------- Delete everything after this point after posting into your map --------


Set checkLumberBankSystemInt = 0


Set depositLumberAllBankSystemInt = 0


Set depositLumberBankSystemInt = 0


Set withdrawLumberAllBankSystemInt = 0


Set withdrawLumberBankSystemInt = 0


Set lumberBankLumber[1] = 0
// Lumber Banking System version 1.0.0.6
// by deathismyfriend
function LumberBankForcedBuying takes player P, integer amount returns boolean
local integer p = GetPlayerId( P)
local integer i
if udg_lumberBankLumber[ p] >= amount then
set udg_lumberBankLumber[ p] = udg_lumberBankLumber[ p] - amount
return true
elseif udg_lumberBankLumber[ p] + GetPlayerState( P, PLAYER_STATE_RESOURCE_LUMBER) >= amount then
set i = amount - udg_lumberBankLumber[ p]
set udg_lumberBankLumber[ p] = 0
call SetPlayerState( P, PLAYER_STATE_RESOURCE_LUMBER, GetPlayerState( P, PLAYER_STATE_RESOURCE_LUMBER) - i)
return true
endif
return false
endfunction
function LumberBankForcedBanking takes player P, integer amount returns nothing
local integer p = GetPlayerId( P)
call SetPlayerState( P, PLAYER_STATE_RESOURCE_LUMBER, GetPlayerState( P, PLAYER_STATE_RESOURCE_LUMBER) - amount)
set udg_lumberBankLumber[ p] = udg_lumberBankLumber[ p] + amount
endfunction
function CheckLumberBankSinglePlayer takes player pl returns nothing
local integer p = GetPlayerId( pl)
call DisplayTextToPlayer( Player( p), 0 , 0, "You have " + I2S( udg_lumberBankLumber[ p]) + " lumber in your bank")
endfunction
function DisplayLumberBankStatusAll takes nothing returns nothing
local integer L = 0
loop
exitwhen L > 11
call CheckLumberBankSinglePlayer( Player( L))
set L = L + 1
endloop
endfunction
function LumberBankInterestIncSinglePlayer takes player pl, real r returns nothing
local integer p = GetPlayerId( pl)
set r = r + 1.00
set udg_lumberBankLumber[ p] = R2I( udg_lumberBankLumber[ p] * r)
endfunction
function LumberBankInterestIncAll takes real r returns nothing
local integer L = 0
loop
exitwhen L > 11
call LumberBankInterestIncSinglePlayer( Player( L), r)
set L = L + 1
endloop
endfunction
function LumberBankingSystemWithdraw takes nothing returns boolean
local string entered = GetEventPlayerChatString()
local string sub1 = SubString( entered, 0, udg_withdrawLumberBankSystemInt)
local string sub2 = SubString( entered, 0, udg_withdrawLumberAllBankSystemInt)
local integer p = GetPlayerId( GetTriggerPlayer())
local integer lumber
local playerstate psrl = PLAYER_STATE_RESOURCE_LUMBER
local player pl = Player( p)
if udg_withdrawLumberBoolPlayer[ p + 1] then
if sub1 == udg_withdrawLumberString then
set lumber = S2I( SubString( entered, udg_depositLumberBankSystemInt, StringLength( entered)))
if udg_lumberBankLumber[ p] > lumber then
call SetPlayerState( pl, psrl, GetPlayerState( pl, psrl) + lumber)
set udg_lumberBankLumber[ p] = udg_lumberBankLumber[ p] - lumber
else
set lumber = udg_lumberBankLumber[ p]
call SetPlayerState( pl, psrl, GetPlayerState( pl, psrl) + lumber)
set udg_lumberBankLumber[ p] = 0
endif
elseif sub2 == udg_withdrawAllLumberString then
call SetPlayerState( pl, psrl, GetPlayerState( pl, psrl) + udg_lumberBankLumber[ p])
set udg_lumberBankLumber[ p] = 0
endif
endif
call CheckLumberBankSinglePlayer( pl)
set pl = null
set psrl = null
return false
endfunction
function LumberBankingSystemDeposit takes nothing returns boolean
local string entered = GetEventPlayerChatString()
local string sub1 = SubString( entered, 0, udg_depositLumberBankSystemInt)
local string sub2 = SubString( entered, 0, udg_depositLumberAllBankSystemInt)
local integer p = GetPlayerId( GetTriggerPlayer())
local integer lumber
local playerstate psrl = PLAYER_STATE_RESOURCE_LUMBER
local integer i
local player pl = Player( p)
if udg_depositLumberBoolPlayer[ p + 1] then
if sub1 == udg_depositLumberString then
set lumber = S2I( SubString( entered, udg_depositLumberBankSystemInt, StringLength( entered)))
set i = GetPlayerState( pl, psrl)
if lumber > i then
call SetPlayerState( pl, psrl, 0)
set udg_lumberBankLumber[ p] = udg_lumberBankLumber[ p] + i
else
call SetPlayerState( pl, psrl, i - lumber)
set udg_lumberBankLumber[ p] = udg_lumberBankLumber[ p] + lumber
endif
elseif sub2 == udg_depositAllLumberString then
set i = GetPlayerState( pl, psrl)
call SetPlayerState( pl, psrl, 0)
set udg_lumberBankLumber[ p] = udg_lumberBankLumber[ p] + i
endif
endif
call CheckLumberBankSinglePlayer( pl)
set pl = null
set psrl = null
return false
endfunction
function LumberBankingSystemCheck takes nothing returns boolean
if SubString( GetEventPlayerChatString(), 0, udg_checkLumberBankSystemInt) == udg_checkBankLumberString then
call CheckLumberBankSinglePlayer( GetTriggerPlayer())
endif
return false
endfunction
function LumberBankingSystemSetup takes nothing returns nothing
local trigger t1 = CreateTrigger()
local trigger t2 = CreateTrigger()
local trigger t3 = CreateTrigger()
local integer L = 0
local player P
loop
exitwhen L > 11
set P = Player( L)
// Check if the player is playing and if that player is a user so this will only register the actual players.
if GetPlayerSlotState( P) == PLAYER_SLOT_STATE_PLAYING and GetPlayerController( P) == MAP_CONTROL_USER then
call TriggerRegisterPlayerChatEvent( t1, P, udg_withdrawLumberString, false)
call TriggerRegisterPlayerChatEvent( t1, P, udg_withdrawAllLumberString, false)
call TriggerRegisterPlayerChatEvent( t2, P, udg_depositLumberString, false)
call TriggerRegisterPlayerChatEvent( t2, P, udg_depositAllLumberString, false)
call TriggerRegisterPlayerChatEvent( t3, P, udg_checkBankLumberString, false)
endif
set L = L + 1
endloop
set udg_withdrawLumberBankSystemInt = StringLength( udg_withdrawLumberString)
set udg_withdrawLumberAllBankSystemInt = StringLength( udg_withdrawAllLumberString)
set udg_depositLumberBankSystemInt = StringLength( udg_depositLumberString)
set udg_depositLumberAllBankSystemInt = StringLength( udg_depositAllLumberString)
set udg_checkLumberBankSystemInt = StringLength( udg_checkBankLumberString)
call TriggerAddCondition( t1, Condition( function LumberBankingSystemWithdraw))
call TriggerAddCondition( t2, Condition( function LumberBankingSystemDeposit))
call TriggerAddCondition( t3, Condition( function LumberBankingSystemCheck))
call DestroyTimer( GetExpiredTimer())
set P = null
set t1 = null
set t2 = null
set t3 = null
endfunction
//===========================================================================
function InitTrig_LumberBankingSystemCode takes nothing returns nothing
call TimerStart( CreateTimer(), 0.00, false, function LumberBankingSystemSetup)
endfunction