PLayFF-ForumPlugin
Bienvenu sur le Forum Vous aller decouvivre des Mode tuto plugin plein de hose se forum et en cours merci de vous inscrire ^^

Plugin shop Base builder

Voir le sujet précédent Voir le sujet suivant Aller en bas

Plugin shop Base builder

Message  -(GoOD|STrIKeR)- Haribo le Mer 21 Sep - 8:08

Description:
Se plugin permet d'avoir un shop pour le mode base builder

CT:
Supercut(4500)
sniper auto (6000)
200Hp(6000)
machine gun (3000)
graviter(12000)

Terro:
supercut(5000)
vitesse(6000)
graviter(12000)



Code:

Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <fun>
#include <cstrike>
#include <engine>

#define IsPlayer(%1) ( 1 <= %1 <= g_iMaxPlayers )
#define Ham_Player_ResetMaxSpeed Ham_Item_PreFrame

new bool:g_HasSuperKnife[33], bool:g_HasSpeed[33]

new m249_ct, superknife_ct, gravity_ct, gravity_cost_ct, g3sg1_ct, hp_ct, hpcost_ct
new vitesse_t, vitesse_cost_t, gravity_t, gravity_cost_t, superknife_t, knife_multiplier, g_iMaxPlayers

public plugin_init()
{
// Plugin Info
register_plugin("Shop Base Builder", "1.0", "xxxx")

// HAMSANDWICH
RegisterHam(Ham_TakeDamage, "player", "ham_TakeDamage_Pre")
RegisterHam(Ham_Spawn, "player", "ham_PlayerSpawn_Post", 1)
RegisterHam(Ham_Player_ResetMaxSpeed, "player", "Player_ResetMaxSpeed", 1)

register_event("CurWeapon","checkWeapon","be","1=1")

// GetMaxPlayers
g_iMaxPlayers = get_maxplayers()

// Commandes
register_clcmd("say /shop", "shopmenu")
register_clcmd("say shop", "shopmenu")
register_concmd("shop", "shopmenu")

// Prix de chaque Item Menu CT
superknife_ct = register_cvar("shop_superknife_ct", "4500")
gravity_ct = register_cvar("shop_gravity_ct", "0.325")
g3sg1_ct = register_cvar("shop_g3sg1_ct", "6000")
gravity_cost_ct = register_cvar("shop_cost_gravity_ct", "12000")
hpcost_ct = register_cvar("shop_hpcost_ct", "6000")
hp_ct = register_cvar("shop_hp_ct", "200")
m249_ct = register_cvar("shop_m249_ct", "3000")

// Prix de chaque Item Menu T
vitesse_t = register_cvar("shop_maxspeed_t", "450")
vitesse_cost_t = register_cvar("shop_cost_maxspeed_t", "6000")
gravity_cost_t = register_cvar("shop_cost_gravity_t", "12000")
gravity_t = register_cvar("shop_gravity_t", "0.325")
superknife_t = register_cvar("shop_superknife_t", "5000")
knife_multiplier = register_cvar("shop_knife_damage", "154")
}

public plugin_precache()
{
precache_model("models/furien_superknife.mdl")
}

public client_putinserver(id)
{
g_HasSuperKnife[id] = false
g_HasSpeed[id] = false
}

public shopmenu(id)
{
new menu
new menuText[32]

if ( cs_get_user_team(id) == CS_TEAM_CT )
{
menu = menu_create("Shop Menu [CT]", "menu_ct")
formatex( menuText, charsmax(menuText), "/wGravity - [/r%d $/w]", get_pcvar_num(gravity_cost_ct) )
menu_additem(menu, menuText, "1")
formatex( menuText, charsmax(menuText), "/wG3SG1 - [/r%d $/w]", get_pcvar_num(g3sg1_ct) )
menu_additem(menu, menuText, "2")
formatex( menuText, charsmax(menuText), "/wMitrailleuse - [/r%d $/w]", get_pcvar_num(m249_ct) )
menu_additem(menu, menuText, "3")
formatex( menuText, charsmax(menuText), "/wSuper Cut - [/r%d $/w]", get_pcvar_num(superknife_ct) )
menu_additem(menu, menuText, "4")
formatex( menuText, charsmax(menuText), "/w+%d HP - [/r%d $/w]", get_pcvar_num(hp_ct), get_pcvar_num(hpcost_ct) )
menu_additem(menu, menuText, "5")
menu_setprop(menu, MPROP_EXITNAME, "Sortir")
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
menu_display(id, menu)
}
else
{
menu = menu_create("Shop Menu [T]:", "menu_terro")
formatex( menuText, charsmax(menuText), "/wVitesse - [/r%d $/w]", get_pcvar_num(vitesse_cost_t) )
menu_additem(menu, menuText, "1")
formatex( menuText, charsmax(menuText), "/wGravity - [/r%d $/w]", get_pcvar_num(gravity_cost_t) )
menu_additem(menu, menuText, "2")
formatex( menuText, charsmax(menuText), "/wSuper Cut - [/r%d $/w]", get_pcvar_num(superknife_t) )
menu_additem(menu, menuText, "3")
menu_setprop(menu, MPROP_EXITNAME, "Sortir")
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
menu_display(id, menu)
}
}

