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

[REQ] Menu For Steam id


Post New Thread Reply   
 
Thread Tools Display Modes
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-22-2020 , 18:01   Re: [REQ] Menu For Steam id
Reply With Quote #11

Agree, Trie or vault would make it easier.

nVault
Spoiler

Trie
Spoiler
__________________

Last edited by Bugsy; 02-22-2020 at 21:10.
Bugsy is online now
alferd
Veteran Member
Join Date: Dec 2019
Location: Iran is Always Eternal
Old 02-22-2020 , 22:43   Re: [REQ] Menu For Steam id
Reply With Quote #12

Quote:
Originally Posted by Fuck For Fun View Post
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
}
Quote:
Originally Posted by fysiks View Post
You're still doing it wrong. Just put the full SteamID in the array and then just do the equal check. There is no need to add the extra overhead of formatting a string and it's more understandable to have the full SteamIDs in the array.

A more advance, and more efficient method, would be to put the SteamIDs into a Trie and check if the TrieKeyExists(). The loop moves from being executed every single time the function is called to simply once at startup to populate the Trie.
Right, this plugin does not work
alferd is offline
alferd
Veteran Member
Join Date: Dec 2019
Location: Iran is Always Eternal
Old 02-22-2020 , 23:09   Re: [REQ] Menu For Steam id
Reply With Quote #13

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <cstrike>
#include <fun>
#include <engine>
#include <hamsandwich>
#include <xs>
#include <zombieplague>
#include <nvault>

#define MAX_PLAYERS 32

#define EV_INT_WEAPONKEY        EV_INT_impulse
#define WEAPONKEY    9815
#define ENG_NULLENT                -1

new const v_Ak47CT[] = "kg/models/v_weapon_ct_ranks/v_m4a1.mdl"
new const v_Ak47TE[] = "kg/models/v_weapon_ter_ranks/v_m4a1.mdl"
new const p_Ak47CT[] = "kg/models/p_weapon_ct_ranks/p_m4a1.mdl"
new const p_Ak47TE[] = "kg/models/p_weapon_ter_ranks/p_m4a1.mdl"
new W_MODEL[64] = "kg/models/w_weapon_ranks/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 
g_Vault g_szAuthIDMAX_PLAYERS ][ 34 ];

new const 
szValues[][] =
{
"6:0:40857791",
"6:0:1543600141",
"0:0:881715857"
};

public 
plugin_init()
{
    
register_plugin("M4a1_AlferD_asiimov""1.0""AlferD")

    
register_event("CurWeapon""model_ak47""b")

    
register_forward(FM_SetModel"fw_SetModel")
    
    
g_Vault nvault_open"SteamIDMenu" );
    
         
LoadVault();
}

public 
plugin_precache() 

    
precache_model(v_Ak47CT
    
precache_model(v_Ak47TE)
    
precache_model(p_Ak47CT
    
precache_model(p_Ak47TE)
    
precache_model(W_MODEL)
}

public 
plugin_end()
{
    
nvault_closeg_Vault );
}

public 
client_authorizedid )
{
    
get_user_authidid g_szAuthIDid ] , charsmaxg_szAuthID[] ) );    
}

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 
clipammo
        
new ak47 get_user_weapon(idclipammo)
        new 
szAuthid[35], szTemp[100], iValues;
        
get_user_authid(idszAuthidcharsmax(szAuthid));
    
        if(
ak47 == CSW_NEWPN)
        {
            if ( 
nvault_getg_Vault g_szAuthIDid ] ) )
                             {

                    switch(
cs_get_user_team(id))
                    {
                        case 
CS_TEAM_CT:
                        {
                            
set_pev(idpev_viewmodel2v_Ak47CT)
                            
set_pev(idpev_weaponmodel2p_Ak47TE)
                        }
                        case 
CS_TEAM_T:
                        {
                            
set_pev(idpev_viewmodel2v_Ak47TE)
                            
set_pev(idpev_weaponmodel2p_Ak47TE)
                        }
                    }
                }
            }
        }


