Veteran Member
|
02-22-2020
, 06:42
Re: [REQ] Menu For Steam id
|
#7
|
Quote:
Originally Posted by alferd
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <cstrike>
#include <fun>
#include <engine>
#include <hamsandwich>
#include <xs>
#include <zombieplague>
#define EV_INT_WEAPONKEY EV_INT_impulse
#define WEAPONKEY 9815
#define ENG_NULLENT -1
new const v_Ak47CT[] = "kg/models/v_weapon_ct/v_m4a1.mdl"
new const v_Ak47TE[] = "kg/models/v_weapon_ter/v_m4a1.mdl"
new const p_Ak47CT[] = "kg/models/p_weapon_ct/p_m4a1.mdl"
new const p_Ak47TE[] = "kg/models/p_weapon_ter/p_m4a1.mdl"
new W_MODEL[64] = "kg/models/w_weapon/w_m4a1.mdl"
new OLD_W_MODEL[64] = "models/w_m4a1.mdl"
new const CSW_NEWPN = CSW_M4A1
new const weapon[] = "weapon_m4a1"
new g_has_ak47[33]
new const szValues[][] =
{
"6:0:40857791",
"6:0:1543600141",
"6:0:765433307"
};
public plugin_init()
{
register_plugin("M4a1 Models", "1.0", "AlferD")
register_event("CurWeapon", "model_ak47", "b")
register_forward(FM_SetModel, "fw_SetModel")
}
public plugin_precache()
{
precache_model(v_Ak47CT)
precache_model(v_Ak47TE)
precache_model(p_Ak47CT)
precache_model(p_Ak47TE)
precache_model(W_MODEL)
}
public client_connect(id)
{
g_has_ak47[id] = true
}
public client_disconnected(id)
{
g_has_ak47[id] = true
}
public model_ak47(id)
{
if(is_user_alive(id) && is_user_connected(id))
{
new clip, ammo
new ak47 = get_user_weapon(id, clip, ammo)
new szAuthid[35], szTemp[100], iValues;
get_user_authid(id, szAuthid, charsmax(szAuthid));
if(ak47 == CSW_NEWPN)
{
for(new i; i < sizeof(szValues); i++)
{
iValues = str_to_num(szValues[i]);
formatex(szTemp, charsmax(szTemp), "STEAM_%i", iValues);
if(equal(szTemp, szAuthid))
{
switch(cs_get_user_team(id))
{
case CS_TEAM_CT:
{
set_pev(id, pev_viewmodel2, v_Ak47CT)
set_pev(id, pev_weaponmodel2, p_Ak47TE)
}
case CS_TEAM_T:
{
set_pev(id, pev_viewmodel2, v_Ak47TE)
set_pev(id, pev_weaponmodel2, p_Ak47TE)
}
}
}
}
}
}
public fw_SetModel(entity, model[])
{
if(!is_valid_ent(entity))
return FMRES_IGNORED
static szClassName[33]
entity_get_string(entity, EV_SZ_classname, szClassName, charsmax(szClassName))
if(!equal(szClassName, "weaponbox"))
return FMRES_IGNORED
static iOwner
iOwner = entity_get_edict(entity, EV_ENT_owner)
if(equal(model, OLD_W_MODEL))
{
static iStoredAugID
iStoredAugID = find_ent_by_owner(ENG_NULLENT, weapon, entity)
if(!is_valid_ent(iStoredAugID))
return FMRES_IGNORED
if(g_has_ak47[iOwner])
{
entity_set_int(iStoredAugID, EV_INT_WEAPONKEY, WEAPONKEY)
g_has_ak47[iOwner] = true
entity_set_model(entity, W_MODEL)
return FMRES_SUPERCEDE
}
}
return FMRES_IGNORED
}
Can you do the same thing on this plugin?
model for steamID
|
you missed
Code:
#include <amxmodx>
#include <fakemeta>
#include <cstrike>
#include <fun>
#include <engine>
#include <hamsandwich>
#include <xs>
#include <zombieplague>
#define EV_INT_WEAPONKEY EV_INT_impulse
#define WEAPONKEY 9815
#define ENG_NULLENT -1
new const v_Ak47CT[] = "kg/models/v_weapon_ct/v_m4a1.mdl"
new const v_Ak47TE[] = "kg/models/v_weapon_ter/v_m4a1.mdl"
new const p_Ak47CT[] = "kg/models/p_weapon_ct/p_m4a1.mdl"
new const p_Ak47TE[] = "kg/models/p_weapon_ter/p_m4a1.mdl"
new W_MODEL[64] = "kg/models/w_weapon/w_m4a1.mdl"
new OLD_W_MODEL[64] = "models/w_m4a1.mdl"
new const CSW_NEWPN = CSW_M4A1
new const weapon[] = "weapon_m4a1"
new g_has_ak47[33]
new const szValues[][] =
{
"6:0:40857791",
"6:0:1543600141",
"6:0:765433307"
};
public plugin_init()
{
register_plugin("M4a1 Models", "1.0", "AlferD")
register_event("CurWeapon", "model_ak47", "b")
register_forward(FM_SetModel, "fw_SetModel")
}
public plugin_precache()
{
precache_model(v_Ak47CT)
precache_model(v_Ak47TE)
precache_model(p_Ak47CT)
precache_model(p_Ak47TE)
precache_model(W_MODEL)
}
public client_connect(id)
{
g_has_ak47[id] = true
}
public client_disconnected(id)
{
g_has_ak47[id] = true
}
public model_ak47(id)
{
if(is_user_alive(id) && is_user_connected(id))
{
new clip, ammo
new ak47 = get_user_weapon(id, clip, ammo)
new szAuthid[35], szTemp[100], iValues;
get_user_authid(id, szAuthid, charsmax(szAuthid));
if(ak47 == CSW_NEWPN)
{
for(new i; i < sizeof(szValues); i++)
{
iValues = str_to_num(szValues[i]);
formatex(szTemp, charsmax(szTemp), "STEAM_%i", iValues);
if(equal(szTemp, szAuthid))
{
switch(cs_get_user_team(id))
{
case CS_TEAM_CT:
{
set_pev(id, pev_viewmodel2, v_Ak47CT)
set_pev(id, pev_weaponmodel2, p_Ak47TE)
}
case CS_TEAM_T:
{
set_pev(id, pev_viewmodel2, v_Ak47TE)
set_pev(id, pev_weaponmodel2, p_Ak47TE)
}
}
}
}
}
}
}
public fw_SetModel(entity, model[])
{
if(!is_valid_ent(entity))
return FMRES_IGNORED
static szClassName[33]
entity_get_string(entity, EV_SZ_classname, szClassName, charsmax(szClassName))
if(!equal(szClassName, "weaponbox"))
return FMRES_IGNORED
static iOwner
iOwner = entity_get_edict(entity, EV_ENT_owner)
if(equal(model, OLD_W_MODEL))
{
static iStoredAugID
iStoredAugID = find_ent_by_owner(ENG_NULLENT, weapon, entity)
if(!is_valid_ent(iStoredAugID))
return FMRES_IGNORED
if(g_has_ak47[iOwner])
{
entity_set_int(iStoredAugID, EV_INT_WEAPONKEY, WEAPONKEY)
g_has_ak47[iOwner] = true
entity_set_model(entity, W_MODEL)
return FMRES_SUPERCEDE
}
}
return FMRES_IGNORED
}
|
|