Okej first of all this tutorial will be for the new coders out there who wants to know how to add some new blocks to their bms.
Okej, we start with adding cashblock to BCM.
the first part is creating the native as will add cashmod into your blockmaker this code is for that
PHP Code:
native cm_get_user_cash
native cm_set_user_cash
The second part is creating the data holder for the xp or cashmod, it can be used to everything like hns shop to
PHP Code:
new bool:g_cash_used[33];
thats the data holder as going to make this code work!
now look at the new const g_models codes there you want to add
PHP Code:
new const g_model_cash[] = "models/Yourmapp/Normal/cash.mdl";
okej now search for
PHP Code:
enum
{
PLATFORM,
BHOP,
DAMAGE,
HEALER,
NO_FALL_DAMAGE,
ICE,
TRAMPOLINE,
SPEED_BOOST,
DEATH,
LOW_GRAVITY,
SLAP,
HONEY,
CT_BARRIER,
T_BARRIER,
GLASS,
NO_SLOW_DOWN_BHOP,
DELAYED_BHOP,
INVINCIBILITY,
STEALTH,
BOOTS_OF_SPEED,
TOTAL_BLOCKS
};
here do you want to add CASH, cuz that will make your g_model work
now search for
Code:
new const g_block_names
and there you will need to add an , on the block as is over the block you will make now and then you need to add Cashblock
now search for
and as i told you before need you to make an , and then press enter and then write "Cash To Give"
next search for
Code:
g_property1_default_value
now you need to do the same thing with , but under it just write "50"
now search for
and as before make an , and then under do you just need to write ""
now search for
Code:
g_property2_default_value
here as normally do the same thing make an , and then under write ""
now search for
as usual make an , on the last "Transparency" and then under write
"Transparency"
now search for
Code:
g_property3_default_value
here you just going to make an , as usual and then write "255" under the last
now search for
here you just going to make an , as usual and then write "On Top Only" under the last
now search for
Code:
g_property4_default_value
as normally just make an , and then under the last one write "1"
now search for
this is the function as adds your blocks to the blockmaker menu
as normally under the last character just add 'V' or 'U' or which letter as comes after
now search for
Code:
public plugin_precache()
here are you going to add a new block as you did before this is the code for that
PHP Code:
g_block_models[CASH] = g_model_cash;
okej now search for
and there you find some cases there you will add a new case that will be called case CASH: ActionCash(id, ent);
or whatever you want it to be called you just need to write Action and then whatever block you want to add. This is the action who will be registered when we have made the action
so now you search for
Code:
public client_PreThink(id)
and press enter its here you going to register your action and your data holder this is the code for the cashblock action and here will your native be registered to
PHP Code:
ActionCash(id, ent)
{
if ( cs_get_user_team(id) == CS_TEAM_T )
{
if ( !g_cash_used[id] )
{
emit_sound(id, CHAN_STATIC, g_sound_money, 1.0, ATTN_NORM, 0, PITCH_NORM);
new property[5];
GetProperty(ent, 1, property);
cm_set_user_cash(id, cm_get_user_cash(id) + str_to_num(property));
g_cash_used[id] = true;
set_hudmessage(0, 255, 0, 0.01, 0.18, 0, 0.0, 1.0, 0.25, 0.25, 2);
show_hudmessage(id, "You got %i more Cash!", str_to_num(property));
}
}
else
{
set_hudmessage(0, 255, 0, 0.01, 0.18, 0, 0.0, 1.0, 0.25, 0.25, 2);
show_hudmessage(id, "Only Terrorists can take Cash Block!");
}
}
okej now you search for LoadBlocks(id)
and now scroll down untill you find
PHP Code:
case 'A': block_type = PLATFORM;
case 'B': block_type = BUNNYHOP;
case 'C': block_type = DAMAGE;
case 'D': block_type = HEALER;
case 'E': block_type = NO_FALL_DAMAGE;
case 'F': block_type = ICE;
case 'G': block_type = TRAMPOLINE;
case 'H': block_type = SPEED_BOOST;
case 'I': block_type = DEATH;
case 'J': block_type = LOW_GRAVITY;
case 'K': block_type = SLAP;
case 'L': block_type = HONEY;
case 'M': block_type = CT_BARRIER;
case 'N': block_type = T_BARRIER;
case 'O': block_type = GLASS;
case 'P': block_type = NO_SLOW_DOWN_BUNNYHOP;
case 'Q': block_type = DELAYED_BUNNYHOP;
case 'R': block_type = INVINCIBILITY;
case 'S': block_type = STEALTH;
case 'T': block_type = BOOTS_OF_SPEED;
case '*':
and here you see case '*': that one do you want to change to case 'U': block_type = CASH; and then you press enter and write case '*': again
and now you search for ResetPlayer(id)
and scroll down untill you find
PHP Code:
g_next_damage_time[id] = 0.0;
g_next_heal_time[id] = 0.0;
g_invincibility_time_out[id] = 0.0;
g_invincibility_next_use[id] = 0.0;
g_stealth_time_out[id] = 0.0;
g_stealth_next_use[id] = 0.0;
g_boots_of_speed_time_out[id] = 0.0;
g_boots_of_speed_next_use[id] = 0.0;
and after g_boots_of_speed_next_use[id] = 0.0; do you want to press enter and then write
PHP Code:
g_cash_used[id] = false;
now is it only to download cashmod v0.0.7 and then add it to your plugins.ini
okej you guys that was all for this tutorial hope you enjoy it.
Sorry for my bad english
__________________