public menu_ct(id, menu, item)
{
if (item == MENU_EXIT) return PLUGIN_HANDLED

// Obtenir l'info de l'item
new info[3]
new access, callback
menu_item_getinfo(menu, item, access, info, 2, _, _, callback)

new key = str_to_num(info)

switch(key)
{
case 1:
{
if ( cs_get_user_team(id) == CS_TEAM_T )
{
print_color(id, id, 0, "^x04[Shop]^x01 Tu ne peux pas acheter un item des ct quand tu es terro !")
return PLUGIN_HANDLED
}
if ( !is_user_alive(id) )
{
print_color(id, id, 0, "^x04[Shop]^x01 Tu ne peux rien acheter quand tu es ^x03mort ^x01!")
return PLUGIN_HANDLED
}
new user_money = cs_get_user_money(id)
new gravity_count = get_pcvar_num(gravity_cost_ct)
if ( user_money < gravity_count )
{
print_color(id, id, 0, "^x04[Shop]^x01 Tu n'as ^x03pas assez d'argent ^x01pour acheter cet item !")
return PLUGIN_HANDLED
}
else
{
cs_set_user_money(id, user_money - gravity_count)
set_user_gravity(id, get_pcvar_float(gravity_ct))
print_color(id, id, 0, "^x04[Shop]^x01 Tu viens d'acheter de la^x03 Gravity^x01 !")
}
}
case 2:
{
if ( cs_get_user_team(id) == CS_TEAM_T )
{
print_color(id, id, 0, "^x04[Shop]^x01 Tu ne peux pas acheter un item des ct quand tu es terro !")
return PLUGIN_HANDLED
}
if ( !is_user_alive(id) )
{
print_color(id, id, 0, "^x04[Shop]^x01 Tu ne peux rien acheter quand tu es ^x03mort ^x01!")
return PLUGIN_HANDLED
}
if ( user_has_weapon(id, CSW_G3SG1) )
{
print_color(id, id, 0, "^x04[Shop]^x01 Tu as déjà cet item !")
return PLUGIN_HANDLED
}
new user_money = cs_get_user_money(id)
new g3sg1_count = get_pcvar_num(g3sg1_ct)
if ( user_money < g3sg1_count )
{
print_color(id, id, 0, "^x04[Shop]^x01 Tu n'as ^x03pas assez d'argent ^x01pour acheter cet item !")
return PLUGIN_HANDLED
}
else
{
cs_set_user_money(id, user_money - g3sg1_count)
strip_user_weapons(id)
give_item(id, "weapon_g3sg1")
cs_set_user_bpammo(id, CSW_G3SG1, 90)
give_item(id, "weapon_deagle")
cs_set_user_bpammo(id, CSW_DEAGLE, 50)
print_color(id, id, 0, "^x04[Shop]^x01 Tu viens d'acheter un^x03 G3SG1 ^x01 !")
}
}
case 3:
{
if ( cs_get_user_team(id) == CS_TEAM_T )
{
print_color(id, id, 0, "^x04[Shop]^x01 Tu ne peux pas acheter un item des ct quand tu es terro !")
return PLUGIN_HANDLED
}
if ( !is_user_alive(id) )
{
print_color(id, id, 0, "^x04[Shop]^x01 Tu ne peux rien acheter quand tu es ^x03mort ^x01!")
return PLUGIN_HANDLED
}
if ( user_has_weapon(id, CSW_M249) )
{
print_color(id, id, 0, "^x04[Shop]^x01 Tu as déjà cet item !")
return PLUGIN_HANDLED
}
new user_money = cs_get_user_money(id)
new m249_count = get_pcvar_num(m249_ct)
if ( user_money < m249_count )
{
print_color(id, id, 0, "^x04[Shop]^x01 Tu n'as ^x03pas assez d'argent ^x01pour acheter cet item !")
return PLUGIN_HANDLED
}
else
{
cs_set_user_money(id, user_money - m249_count)
strip_user_weapons(id)
give_item(id, "weapon_m249")
cs_set_user_bpammo(id, CSW_M249, 250)
give_item(id, "weapon_deagle")
cs_set_user_bpammo(id, CSW_DEAGLE, 50)
print_color(id, id, 0, "^x04[Shop]^x01 Tu viens d'acheter une^x03 m249 ^x01 !")
}
}
case 4:
{
if ( cs_get_user_team(id) == CS_TEAM_T )
{
print_color(id, id, 0, "^x04[Shop]^x01 Tu ne peux pas acheter un item des terros quand tu es terro !")
return PLUGIN_HANDLED
}
if ( !is_user_alive(id) )
{
print_color(id, id, 0, "^x04[Shop]^x01 Tu ne peux rien acheter quand tu es ^x03mort ^x01!")
return PLUGIN_HANDLED
}
if ( g_HasSuperKnife[id] )
{
print_color(id, id, 0, "^x04[Shop]^x01 Tu as déjà cet item !")
return PLUGIN_HANDLED
}
new user_money = cs_get_user_money(id)
new superknife_count = get_pcvar_num(superknife_ct)
if ( user_money < superknife_count )
{
print_color(id, id, 0, "^x04[Shop]^x01 Tu n'as ^x03pas assez d'argent ^x01pour acheter cet item !")
return PLUGIN_HANDLED
}
else
{
cs_set_user_money(id, user_money - superknife_count)
g_HasSuperKnife[id] = true
print_color(id, id, 0, "^x04[Shop]^x01 Tu viens d'acheter un^x03 Super Couteau ^x01 !")
}
}
case 5:
{
if ( cs_get_user_team(id) == CS_TEAM_T )
{
print_color(id, id, 0, "^x04[Shop]^x01 Tu ne peux pas acheter un item des ct quand tu es terro !")
return PLUGIN_HANDLED
}
if ( !is_user_alive(id) )
{
print_color(id, id, 0, "^x04[Shop]^x01 Tu ne peux rien acheter quand tu es ^x03mort ^x01! ")
return PLUGIN_HANDLED
}
new user_money = cs_get_user_money(id)
new hp_count = get_pcvar_num(hpcost_ct)
if ( user_money < hp_count )
{
print_color(id, id, 0, "^x04[Shop]^x01 Tu n'as ^x03pas assez d'argent ^x01pour acheter cet item !")
return PLUGIN_HANDLED
}
else
{
cs_set_user_money(id, user_money - hp_count)
new hp_bonus = get_pcvar_num(hp_ct)
set_user_health(id, get_user_health(id) + hp_bonus)
print_color(id, id, 0, "^x04[Shop]^x01 Tu viens d'acheter^x03 %d HP^x01 !", hp_bonus)
}
}

}
return PLUGIN_CONTINUE;
}

