Raised This Month: $344 Target: $400
 86%   Almost there!

VIp plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Calibru09
Junior Member
Join Date: Jan 2020
Location: Romania
Old 08-14-2022 , 04:31   VIp plugin
Reply With Quote #1

Hello,

I have this plugin :


PHP Code:
#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(PLUGINVERSIONAUTHOR);
register_clcmd("say /vm","open_goldmenu");
register_forward(FM_PlaybackEvent"fw_PlaybackEvent");
register_forward(FM_SetModel"fw_SetModel");

for(new 
1<= MAX_WEAPONSi++)
{
    
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 
0sizeof(ModelName); i++)
{
formatex(Txt,charsmax(Txt),"models/player/%s/%s.mdl",ModelName,ModelName);
precache_model(Txt);
}
for(new 
1<= MAX_WEAPONSi++)
{
formatex(Txt,charsmax(Txt),"models/armegold/%s",ArmeGold[i][Model_v]);
precache_model(Txt);
}
for(new 
1<= MAX_WEAPONSi++)
{
formatex(Txt,charsmax(Txt),"models/armegold/%s",ArmeGold[i][Model_p]);
precache_model(Txt);
}
for(new 
1<= MAX_WEAPONSi++)
{
formatex(Txt,charsmax(Txt),"models/armegold/%s",ArmeGold[i][Model_w]);
precache_model(Txt);
}
for(new 
1<= MAX_WEAPONSi++)
{
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] > && 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(flagsinvokereventidFloat:delayFloat:origin[3], Float:angles[3], Float:fparam1Float:fparam2iParam1iParam2bParam1bParam2)
{
if(!
is_user_connected(invoker))
return 
FMRES_IGNORED;

if(!
is_user_alive(invoker))
return 
FMRES_IGNORED;

if( 
get_user_flagsinvoker ) & 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(invokerCHAN_WEAPON,FireWeap1.0ATTN_NORM0PITCH_NORM)
return 
FMRES_HANDLED;
}
}
return 
FMRES_IGNORED;
}
public 
fw_SetModel(entitymodel[])
{
if(!
pev_valid(entity))
return 
FMRES_IGNORED

static Classname[32]
pev(entitypev_classnameClassnamesizeof(Classname))

if(!
equal(Classname"weaponbox"))
return 
FMRES_IGNORED

static iOwner
iOwner 
pev(entitypev_owner)

if(
equal(model,ArmeGold[g_selectedweapon[iOwner]][OldW]))
{
static 
weaponweapon 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(weaponpev_impulseArmeGold[g_selectedweapon[iOwner]][WEAPONKEY])
engfunc(EngFunc_SetModelentity,ArmeGold[g_selectedweapon[iOwner]][Model_w])
g_selectedweapon[iOwner] = 0;
return 
FMRES_SUPERCEDE;
}
}
return 
FMRES_IGNORED;
}
public 
fw_Item_AddToPlayer_Post(entid)
{
if(!
pev_valid(ent))
return 
HAM_IGNORED;

for(new 
<= MAX_WEAPONS i++)
if(
entity_get_int(entEV_INT_impulse) == ArmeGold[i][WEAPONKEY])
{
g_selectedweapon[id] = i;
set_pev(ent,pev_impulse0)
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_impulse0)
break;
}
return 
HAM_HANDLED
}
stock fm_find_ent_by_owner(index, const classname[], ownerjghgtype 0) {
new 
strtype[11] = "classname"ent index;
switch (
jghgtype) {
case 
1strtype "target";
case 
2strtype "targetname";
}
while ((
ent engfunc(EngFunc_FindEntityByStringentstrtypeclassname)) && pev(entpev_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 
1<= MAX_WEAPONSi++)
{
num_to_str(iszNumbercharsmaxszNumber ));
menu_additem(menu,ArmeGold[i][NumeArma],szNumber,0);
}
menu_setpropmenuMPROP_EXITNAME"Exit")
menu_displayidmenu0);
return 
PLUGIN_HANDLED;
}
public 
gold_handler(idmenuitem)
{
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], acscllbck;
menu_item_getinfo(menuitemacsdata5name63cllbck);
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 
cs_set_user_model(idModelName[0]);
case 
cs_set_user_model(idModelName[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(4Damage*2);
}
}
return 
HAM_IGNORED;
}
//double jump
public FW_Player_Jump(id)
{
if(
get_user_flags(id) & VIP_FLAG)
{
new 
Flags pev(idpev_flags)
if( 
Flags FL_WATERJUMP || pev(idpev_waterlevel) >= || !(get_pdata_int(id246) & 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(id251) < 500 && ++ g_jumps[id] <= get_pcvar_num(cvar_max_jumps) )
{
// Set Velocity.
new Float:fVelocity];
pevidpev_velocityfVelocity )
fVelocity] = 268.328157
set_pev
idpev_velocityfVelocity )