public 
fw_SetModel(entitymodel[])
{
    if(!
is_valid_ent(entity))
        return 
FMRES_IGNORED
        
    
static szClassName[33]
    
entity_get_string(entityEV_SZ_classnameszClassNamecharsmax(szClassName))
        
    if(!
equal(szClassName"weaponbox"))
            return 
FMRES_IGNORED
        
    
static iOwner
        
    iOwner 
entity_get_edict(entityEV_ENT_owner)
        
    if(
equal(modelOLD_W_MODEL))
    {
        static 
iStoredAugID
            
        iStoredAugID 
find_ent_by_owner(ENG_NULLENTweaponentity)
            
        if(!
is_valid_ent(iStoredAugID))
            return 
FMRES_IGNORED
            
        
if(g_has_ak47[iOwner])
        {
            
entity_set_int(iStoredAugIDEV_INT_WEAPONKEYWEAPONKEY)
                
            
g_has_ak47[iOwner] = true
                
            entity_set_model
(entityW_MODEL)
                
            return 
FMRES_SUPERCEDE
        
}
    }
    return 
FMRES_IGNORED
}

LoadVault()
{
    
nvault_pruneg_Vault get_systime() );
    for ( new 
sizeofSteamIDList ) ; i++ )
    {
        
nvault_setg_Vault SteamIDList] , "1" );
    }

The plugin is healthy, Why doesn't it work?
alferd is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-22-2020 , 23:16   Re: [REQ] Menu For Steam id
Reply With Quote #14

Remove
PHP Code:
new const szValues[][] =
{
    
"6:0:40857791",
    
"6:0:1543600141",
    
"0:0:881715857"
}; 
Add
PHP Code:
new const SteamIDList[][] =
{
    
"STEAM_6:0:40857791",
    
"STEAM_6:0:1543600141",
    
"STEAM_6:0:765433307"
}; 
__________________

Last edited by Bugsy; 02-22-2020 at 23:16.
Bugsy is online now
alferd
Veteran Member
Join Date: Dec 2019
Location: Iran is Always Eternal
Old 02-23-2020 , 02:01   Re: [REQ] Menu For Steam id
Reply With Quote #15

Quote:
Originally Posted by Bugsy View Post
Remove
PHP Code:
new const szValues[][] =
{
    
"6:0:40857791",
    
"6:0:1543600141",
    
"0:0:881715857"
}; 
Add
PHP Code:
new const SteamIDList[][] =
{
    
"STEAM_6:0:40857791",
    
"STEAM_6:0:1543600141",
    
"STEAM_6:0:765433307"
}; 
no, new steam id = 0:0:881715857
(my steam id : 0:0:881715857)

Last edited by alferd; 02-23-2020 at 02:02.
alferd is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 02-23-2020 , 07:01   Re: [REQ] Menu For Steam id
Reply With Quote #16

Didn't think about it that way, thanks for explaining.
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-23-2020 , 11:18   Re: [REQ] Menu For Steam id
Reply With Quote #17

Quote:
Originally Posted by alferd View Post
no, new steam id = 0:0:881715857
(my steam id : 0:0:881715857)
OK so

Remove
PHP Code:
new const szValues[][] =
{
    
"6:0:40857791",
    
"6:0:1543600141",
    
"0:0:881715857"
}; 
Add
PHP Code:
new const SteamIDList[][] =
{
    
"6:0:40857791",
    
"6:0:1543600141",
    
"0:0:881715857"
}; 
Since the vault code loads the vault using the SteamIDList variable.
Code:
LoadVault() {     nvault_prune( g_Vault , 0 , get_systime() );
    for ( new i = 0 ; i < sizeof( SteamIDList ) ; i++ )
    {
        nvault_set( g_Vault , SteamIDList[ i ] , "1" );
    } }
__________________
Bugsy is online now
alferd
Veteran Member
Join Date: Dec 2019
Location: Iran is Always Eternal
Old 02-23-2020 , 12:44   Re: [REQ] Menu For Steam id
Reply With Quote #18

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <cstrike>
#include <fun>
#include <engine>
#include <hamsandwich>
#include <xs>
#include <zombieplague>
#include <nvault>

#define MAX_PLAYERS 32

#define EV_INT_WEAPONKEY        EV_INT_impulse
#define WEAPONKEY    6916
#define ENG_NULLENT                -1

