- VIP | Afiseaza codul
#include <amxmodx> #include <hamsandwich> #include <fakemeta> #include <engine> #include <cstrike> #include <fun> #define PLUGIN "New Plugin" #define AUTHOR "D3luxe" #define VERSION "1.0" #define VIP_FLAG read_flags("abhtu") #define MAX_WEAPONS 4 enum DETALII { NumeArma[128], GiveWeapon[128], IndexArma, WEAPONKEY, OldW[128], Model_v[128], Model_p[128], Model_w[128], FireSound[128] }; new const ModelName[2][] = { "model_vipt", "model_vipct" }; new const ArmeGold[MAX_WEAPONS+1][DETALII] = { { "None","None",CSW_KNIFE,000,"None","None","None","None","None" },//linia asta nu trebuie completata //modifici astea de sub, locatiile modelelor si numele soundurilor { "Ak47 Gold","weapon_ak47",CSW_AK47,1998,"models/w_ak47.mdl","v_ak47gold.mdl","p_ak47gold.mdl","w_ak47gold.mdl","ak47g_fire.wav" }, { "M4a1 Gold","weapon_m4a1",CSW_M4A1,1999,"models/w_m4a1.mdl","v_m4a1gold.mdl","p_m4a1gold.mdl","w_m4a1gold.mdl","m4a1g_fire.wav" }, { "Deagle Gold","weapon_deagle",CSW_DEAGLE,1920,"models/w_deagle.mdl","v_deaglegold.mdl","p_deaglegold.mdl","w_deaglegold.mdl","deagleg_fire.wav" }, { "AwP Gold","weapon_awp",CSW_AWP,1921,"models/w_awp.mdl","v_awpgold.mdl","p_awpgold.mdl","w_awpgold.mdl","awpg_fire.wav" } }; new g_jumps[33],g_selectedweapon[33]; new cvar_hp,cvar_armor,cvar_kill_hp,cvar_hs_hp,cvar_max_jumps,cvar_max_hp; public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR); register_clcmd("say /vm","open_goldmenu"); register_forward(FM_PlaybackEvent, "fw_PlaybackEvent"); register_forward(FM_SetModel, "fw_SetModel"); for(new i = 1; i <= MAX_WEAPONS; i++) RegisterHam(Ham_Item_AddToPlayer,ArmeGold[GiveWeapon], "fw_Item_AddToPlayer_Post", 1); RegisterHam(Ham_Spawn,"player","give_spawn_hp_armor",1); RegisterHam(Ham_TakeDamage,"player","show_dmg"); RegisterHam(Ham_Player_Jump, "player", "FW_Player_Jump", 0); register_event("DeathMsg","ev_deathmsg","a"); register_event("CurWeapon","SetModels", "be", "1=1"); //cvar's cvar_hp = register_cvar("hp_vip_spawn","150"); cvar_armor = register_cvar("armor_vip_spawn","150"); cvar_max_hp = register_cvar("vip_max_hp","200"); cvar_kill_hp = register_cvar("vip_kill_hp","15"); cvar_hs_hp = register_cvar("vip_hs_hp","25"); cvar_max_jumps = register_cvar("vip_max_jumps","3"); } public client_putinserver(id) { g_selectedweapon[id] = 0; } public client_disconnect(id) { g_selectedweapon[id] = 0; } public plugin_precache() { new Txt[128]; for(new i = 0; i < sizeof(ModelName); i++) { formatex(Txt,charsmax(Txt),"models/player/%s/%s.mdl",ModelName,ModelName); precache_model(Txt); } for(new i = 1; i <= MAX_WEAPONS; i++) { formatex(Txt,charsmax(Txt),"models/armegold/%s",ArmeGold[Model_v]); precache_model(Txt); } for(new i = 1; i <= MAX_WEAPONS; i++) { formatex(Txt,charsmax(Txt),"models/armegold/%s",ArmeGold[Model_p]); precache_model(Txt); } for(new i = 1; i <= MAX_WEAPONS; i++) { formatex(Txt,charsmax(Txt),"models/armegold/%s",ArmeGold[Model_w]); precache_model(Txt); } for(new i = 1; i <= MAX_WEAPONS; i++) { formatex(Txt,charsmax(Txt),"armegold/%s",ArmeGold[FireSound]); precache_sound(Txt); } } //models arme gold public SetModels(id) { if(get_user_flags(id) & VIP_FLAG) { if(!is_user_alive(id) || !is_user_connected(id)) return PLUGIN_HANDLED; if(g_selectedweapon[id] > 0 && get_user_weapon(id) == ArmeGold[g_selectedweapon[id]][IndexArma]) { new Weapon[128]; formatex(Weapon,charsmax(Weapon),"models/armegold/%s",ArmeGold[g_selectedweapon[id]][Model_v]); set_pev(id,pev_viewmodel2,Weapon); formatex(Weapon,charsmax(Weapon),"models/armegold/%s",ArmeGold[g_selectedweapon[id]][Model_p]); set_pev(id,pev_weaponmodel2,Weapon); } } return PLUGIN_HANDLED; } public fw_PlaybackEvent(flags, invoker, eventid, Float:delay, Float:origin[3], Float:angles[3], Float:fparam1, Float:fparam2, iParam1, iParam2, bParam1, bParam2) { if(!is_user_connected(invoker)) return FMRES_IGNORED; if(!is_user_alive(invoker)) return FMRES_IGNORED; if( get_user_flags( invoker ) & VIP_FLAG && g_selectedweapon[invoker] > 0) { if(get_user_weapon(invoker) == ArmeGold[g_selectedweapon[invoker]][IndexArma]) { new FireWeap[128]; format(FireWeap,charsmax(FireWeap),"armegold/%s",ArmeGold[g_selectedweapon[invoker]][FireSound]); emit_sound(invoker, CHAN_WEAPON,FireWeap, 1.0, ATTN_NORM, 0, PITCH_NORM) return FMRES_HANDLED; } } return FMRES_IGNORED; } public fw_SetModel(entity, model[]) { if(!pev_valid(entity)) return FMRES_IGNORED static Classname[32] pev(entity, pev_classname, Classname, sizeof(Classname)) if(!equal(Classname, "weaponbox")) return FMRES_IGNORED static iOwner iOwner = pev(entity, pev_owner) if(equal(model,ArmeGold[g_selectedweapon[iOwner]][OldW])) { static weapon; weapon = fm_find_ent_by_owner(-1,ArmeGold[g_selectedweapon[iOwner]][GiveWeapon], entity) if(!pev_valid(weapon)) return FMRES_IGNORED; if(g_selectedweapon[iOwner] > 0) { set_pev(weapon, pev_impulse, ArmeGold[g_selectedweapon[iOwner]][WEAPONKEY]) engfunc(EngFunc_SetModel, entity,ArmeGold[g_selectedweapon[iOwner]][Model_w]) g_selectedweapon[iOwner] = 0; return FMRES_SUPERCEDE; } } return FMRES_IGNORED; } public fw_Item_AddToPlayer_Post(ent, id) { if(!pev_valid(ent)) return HAM_IGNORED; for(new i = 1 ; i <= MAX_WEAPONS ; i++) if(entity_get_int(ent, EV_INT_impulse) == ArmeGold[WEAPONKEY]) { g_selectedweapon[id] = i; set_pev(ent,pev_impulse, 0) message_begin(MSG_ONE,get_user_msgid("WeaponList"), {0,0,0}, id) write_string(ArmeGold[g_selectedweapon[id]][GiveWeapon]) write_byte(2) write_byte(90) write_byte(-1) write_byte(-1) write_byte(0) write_byte(1) write_byte(ArmeGold[g_selectedweapon[id]][IndexArma]) write_byte(0) message_end() entity_set_int(ent,EV_INT_impulse, 0) break; } return HAM_HANDLED } stock fm_find_ent_by_owner(index, const classname[], owner, jghgtype = 0) { new strtype[11] = "classname", ent = index; switch (jghgtype) { case 1: strtype = "target"; case 2: strtype = "targetname"; } while ((ent = engfunc(EngFunc_FindEntityByString, ent, strtype, classname)) && pev(ent, pev_owner) != owner) {} return ent; } public open_goldmenu(id) { if(!is_user_alive(id)) return PLUGIN_HANDLED; if(!(get_user_flags(id) & VIP_FLAG)) return PLUGIN_HANDLED; new szNumber[10]; new menu = menu_create("\wArme \rVIP \wGOLD \y:", "gold_handler"); for(new i = 1; i <= MAX_WEAPONS; i++) { num_to_str(i, szNumber, charsmax( szNumber )); menu_additem(menu,ArmeGold[NumeArma],szNumber,0); } menu_setprop( menu, MPROP_EXITNAME, "Exit") menu_display( id, menu, 0); return PLUGIN_HANDLED; } public gold_handler(id, menu, item) { if(item == MENU_EXIT || !is_user_alive(id) || !(get_user_flags(id) & VIP_FLAG)) { menu_destroy(menu); return PLUGIN_HANDLED; } static data[6], name[64], acs, cllbck; menu_item_getinfo(menu, item, acs, data, 5, name, 63, cllbck); g_selectedweapon[id] = str_to_num(data) give_item(id,ArmeGold[g_selectedweapon[id]][GiveWeapon]); cs_set_user_bpammo(id,ArmeGold[g_selectedweapon[id]][IndexArma],200); SetModels(id); menu_destroy(menu); return PLUGIN_HANDLED; } //event-uri(e doar 1 haha) public ev_deathmsg() { //citim cine e killer-ul,victima si daca a fost sau nu headshot new killer = read_data(1); new victim = read_data(2); new hs = read_data(3); //verificam daca e vip sau daca e event on if(get_user_flags(killer) & VIP_FLAG) { /*verificam ca victima sa nu fie egala cu killerul (slay/kill in consola/drop de sus ,etc + daca killerul si victima sunt conectate*/ if(killer != victim && is_user_connected(killer) && is_user_connected(victim)) { //verific daca e hs sau nu if(hs) { //folosesc clamp pentru ca e o metoda ma usoara de a seta maximul / minimul a ceva set_user_health(killer,clamp(get_user_health(killer)+get_pcvar_num(cvar_hs_hp),0,get_pcvar_num(cvar_max_hp))); }else{ if(get_user_weapon(killer) == CSW_KNIFE) set_user_health(killer,clamp(get_user_health(killer)+get_pcvar_num(cvar_kill_hp)+5,0,get_pcvar_num(cvar_max_hp))); else set_user_health(killer,clamp(get_user_health(killer)+get_pcvar_num(cvar_kill_hp),0,get_pcvar_num(cvar_max_hp))); } } } } //ham-uri public give_spawn_hp_armor(id) { //verificam daca e vip sau daca e event on if(get_user_flags(id) & VIP_FLAG) { //verifica daca useru e viu & conected if(is_user_alive(id)) { switch(get_user_team(id)) { case 1 : cs_set_user_model(id, ModelName[0]); case 2 : cs_set_user_model(id, ModelName[1]); } //setam armura si hp-ul vip-ului + he & flash set_user_health(id,get_pcvar_num(cvar_hp)); set_user_armor(id,get_pcvar_num(cvar_armor)); give_item(id,"weapon_flashbang"); give_item(id,"weapon_hegrenade"); g_selectedweapon[id] = 0; } } return HAM_IGNORED; } //idkn daca e cea mai buna idee sa folosesc take_damage dar la asta m-am gandit prima data xD public show_dmg(victim,inflictor,attacker,Float:Damage,dmg_type,dmgbits) { //verificam daca e vip sau daca e event on if(get_user_flags(attacker) & VIP_FLAG) { //verific daca e viu attacker-ul & victima conectata si sa nu fie victima aceasi cu attacker-ul if(attacker != victim && is_user_alive(attacker) && is_user_connected(victim) && is_user_connected(attacker)) { //afisam dmg-ul cu un hud set_hudmessage(0,255,0,-1.0,0.55,0,6.0,1.5) //sper ca ala e centrul show_hudmessage(attacker,"%d",Damage); SetHamParamFloat(4, Damage*2); } } return HAM_IGNORED; } //double jump public FW_Player_Jump(id) { if(get_user_flags(id) & VIP_FLAG) { new Flags = pev(id, pev_flags) if( Flags & FL_WATERJUMP || pev(id, pev_waterlevel) >= 2 || !(get_pdata_int(id, 246) & IN_JUMP) ) { return HAM_IGNORED } if( Flags & FL_ONGROUND ) { // Jump Count Is Set To 0 g_jumps[id] = 0 // Return Ham Ignore. return HAM_IGNORED } // If Private Data From Fall Velocity Is Lower Then 500. if( get_pdata_float(id, 251) < 500 && ++ g_jumps[id] <= get_pcvar_num(cvar_max_jumps) ) { // Set Velocity. new Float:fVelocity[ 3 ]; pev( id, pev_velocity, fVelocity ) fVelocity[ 2 ] = 268.328157 set_pev( id, pev_velocity, fVelocity ) // Return Ham Ignore. return HAM_HANDLED } } return HAM_IGNORED } //vip tag public VipStatus(const MsgId, const MsgType, const MsgDest) { static id; id = get_msg_arg_int(1); if((get_user_flags(id) & VIP_FLAG) && !get_msg_arg_int(2)) set_msg_arg_int(2, ARG_BYTE, (1 << 2 )); }
Code: Select all
/tmp/text46Bh2R.sma(54) : warning 213: tag mismatch
/tmp/text46Bh2R.sma(54) : error 032: array index out of bounds (variable "ArmeGold")
/tmp/text46Bh2R.sma(87) : warning 213: tag mismatch
/tmp/text46Bh2R.sma(87) : error 032: array index out of bounds (variable "ArmeGold")
/tmp/text46Bh2R.sma(92) : warning 213: tag mismatch
/tmp/text46Bh2R.sma(92) : error 032: array index out of bounds (variable "ArmeGold")
/tmp/text46Bh2R.sma(97) : warning 213: tag mismatch
/tmp/text46Bh2R.sma(97) : error 032: array index out of bounds (variable "ArmeGold")
/tmp/text46Bh2R.sma(102) : warning 213: tag mismatch
/tmp/text46Bh2R.sma(102) : error 032: array index out of bounds (variable "ArmeGold")
/tmp/text46Bh2R.sma(181) : warning 213: tag mismatch
/tmp/text46Bh2R.sma(181) : error 032: array index out of bounds (variable "ArmeGold")
/tmp/text46Bh2R.sma(222) : warning 213: tag mismatch
/tmp/text46Bh2R.sma(222) : warning 229: index tag mismatch (symbol "ArmeGold")
Ma poate ajuta cineva va rog ?