public menu_terro(id, menu, item)
{
if (item == MENU_EXIT) return PLUGIN_HANDLED

// Obtenir l'info de l'item
new info[3]
new access, callback
menu_item_getinfo(menu, item, access, info, 2, _, _, callback)

new key = str_to_num(info)

switch (key)
{
case 1:
{
if ( cs_get_user_team(id) == CS_TEAM_CT )
{
print_color(id, id, 0, "^x04[Shop]^x01 Tu ne peux pas acheter un item des terros quand tu es ct !")
return PLUGIN_HANDLED
}
if ( !is_user_alive(id) )
{
print_color(id, id, 0, "^x04[Shop]^x01 Tu ne peux rien acheter quand tu es ^x03mort ^x01!")
return PLUGIN_HANDLED
}
new user_money = cs_get_user_money(id)
new vitesse_count = get_pcvar_num(vitesse_cost_t)
if ( user_money < vitesse_count )
{
print_color(id, id, 0, "^x04[Shop]^x01 Tu n'as ^x03pas assez d'argent ^x01pour acheter cet item !")
return PLUGIN_HANDLED
}
else
{
cs_set_user_money(id, user_money - vitesse_count)
g_HasSpeed[id] = true
set_user_maxspeed ( id , get_pcvar_float ( vitesse_t ) )
print_color(id, id, 0, "^x04[Shop]^x01 Tu viens d'acheter de la ^x03 Vitesse ^x01 !")
}
}
case 2:
{
if ( cs_get_user_team(id) == CS_TEAM_CT )
{
print_color(id, id, 0, "^x04[Shop]^x01 Tu ne peux pas acheter un item des ct quand tu es ct !")
return PLUGIN_HANDLED
}
if ( !is_user_alive(id) )
{
print_color(id, id, 0, "^x04[Shop]^x01 Tu ne peux rien acheter quand tu es ^x03mort ^x01!")
return PLUGIN_HANDLED
}
new user_money = cs_get_user_money(id)
new gravity_count = get_pcvar_num(gravity_cost_t)
if ( user_money < gravity_count )
{
print_color(id, id, 0, "^x04[Shop]^x01 Tu n'as ^x03pas assez d'argent ^x01pour acheter cet item !")
return PLUGIN_HANDLED
}
else
{
cs_set_user_money(id, user_money - gravity_count)
set_user_gravity(id, get_pcvar_float(gravity_t) )
print_color(id, id, 0, "^x04[Shop]^x01 Tu viens d'acheter de la^x03 Gravity^x01 !")
}
}
case 3:
{
if ( cs_get_user_team(id) == CS_TEAM_CT )
{
print_color(id, id, 0, "^x04[Shop]^x01 Tu ne peux pas acheter un item des terros quand tu es ct !")
return PLUGIN_HANDLED
}
if ( !is_user_alive(id) )
{
print_color(id, id, 0, "^x04[Shop]^x01 Tu ne peux rien acheter quand tu es ^x03mort ^x01!")
return PLUGIN_HANDLED
}
if ( g_HasSuperKnife[id])
{
print_color(id, id, 0, "^x04[Shop]^x01 Tu as déjà cet item !")
return PLUGIN_HANDLED
}
new user_money = cs_get_user_money(id)
new superknife_count = get_pcvar_num(superknife_t)
if ( user_money < superknife_count )
{
print_color(id, id, 0, "^x04[Shop]^x01 Tu n'as ^x03pas assez d'argent ^x01pour acheter cet item !")
return PLUGIN_HANDLED
}
else
{
cs_set_user_money(id, user_money - superknife_count)
g_HasSuperKnife[id] = true
print_color(id, id, 0, "^x04[Furiens Shop]^x01 Tu viens d'acheter un^x03 Super Couteau ^x01 !")
}
}
}
return PLUGIN_CONTINUE;
}

