#include <amxmodx>
    #include <amxmisc>
    #include <hamsandwich>
    #include <nvault>
    #include <colorchat>
    #include <fun>
    #include <cstrike>
    #include <fakemeta>
    #include <engine>
    #include <dhudmessage>
 
    #define PLUGIN "New Plug-In"
    #define VERSION "1.0"
    #define AUTHOR "author"
 
    /// ez a gyorsaság és gravitáció
    #define SPEED 700.0
    #define GRAVIT 0.3
    #define HP5 5000
    #define HP2 2000
    #define HP1 1000
 
    ////KEZDŐ///BÓNUSZ////
 
    #define KEZDOPONT 	5
    #define KEZDOPONT_VIP 10
    #define OLESPONT 	3
    #define OLESPONT_VIP 5
 
    #define BONUSZ1 	5
    #define BONUSZ2 10
    #define BONUSZ3 15
 
    #define VIPJOG ADMIN_RESERVATION
 
    #define SZINT_2 50
    #define SZINT_2_BONUSZ 10
 
    #define BONUSZIDO1 600.0
    #define BONUSZIDO2 1200.0
    #define BONUSZIDO3 1500.0
 
    new const G_AK47V[]= "models/aranygoldfegyok/v_goldenak47.mdl" //Arany modell elérési útja.
    new const G_AK47P[]= "models/aranygoldfegyok/p_goldenak47.mdl" //Arany modell elérési útja.
    new const G_M4A1V[]= "models/aranygoldfegyok/v_goldenm4a1.mdl" //Arany modell elérési útja.
    new const G_M4A1P[]= "models/aranygoldfegyok/p_goldenm4a1.mdl" //Arany modell elérési útja.
    new const G_DEAGLEV[]= "models/aranygoldfegyok/v_goldendd.mdl" //Arany modell elérési útja.
    new const G_DEAGLEP[]= "models/aranygoldfegyok/p_goldendd.mdl" //Arany modell elérési útja.
    new g_vault
    new pont[33]
    new bool:rec[33]
    new bool:strong[33]
    new bool:g_ak[33]=false
    new bool:g_m4a1[33]=false
    new bool:g_deagle[33]=false
    new r
    new g 
    new b
 
 
    public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
    RegisterHam(Ham_Spawn, "player", "hamplayer_spawn", 0)
    RegisterHam(Ham_Killed, "player", "fw_player_killed")
    register_clcmd("say /bolt", "shopmenu")
    register_clcmd("say /pontok", "kiir_pont")
    register_clcmd("say /pont", "kiir_pont")
    register_clcmd("say /shop", "shopmenu")
    register_forward(FM_UpdateClientData, "fwUpdateClientData", 1)
    RegisterHam(Ham_TakeDamage, "player", "Erossebzes", 0)
    register_event("CurWeapon", "Event_Change_Weapon", "be", "1=1")
 
    register_dictionary("pontrendszer.txt")
 
 
    }
 
    public fwUpdateClientData(id, sw, cd_handle)
    {
    if(rec[id])
    set_cd(cd_handle, CD_PunchAngle, {0.0,0.0,0.0});
    }
    public Erossebzes( aldozat,inflictor,tamado,Float:damage, DamageBits )
    {
    if(strong[tamado])
    {
    SetHamParamFloat(4, damage * 3.0);
    }
    return HAM_IGNORED;
    }
 
    public shopmenu(id)
    {
    if (!is_user_alive(id))
    return
 
    static CsTeams: team ; team = cs_get_user_team(id)
 
    if (team == CS_TEAM_T)
    {
    Tmenubolt(id)
 
    }
    else if (team == CS_TEAM_CT)
    {
    CTmenubolt(id)
    }
    }
    public client_connect(id){
    Betolt(id)
    set_task(1.0, "Informaciok", id);
    }
 
    public client_disconnect(id){
    Mentes(id)
    }
 
    public Mentes(id){
    new name[32]
    get_user_name(id, name, 31)
 
    new vaultkey[64],vaultdata[256]
    format(vaultkey,63,"%sPT", name)
    format(vaultdata,255,"%i",pont[id])
    nvault_set(g_vault,vaultkey,vaultdata)
    return PLUGIN_CONTINUE
    }
 
    public Betolt(id){
    new name[32]
    get_user_name(id, name, 31)
    new vaultkey[64],vaultdata[256]
    format(vaultkey,63,"%sPT", name)
    format(vaultdata,255,"%i",pont[id])
    nvault_get(g_vault,vaultkey,vaultdata,255)
    replace_all(vaultdata, 255, "#", " ")
    new pt[32]
    parse(vaultdata, pt, 31)
    pont[id] = str_to_num(pt)
    return PLUGIN_CONTINUE
    }
 
    public Tmenubolt(id)
    {
    new menu= menu_create("Bazis Epito Shop [ T ]", "tmenu_hand")
    menu_additem(menu, "5000HP (pluszba)")
    menu_additem(menu, "2000HP (pluszba)")
    menu_additem(menu, "1000HP (pluszba)")
    menu_additem(menu, "Gyorsasag")
    menu_additem(menu, "Gravitacio")
    menu_additem(menu, "16000$ bevaltas (pontra)")
 
    menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
    menu_display(id, menu, 0)
    return PLUGIN_HANDLED
 
    }
 
    public CTmenubolt(id)
    {
    new menu= menu_create("Bazis Epito Shop [ CT ] ", "ctmenu_hand")
    menu_additem(menu, "Arany Ak47")
    menu_additem(menu, "Arany M4A1")
    menu_additem(menu, "Arany Desert")
    menu_additem(menu, "500HP (pluszba)")
    menu_additem(menu, "No recoil")
    menu_additem(menu, "Eros sebzes (3x)(1kor)")
    menu_additem(menu, "16000$ bevaltas (pontra)")
    menu_additem(menu, "Gyorsasag")
    menu_additem(menu, "Gravitacio")
 
    menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
    menu_display(id, menu, 0)
    return PLUGIN_HANDLED
    }
 
    public tmenu_hand(id, menu, item, live)
    {
    switch(item)
    {
    case 0:{
    if(pont[id]>=10 && live){
    pont[id]-=10
    set_user_health(id, get_user_health(id) + HP5)
    ColorChat(id, GREEN, "[BiG woRld BB] Hozza lett adva eletedhez 5000HP!")
    }
    else
    {
    ColorChat(id, GREEN, "[BiG woRld BB] Nincs eleg pontod Sajnos!")
    }
    }
    case 1:{
    if (pont[id]>=10 && live){
    pont[id]-=10
    set_user_health(id, get_user_health(id) + HP2)
    ColorChat(id, GREEN, "[BiG woRld BB] Hozza lett adva eletedhez 2000HP!")
    }
    else
    {
    ColorChat(id, GREEN, "[BiG woRld BB] Nincs eleg pontod Sajnos!")
    }
    }
    case 2:{
    if (pont[id]>=10 && live){
    pont[id]-=10
    set_user_health(id,get_user_health(id)+HP1)
    ColorChat(id, GREEN, "[BiG woRld BB] Hozza lett adva eletedhez 1000HP!")
    }
    else
    {
    ColorChat(id, GREEN, "[BiG woRld BB] Nincs eleg pontod Sajnos!")
    }
    }
    case 3:{
    if (pont[id]>=10 && live){
    pont[id]-=10
    set_user_maxspeed(id, SPEED)
    ColorChat(id, GREEN, "[BiG woRld BB] Gyorsasagad megvaltoztatva!")
    }
    else
    {
    ColorChat(id, GREEN, "[BiG woRld BB] Nincs eleg pontod Sajnos!")
    }
    }
    case 4:{
    if (pont[id]>=10 && live){
    pont[id]-=10	
    set_user_gravity(id, GRAVIT)
    ColorChat(id, GREEN, "[BiG woRld BB] Gravitaciod kisebb lett!")
    }
    else
    {
    ColorChat(id, GREEN, "[BiG woRld BB] Nincs eleg pontod Sajnos!")
    }
    }
    case 5:{
    if (cs_get_user_money(id)>= 16000 && live){
    cs_set_user_money(id, cs_get_user_money(id) -16000)
    pont[id]+=20
    ColorChat(id, GREEN, "[BiG woRld BB] Sikeresen bevaltotad penzed pontra")
    }
    else
    {
    ColorChat(id, GREEN, "[BiG woRld BB] Nincs eleg pontod Sajnos!")
    }
    }
    }
    menu_destroy(menu)
    return PLUGIN_HANDLED
    }
    public ctmenu_hand(id, menu, item, live)
    {
    switch(item){
 
 
    case 0:{
    if(pont[id]>=10 && live) {
    pont[id]-=10
    g_ak[id]=true
    ColorChat(id, GREEN, "[BiG woRld BB] Megkaptad az Arany AK47!")
    give_item(id, "ak47")
    cs_set_user_bpammo(id, CSW_AK47,90)
    }
    else
    {
    ColorChat(id, GREEN, "[BiG woRld BB] Nincs eleg pontod!")
    }
    }
    case 1:{
    if(pont[id]>=10 && live){
    pont[id]-=10
    g_m4a1[id]=true
    ColorChat(id, GREEN, "[BiG woRld BB] Megkaptad az Arany M4A1-t!")
    give_item(id, "m4a1")
    cs_set_user_bpammo(id, CSW_M4A1,90)
    }
    else
    {
    ColorChat(id, GREEN, "[BiG woRld BB] Nincs eleg pontod!")
    }
    }
    case 2:{
    if(pont[id]>=10 && live){
    pont[id]-=10
    g_deagle[id]=true
    ColorChat(id, GREEN, "[BiG woRld BB] Megkaptad az Arany Desert-t!")
    give_item(id, "deagle")
    cs_set_user_bpammo(id, CSW_DEAGLE,35)
    }
    else
    {
    ColorChat(id, GREEN, "[BiG woRld BB] Nincs eleg pontod!")
    }
    }
    case 3:{
    if(pont[id]>=10 && live){
    pont[id]-=10
    set_user_health(id,get_user_health(id)+ 500)
    ColorChat(id, GREEN, "[BiG woRld BB] Megkaptad az 500HP-t!")
    }
    else
    {
    ColorChat(id, GREEN, "[BiG woRld BB] Nincs eleg pontod!")
    }
    }
    case 4:{
    if(pont[id]>=10 && live){
    pont[id]-=10
    rec[id] = true
    ColorChat(id, GREEN, "[BiG woRld BB] Megkaptad a NoRECoilt-t!")
    }
    else
    {
    ColorChat(id, GREEN, "[BiG woRld BB] Nincs eleg pontod!")
    }
    }
    case 5:{
    if(pont[id]>=10 && live){
    pont[id]-=10
    strong[id] = true
    ColorChat(id, GREEN, "[BiG woRld BB] Megkaptad a 3x sebzest (1korre)")
    }
    else
    {
    ColorChat(id, GREEN, "[BiG woRld BB] Nincs eleg pontod!")
    }
    }
    case 6:{
    if (cs_get_user_money(id)>= 16000 && live){
    pont[id]+=20
    cs_set_user_money(id, cs_get_user_money(id) -16000)
    ColorChat(id, GREEN, "[BiG woRld BB] Sikerult bevaltani!")
    }
    else
    {
    ColorChat(id, GREEN, "[BiG woRld BB] Nincs eleg penzed , pont bevaltasra!")
    }
    }
    case 7:{
    if(pont[id]>=10 && live){
    pont[id]-=10
    set_user_maxspeed(id, SPEED)
    ColorChat(id, GREEN, "[BiG woRld BB] Sebeseged megvaltoztatva!")
    }
    else
    {
    ColorChat(id, GREEN, "[BiG woRld BB] Nincs eleg pontod!")
    }
    }
    case 8:{
    if(pont[id]>=10 && live){
    pont[id]-=10
    set_user_gravity(id , GRAVIT)
    ColorChat(id, GREEN, "[BiG woRld BB] Gravitaciod kisebb lett!")
    }
    else
    {
    ColorChat(id, GREEN, "[BiG woRld BB] Nincs eleg pontod Sajnos!")
    }
    }
    }
    menu_destroy(menu)
    return PLUGIN_HANDLED
    }
 
    public Event_Change_Weapon(id)
    {
    //Fegyver lekéréshez szükséges kódok
    new clip,ammo,weap=get_user_weapon(id,clip,ammo)
    if(weap==CSW_AK47 && g_ak[id]){ //Ha megvette az arany ak-t
    entity_set_string(id, EV_SZ_viewmodel,G_AK47V);//Megváltoztatjuk a modellt engine inc segítségével.
    entity_set_string(id, EV_SZ_viewmodel,G_AK47P)
    }
 
    //new clip,ammo,weap=get_user_weapon(id,clip,ammo)
    if(weap==CSW_M4A1 && g_m4a1[id]){ //Ha megvette az arany ak-t
    entity_set_string(id, EV_SZ_viewmodel,G_M4A1V);//Megváltoztatjuk a modellt engine inc segítségével.
    entity_set_string(id, EV_SZ_viewmodel,G_M4A1P)
    }
    //new clip,ammo,weap=get_user_weapon(id,clip,ammo)
    if(weap==CSW_DEAGLE && g_deagle[id]){ //Ha megvette az arany ak-t
    entity_set_string(id, EV_SZ_viewmodel,G_DEAGLEV);//Megváltoztatjuk a modellt engine inc segítségével.
    entity_set_string(id, EV_SZ_viewmodel,G_DEAGLEP)
    }
 
    return PLUGIN_CONTINUE
    }
 
    public client_putinserver( id )
    {
    pont[id]= KEZDOPONT
    set_task(5.0, "kiir_hud_pont", id)
    set_task(5.1, "kiir_chat_info", id)	
 
    //Ido bonusz
    set_task(BONUSZIDO1, "bonusz_1", id)
    set_task(BONUSZIDO2, "bonusz_2", id)
    set_task(BONUSZIDO3, "bonusz_3", id)
    }
    public bonusz_1( id )
    {
    pont[id] += BONUSZ1
    ColorChat(id, GREEN, "%L", LANG_PLAYER, "BONUSZ_1", BONUSZ1, BONUSZIDO1)
    }
    public bonusz_2( id )
    {
    pont[id] += BONUSZ2
    ColorChat(id, GREEN, "%L", LANG_PLAYER, "BONUSZ_2", BONUSZ2, BONUSZIDO1)
    }
    public bonusz_3( id )
    {
    pont[id] += BONUSZ3
    ColorChat(id, GREEN, "%L", LANG_PLAYER, "BONUSZ_3", BONUSZ3, BONUSZIDO1)
    }
    public fw_player_killed(aldozat, tamado, shouldgib, id)
{
	if(get_user_flags(id, VIPJOG))
	{
		pont[tamado] += OLESPONT_VIP
		ColorChat(tamado, GREEN, "%L", LANG_PLAYER, "OLES", OLESPONT_VIP)
 
		if(pont[id] >= SZINT_2)
		{	
			new name[33]
			get_user_name(id, name, 31)
			ColorChat(0, RED, "%L", LANG_PLAYER, "SZINTLEPES", name, SZINT_2_BONUSZ)
			pont[id] += SZINT_2_BONUSZ
		}	
	}else{
		pont[tamado] += OLESPONT
		ColorChat(tamado, GREEN, "%L", LANG_PLAYER, "OLES", OLESPONT)
	}
}
    public kiir_hud_pont( id )
    {
    new r = random_num(50, 256)
    new g = random_num(50, 256)
    new b = random_num(50, 256)
    set_dhudmessage(r, g, b, 0.7,-1.0, 0, 6.0, 12.0)
    show_dhudmessage(id, "%L", LANG_PLAYER, "PONTOK_HUD", pont[id])
    }
 
    public kiir_chat_info( id )
    {
    ColorChat(id, GREEN, "%L", LANG_PLAYER, "INFO_CHAT_1")
    ColorChat(id, GREEN, "%L", LANG_PLAYER, "INFO_CHAT_2")
    }
 
    public kiir_pont( id )
    {
    ColorChat(id, GREEN, "%L", LANG_PLAYER, "PONTOK_CHAT", pont[id])
    }
    public Informaciok(id){
    set_task(0.1, "Informaciok", id);
    if(!is_user_alive(id)){
    new target = entity_get_int(id, EV_INT_iuser2);
 
    if(target == 0)
 
    return PLUGIN_CONTINUE;
    set_hudmessage(0, 255, 0, 0.07, 0.22, 0, 6.0, 0.0)
    show_hudmessage(id, "Pontjai: %d", pont[target])
 
    return PLUGIN_CONTINUE;
    }
    set_hudmessage(0, 255, 0, 0.07, 0.22, 0, 6.0, 0.0)
    show_hudmessage(id, "Pontjaid: %d", pont[id])
    return PLUGIN_CONTINUE;
    }