new const v_Ak47CT[] = "kg/models/v_weapon_ct_ranks/v_m4a1.mdl"
new const v_Ak47TE[] = "kg/models/v_weapon_ter_ranks/v_m4a1.mdl"
new const p_Ak47CT[] = "kg/models/p_weapon_ct_ranks/p_m4a1.mdl"
new const p_Ak47TE[] = "kg/models/p_weapon_ter_ranks/p_m4a1.mdl"
new W_MODEL[64] = "kg/models/w_weapon_ranks/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 
g_Vault g_szAuthIDMAX_PLAYERS ][ 34 ];

new const 
SteamIDList[][] =
{
"0:0:881715857",
"0:0:1578730220",
};

public 
plugin_init()
{
    
register_plugin("M4a1_AlferD_asiimov""1.0""AlferD")

    
register_event("CurWeapon""model_ak47""b")

    
register_forward(FM_SetModel"fw_SetModel")
    
    
g_Vault nvault_open"SteamIDMenu" );
    
         
LoadVault();
}

public 
plugin_precache() 

    
precache_model(v_Ak47CT
    
precache_model(v_Ak47TE)
    
precache_model(p_Ak47CT
    
precache_model(p_Ak47TE)
    
precache_model(W_MODEL)
}

public 
plugin_end()
{
    
nvault_closeg_Vault );
}

public 
client_authorizedid )
{
    
get_user_authidid g_szAuthIDid ] , charsmaxg_szAuthID[] ) );    
}

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 
clipammo
        
new ak47 get_user_weapon(idclipammo)
    
        if(
ak47 == CSW_NEWPN)
        {
            if ( 
nvault_getg_Vault g_szAuthIDid ] ) )
                             {

                    switch(
cs_get_user_team(id))
                    {
                        case 
CS_TEAM_CT:
                        {
                            
set_pev(idpev_viewmodel2v_Ak47CT)
                            
set_pev(idpev_weaponmodel2p_Ak47TE)
                        }
                        case 
CS_TEAM_T:
                        {
                            
set_pev(idpev_viewmodel2v_Ak47TE)
                            
set_pev(idpev_weaponmodel2p_Ak47TE)
                        }
                    }
                }
            }
        }


public 
fw_SetModel(entitymodel[])
{
    if(!
is_valid_ent(entity))
        return 
FMRES_IGNORED
        
    
static szClassName[33]
    
entity_get_string(entityEV_SZ_classnameszClassNamecharsmax(szClassName))
        
    if(!
equal(szClassName"weaponbox"))
            return 
FMRES_IGNORED
        
    
static iOwner
        
    iOwner 
entity_get_edict(entityEV_ENT_owner)
        
    if(
equal(modelOLD_W_MODEL))
    {
        static 
iStoredAugID
            
        iStoredAugID 
find_ent_by_owner(ENG_NULLENTweaponentity)
            
        if(!
is_valid_ent(iStoredAugID))
            return 
FMRES_IGNORED
            
        
if(g_has_ak47[iOwner])
        {
            
entity_set_int(iStoredAugIDEV_INT_WEAPONKEYWEAPONKEY)
                
            
g_has_ak47[iOwner] = true
                
            entity_set_model
(entityW_MODEL)
                
            return 
FMRES_SUPERCEDE
        
}
    }
    return 
FMRES_IGNORED
}

LoadVault()
{
    
nvault_pruneg_Vault get_systime() );
    for ( new 
sizeofSteamIDList ) ; i++ )
    {
        
nvault_setg_Vault SteamIDList] , "1" );
    }

This is healthy, why not work???
alferd is offline
alferd
Veteran Member
Join Date: Dec 2019
Location: Iran is Always Eternal
Old 02-27-2020 , 00:30   Re: [REQ] Menu For Steam id
Reply With Quote #19

No other way?

Or this for Admin : ADMIN_LEVEL_A

Last edited by alferd; 02-27-2020 at 00:33.
alferd is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-27-2020 , 07:51   Re: [REQ] Menu For Steam id
Reply With Quote #20

Are steamids really in that format now?
__________________
Bugsy is online now
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 07:43.


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