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

[REQ] Menu For Steam id


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
alferd
Veteran Member
Join Date: Dec 2019
Location: Iran is Always Eternal
Old 02-21-2020 , 00:25   [REQ] Menu For Steam id
Reply With Quote #1

Hi, I can create a plugin to open a menu for specific steam ids??

Similar to the example:
PHP Code:
new menu menu_create(" buy for Steam id""CommandMenuWeapons");
     if(
cs_get_user_team(id) & STEAM_6:0:40857791 == STEAM_6:0:1543600141 == STEAM_6:0:765433307) {
         
menu_additemmenu"Awp+Deagle+He+Flash""1"); 
alferd is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 02-21-2020 , 09:25   Re: [REQ] Menu For Steam id
Reply With Quote #2

get_user_authid() is to get a user's SteamID and you use equal() to compare that to your desired SteamID.
__________________
fysiks is offline
alferd
Veteran Member
Join Date: Dec 2019
Location: Iran is Always Eternal
Old 02-21-2020 , 11:58   Re: [REQ] Menu For Steam id
Reply With Quote #3

I did not succeed
alferd is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 02-21-2020 , 16:36   Re: [REQ] Menu For Steam id
Reply With Quote #4

this is untested, this might not work but it should be looking something like this. Correct me if i'm wrong
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "MenuAccordingSteamID"
#define VERSION "1.0"
#define AUTHOR "NapoleoN#"


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

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
register_clcmd("say /menu""ShowMenu");
}

public 
ShowMenu(id)
{
    new 
szAuthid[35], szTemp[100], iValues;
    
get_user_authid(idszAuthidcharsmax(szAuthid));
    
    for(new 
isizeof(szValues); i++)
    {
        
iValues str_to_num(szValues[i]);
        
formatex(szTempcharsmax(szTemp), "STEAM_%i"iValues);
        
        if(
equal(szTempszAuthid))
        {
            
//ShowMenu
        
}
    }

__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
alferd
Veteran Member
Join Date: Dec 2019
Location: Iran is Always Eternal
Old 02-21-2020 , 23:30   Re: [REQ] Menu For Steam id
Reply With Quote #5

Quote:
Originally Posted by Napoleon_be View Post
this is untested, this might not work but it should be looking something like this. Correct me if i'm wrong
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "MenuAccordingSteamID"
#define VERSION "1.0"
#define AUTHOR "NapoleoN#"


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

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
register_clcmd("say /menu""ShowMenu");
}

public 
ShowMenu(id)
{
    new 
szAuthid[35], szTemp[100], iValues;
    
get_user_authid(idszAuthidcharsmax(szAuthid));
    
    for(new 
isizeof(szValues); i++)
    {
        
iValues str_to_num(szValues[i]);
        
formatex(szTempcharsmax(szTemp), "STEAM_%i"iValues);
        
        if(
equal(szTempszAuthid))
        {
            
//ShowMenu
        
}
    }

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 
clipammo
        
new ak47 get_user_weapon(idclipammo)
    new 
szAuthid[35], szTemp[100], iValues;
    
get_user_authid(idszAuthidcharsmax(szAuthid));
    
    if(
ak47 == CSW_NEWPN)
        {
        for(new 
isizeof(szValues); i++)
    {
        
iValues str_to_num(szValues[i]);
        
formatex(szTempcharsmax(szTemp), "STEAM_%i"iValues);
    
        if(
equal(szTempszAuthid))
        {
            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

Can you do the same thing on this plugin?
model for steamID

Last edited by alferd; 02-21-2020 at 23:33.
alferd is offline
alferd
Veteran Member
Join Date: Dec 2019
Location: Iran is Always Eternal
Old 02-21-2020 , 23:34   Re: [REQ] Menu For Steam id
Reply With Quote #6

Quote:
Originally Posted by Napoleon_be View Post
this is untested, this might not work but it should be looking something like this. Correct me if i'm wrong
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "MenuAccordingSteamID"
#define VERSION "1.0"
#define AUTHOR "NapoleoN#"


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

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
register_clcmd("say /menu""ShowMenu");
}

public 
ShowMenu(id)
{
    new 
szAuthid[35], szTemp[100], iValues;
    
get_user_authid(idszAuthidcharsmax(szAuthid));
    
    for(new 
isizeof(szValues); i++)
    {
        
iValues str_to_num(szValues[i]);
        
formatex(szTempcharsmax(szTemp), "STEAM_%i"iValues);
        
        if(
equal(szTempszAuthid))
        {
            
//ShowMenu
        
}
    }

I can't complete this plugin
alferd is offline
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 02-22-2020 , 06:42   Re: [REQ] Menu For Steam id
Reply With Quote #7

Quote:
Originally Posted by alferd View Post
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 
clipammo
        
new ak47 get_user_weapon(idclipammo)
    new 
szAuthid[35], szTemp[100], iValues;
    
get_user_authid(idszAuthidcharsmax(szAuthid));
    
    if(
ak47 == CSW_NEWPN)
        {
        for(new 
isizeof(szValues); i++)
    {
        
iValues str_to_num(szValues[i]);
        
formatex(szTempcharsmax(szTemp), "STEAM_%i"iValues);
    
        if(
equal(szTempszAuthid))
        {
            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

Can you do the same thing on this plugin?
model for steamID
you missed
Quote:
}
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
}
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 02-22-2020 , 06:48   Re: [REQ] Menu For Steam id
Reply With Quote #8

I'm not even sure if the plugin will work, still waiting for feedback. Also it's not the most efficient way since i hardcoded the steamID's, but it was certainly the quickest and simpliest way.
__________________

Last edited by Napoleon_be; 02-22-2020 at 06:50.
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 02-22-2020 , 07:48   Re: [REQ] Menu For Steam id
Reply With Quote #9

Okay, so i just realised i was doing this wrong. steam id's are stored in szAuthid and are strings, so there's no point in doing the str_to_num.

Here's my updated code and this should work.

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "MenuAccordingSteamID"
#define VERSION "1.0"
#define AUTHOR "NapoleoN#"


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

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR);

    
register_clcmd("say /menu""ShowMenu");
}

public 
ShowMenu(id)
{
    new 
szAuthid[35], szTemp[100];
    
get_user_authid(idszAuthidcharsmax(szAuthid));

    for(new 
isizeof(szValues); i++)
    {
        
formatex(szTempcharsmax(szTemp), "STEAM_%i"szValues[i]);
    
        if(
equal(szTempszAuthid))
        {
            
//ShowMenu
        
}
    }

__________________

Last edited by Napoleon_be; 02-22-2020 at 07:49.
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 02-22-2020 , 15:56   Re: [REQ] Menu For Steam id
Reply With Quote #10

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.
__________________
fysiks is offline
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 04:58.


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