//Les degat augmenter du super knife
public ham_TakeDamage_Pre(victim, inflictor, attacker, Float:damage, damage_bits)
{
if ( IsPlayer(attacker) && g_HasSuperKnife[attacker] && inflictor == attacker && get_user_weapon(attacker) == CSW_KNIFE )
{
SetHamParamFloat( 4, damage * get_pcvar_float(knife_multiplier) )
}
}

public ham_PlayerSpawn_Post(id)
{
g_HasSuperKnife[id] = false
g_HasSpeed[id] = false
}

public Player_ResetMaxSpeed ( id )
{
if ( is_user_alive ( id ) && g_HasSpeed[id] && get_user_maxspeed ( id ) != 0.1 )
{
set_user_maxspeed ( id , get_pcvar_float ( vitesse_t ) )
}
}

// Model du superknife
public checkWeapon(id)
{
if(g_HasSuperKnife[id])
{
new Clip, Ammo, Weapon = get_user_weapon(id, Clip, Ammo)

if(Weapon == CSW_KNIFE)
{
entity_set_string(id, EV_SZ_viewmodel, "models/furien_superknife.mdl")
}
}
}

// Message colorés
public print_color(id, cid, color, const message[], any:...)
{
new msg[192]
vformat(msg, charsmax(msg), message, 5)
new param
if (!cid) return
else param = cid
new team[32]
get_user_team(param, team, 31)
switch (color)
{
case 0: msg_teaminfo(param, team)
case 1: msg_teaminfo(param, "TERRORIST")
case 2: msg_teaminfo(param, "CT")
case 3: msg_teaminfo(param, "SPECTATOR")
}
if (id) msg_saytext(id, param, msg)
else msg_saytext(0, param, msg)
if (color != 0) msg_teaminfo(param, team)
}

msg_saytext(id, cid, msg[])
{
message_begin(id ? MSG_ONE : MSG_ALL, get_user_msgid("SayText"), _, id)
write_byte(cid)
write_string(msg)
message_end()
}

msg_teaminfo(id, team[])
{
message_begin(MSG_ONE, get_user_msgid("TeamInfo"), _, id)
write_byte(id)
write_string(team)
message_end()
}

-(GoOD|STrIKeR)- Haribo
Admin

Messages: 68
Date d'inscription: 18/09/2011

Voir le profil de l'utilisateur http://tutoriel-pluging-mod.1forumgratuit.com

Revenir en haut Aller en bas

Voir le sujet précédent Voir le sujet suivant Revenir en haut


Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum