AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Solved Request (https://forums.alliedmods.net/showthread.php?t=317832)

mousesports 07-31-2019 16:06

Request
 
Hello ,
I would need a gold weapon plugin for vip users. Gold weapons to be: ak gold, m4a1 gold, awp gold and eagle gold. Could anyone help me with this?

Thanks!

Krtola 08-01-2019 07:55

Re: Request
 
Do you use any special shop menu for guns, or the player buys guns with chat command?

mousesports 08-01-2019 07:59

Re: Request
 
Quote:

Originally Posted by Krtola (Post 2661401)
Do you use any special shop menu for guns, or the player buys guns with chat command?

No, everyone is buying normal weapons. Only vip players have the special menu that appears from the 3rd run.

Krtola 08-01-2019 08:06

Re: Request
 
I can make weapons only for vip players, but Im not sure how to add that weapons in that special menu.
Do u have any weapons in that shop to show me as example?

mousesports 08-01-2019 08:10

Re: Request
 
I can give you an example from other vip+gold weapons for respawn mod . If you can integrate it on my vip plugin i will post that to .

This is the example plugin
Quote:

#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","No ne","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_deaglegol d.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,cv ar_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[i][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[i],ModelName[i]);
precache_model(Txt);
}
for(new i = 1; i <= MAX_WEAPONS; i++)
{
formatex(Txt,charsmax(Txt),"models/armegold/%s",ArmeGold[i][Model_v]);
precache_model(Txt);
}
for(new i = 1; i <= MAX_WEAPONS; i++)
{
formatex(Txt,charsmax(Txt),"models/armegold/%s",ArmeGold[i][Model_p]);
precache_model(Txt);
}
for(new i = 1; i <= MAX_WEAPONS; i++)
{
formatex(Txt,charsmax(Txt),"models/armegold/%s",ArmeGold[i][Model_w]);
precache_model(Txt);
}
for(new i = 1; i <= MAX_WEAPONS; i++)
{
formatex(Txt,charsmax(Txt),"armegold/%s",ArmeGold[i][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[i][WEAPONKEY])
{
g_selectedweapon[id] = i;
set_pev(ent,pev_impulse, 0)
message_begin(MSG_ONE,get_user_msgid("WeaponL ist"), {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[i][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_p cvar_num(cvar_max_hp)));
else
set_user_health(killer,clamp(get_user_health( killer)+get_pcvar_num(cvar_kill_hp),0,get_pcv ar_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:Dama ge,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 ));
}

Krtola 08-01-2019 08:17

Re: Request
 
Wait, if I understund, this plugin is not from your shop sistem?

mousesports 08-01-2019 08:26

Re: Request
 
Quote:

Originally Posted by Krtola (Post 2661410)
Wait, if I understund, this plugin is not from your shop sistem?

No , its not . I want something like that . My vip plugin is with standard weapons .
But I prefer a plugin that allows users who have FLAG t, to buy with the normal menu gold weapons.

Krtola 08-01-2019 08:34

Re: Request
 
All players use default/original CS shop ( open when u press B ) ?

If so, I have idea how we can do that.

mousesports 08-01-2019 08:35

Re: Request
 
Quote:

Originally Posted by Krtola (Post 2661412)
All players use default/original CS shop ( open when u press B ) ?

If so, I have idea how we can do that.

Yes, everyone use B

Krtola 08-01-2019 10:38

Re: Request
 
Would u like to have shop only for vips,but from chat command ?
For example player say gak ,and if he have money he will get golden ak47.
Or say gm4 for golden m4a1 etc ?


All times are GMT -4. The time now is 22:02.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.