Raised This Month: $51 Target: $400
 12% 

Invalid player id 143


Post New Thread Reply   
 
Thread Tools Display Modes
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 05-24-2019 , 10:13   Re: Invalid player id 143
Reply With Quote #11

Quote:
Originally Posted by Fuck For Fun View Post
You sure do not have to do this to ZOMBIE WEAPON:

Quote:
! pev_valid (entity))
__________________








CrazY. is offline
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 05-24-2019 , 14:39   Re: Invalid player id 143
Reply With Quote #12

Quote:
Originally Posted by CrazY. View Post
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-24-2019 , 17:56   Re: Invalid player id 143
Reply With Quote #13

Quote:
Originally Posted by Fuck For Fun View Post
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)
__________________

Last edited by Bugsy; 05-24-2019 at 17:57.
Bugsy is offline
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 05-25-2019 , 04:41   Re: Invalid player id 143
Reply With Quote #14

Quote:
Originally Posted by Bugsy View Post
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
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
Old 12-04-2020, 20:41
Bugsy
This message has been deleted by Bugsy. Reason: Wrong thread
Reply



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 09:42.


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