Quote:
Originally Posted by Bugsy
Yes, I know you have static id defined and you are getting the owner of the entity. The problem is the placement, hence you get an error and it doesn't work. Did you notice my code was getting the pev_owner at a different location in the code? That wasn't moved just For Fun.
Code:
//The id variable here is actually the entity id, the entity variable is technically the first byte of the model string (I believe), and model[] will be null.
//This should be fw_SetModel( entity , model[] ) as was already pointed it.
//Based on the above, we have only entity and model[] to work with, no player id.
public fw_SetModel(id,entity, model[]) {
//Here you are checking the flags of the entity, which is not what you want.
if(~get_user_flags(id) & PremiumFlag || !pev_valid(entity)) return FMRES_IGNORED
static Classname [64]
pev (entity, pev_classname, Classname, sizeof (Classname ))
if(! equal(Classname, "weaponbox"))
return FMRES_IGNORED
//Here you are getting the id of the player, but it is after you already attempted to check the
//player flags above. This is why I posted the little snippet of code because it will get the
//player id prior to attempting to check the player flags.
static id id = pev(entity, pev_owner)
|
This is as much as I will do 2 tests of ID
Example:
Code:
public Forward_SetModel( entity , const model[] )
{
static iOwner
iOwner = entity_get_edict(entity, EV_ENT_owner)
if ( !is_user_connected( iOwner ) || !( get_user_flags( iOwner ) & PremiumFlag ) )
return FMRES_IGNORED
static szClassName[33]
entity_get_string(entity, EV_SZ_classname, szClassName, charsmax(szClassName))
if(!equal(szClassName, "weaponbox"))
return FMRES_IGNORED
if(equal(model, OLD_MODEL))
{
static iStoredAugID
iStoredAugID = find_ent_by_owner(ENG_NULLENT, weapon_base_buffer, entity)
if(!is_valid_ent(iStoredAugID))
return FMRES_IGNORED
if(g_has_weapon[iOwner])
{
entity_set_int(iStoredAugID, EV_INT_WEAPONKEY, WEAPON_KEY)
g_has_weapon[iOwner] = false
set_pev(iStoredAugID, pev_iuser1, g_Ammo[iOwner])
entity_set_model(entity, W_MODEL)
return FMRES_SUPERCEDE
}
}
return FMRES_IGNORED
}
Second Example:
Code:
public fw_SetModel( entity , const model[] )
{
static id
id = pev(entity, pev_owner)
if ( !is_user_connected( id ) || !( get_user_flags( id ) & PremiumFlag ) )
return FMRES_IGNORED
static Classname[64]
pev(entity, pev_classname, Classname, sizeof(Classname))
if(!equal(Classname, "weaponbox"))
return FMRES_IGNORED
if(equal(model, old_w_model))
{
static weapon
weapon = fm_get_user_weapon_entity(entity, CSW_THUNDERBOLT)
if(!pev_valid(weapon))
return FMRES_IGNORED
if(g_had_thunderbolt[id])
{
set_pev(weapon, pev_impulse, WEAPON_SECRETCODE)
set_pev(weapon, pev_iuser4, g_thunderbolt_ammo[id])
engfunc(EngFunc_SetModel, entity, w_model)
g_had_thunderbolt[id] = 0
g_thunderbolt_ammo[id] = 0
return FMRES_SUPERCEDE
}
}
return FMRES_IGNORED;
}
now i had a big problem
I have a menu outside of these PLUGINS which is the net operation of the command to give the MODELS, the problem now that I do not want any player to get the MODEL he buys weapons from buymenu store