// 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(2ARG_BYTE, (<< ));

but no matter where and with what name i put the players models i receive the same error :


HTML Code:
FATAL ERROR (shutting down): Mod_LoadModel: models/player0model_vipt0model_vipt.mdl not found
/entrypoint.sh: line 36:    19 Segmentation fault      (core dumped) ./hlds_run -console -game ${HLDS_GAME} +ip ${SERVER_IP} -port ${SERVER_PORT} -sport ${VAC_PORT} +map ${SRCDS_MAP} +maxplayers ${MAXPLAYERS} +sys_ticrate ${TIC} -strictportbind -norestart

Can someone help me please ?
Calibru09 is offline
Send a message via AIM to Calibru09 Send a message via Yahoo to Calibru09 Send a message via Skype™ to Calibru09
wilian159
Member
Join Date: Dec 2013
Old 08-14-2022 , 21:06   Re: VIp plugin
Reply With Quote #2

models/player0model_vipt0model_vipt.mdl not found
__________________
Hmm, nice....... www.addonscs.com
wilian159 is offline
Calibru09
Junior Member
Join Date: Jan 2020
Location: Romania
Old 08-15-2022 , 02:01   Re: VIp plugin
Reply With Quote #3

Quote:
Originally Posted by wilian159 View Post
models/player0model_vipt0model_vipt.mdl not found
yeah that is the problem , no matter where and how i name the models it still give me the same error
Calibru09 is offline
Send a message via AIM to Calibru09 Send a message via Yahoo to Calibru09 Send a message via Skype™ to Calibru09
Nutu_
AlliedModders Donor
Join Date: Mar 2016
Location: Germany
Old 08-15-2022 , 16:29   Re: VIp plugin
Reply With Quote #4

try to name the models just like you name them on the source, it should work :')
becareful i haven't look at ur code but some models need to be in their folder, like cstrike/models/test/test.mdl
or, just cstrike/models/test.mdl, try both versions, there just be no errors
__________________
a simple act of caring creates an endless ripple.
Nutu_ is offline
Calibru09
Junior Member
Join Date: Jan 2020
Location: Romania
Old 08-16-2022 , 03:38   Re: VIp plugin
Reply With Quote #5

Quote:
Originally Posted by Nutu_ View Post
try to name the models just like you name them on the source, it should work :')
becareful i haven't look at ur code but some models need to be in their folder, like cstrike/models/test/test.mdl
or, just cstrike/models/test.mdl, try both versions, there just be no errors
I didn't write the code it's an old vip plugin and the main reason i'm struggling is the exasctly path and moddel name that should be placed .
Calibru09 is offline
Send a message via AIM to Calibru09 Send a message via Yahoo to Calibru09 Send a message via Skype™ to Calibru09
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:20.


Powered by vBulletin®
Copyright ©2000 - 2022, vBulletin Solutions, Inc.
Theme made by Freecode