Wszystko jest fajnie tylko jak ktoś już sobie takie m4 kupi i przez przypadek naciśnie przycisk z bindem jeszcze raz
to odejmie mu pieniądze za m4 a drugiej emki mu przecież nie da.. da się to jakoś zabezpieczyć? oto kod:
// Description: This plugin is mainly for terrorists to be able to buy an m4. Cts can buy one as
// well but its the same price as an m4 on the buy menu.
// Commands: say /m4 or /m4ammo
// Cvars: "m4_price" "ak_price"
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#define PLUGIN "Buy_m4"
#define VERSION "1.1"
#define AUTHOR "{PHILMAGROIN}"
new m4_cost, m4_ammo;
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("say /m4", "buym4")
register_clcmd("say /ak", "buyak")
m4_cost = register_cvar("m4_price", "3100")
m4_ammo = register_cvar("m4_aprice", "2500")
}
public buym4(id)
{
if(!is_user_alive(id))
return PLUGIN_HANDLED
new money = cs_get_user_money(id);
new cost = get_pcvar_num(m4_cost)
if(money < cost)
{
client_print(id, print_chat,"[INFO] Masz za malo kasy na M4")
}
else {
cs_set_user_money(id, money - cost);
give_item(id,"weapon_m4a1");
}
return PLUGIN_HANDLED
}
public buyak(id)
{
if(!is_user_alive(id))
return PLUGIN_HANDLED
new money = cs_get_user_money(id);
new cost = get_pcvar_num(m4_ammo)
if(money < cost)
{
client_print(id, print_chat,"[INFO] Masz za malo kasy na AK47")
}
else {
cs_set_user_money(id, money - cost);
give_item(id, "weapon_ak47");
}
return PLUGIN_HANDLED
}


Dodatki SourceMod



Temat jest zamknięty


Plugin.amxx








