Raised This Month: $68 Target: $400
 17% 

Some help...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mentalproblems
Junior Member
Join Date: Mar 2019
Old 08-15-2019 , 17:09   Some help...
Reply With Quote #1

If I'm wanting to set a knife model to work only with my SteamID.

How do I do that... How do I actually make the plugin recognize my ID...

if (get_user_authid(id) == "STEAM:1:0_ID") or?... anyone to explain me how to?

Thank u.


What I mean is, how do I make this work?

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <cstrike>

#define ADMINFLAG    ADMIN_LEVEL_G

new const myid[] = "STEAM_0:1:xxxxxx"

new const v_Knife_Admin[64] = "models/rgc_vip/v_vip_knife.mdl"
new const v_Knife_myknife[64] = "models/rgc_vip/v_alb_knife.mdl"

public plugin_init() {
    
register_plugin("Admin/VIP Knife Models""2.0""nobody")
    
register_event("CurWeapon""Event_CurWeapon""be""1=1")
}

public 
plugin_precache() {
    
precache_model(v_Knife_Admin)
    
precache_model(v_Knife_myknife)
}

public 
Event_CurWeapon(id) {
    new 
weapon read_data(2)
    
    if (
get_user_authid(idmyidcharsmax(myid)) && (weapon == CSW_KNIFE) {
        
set_pev(idpev_viewmodel2v_Knife_myknife)
    }
    else if(
get_user_flags(id) == ADMINFLAG && weapon == CSW_KNIFE) {
        
set_pev(idpev_viewmodel2v_Knife_Admin)
    }


Last edited by mentalproblems; 08-15-2019 at 17:22. Reason: Added code.
mentalproblems is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 08-15-2019 , 17:21   Re: Some help...
Reply With Quote #2

Please use descriptive titles, it only takes 10 more seconds of your time, but makes the life of 1000 more people easier.

"get_user_authid" returns a string, so you need to store it in a buffer and compare it using the "equal" function.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
mentalproblems
Junior Member
Join Date: Mar 2019
Old 08-15-2019 , 17:25   Re: Some help...
Reply With Quote #3

What you told me right now is just too big for me to absorb, can you simply fix the code for me there if possible. Thank you.
mentalproblems is offline
thEsp
Veteran Member
Join Date: Aug 2017
Location: Albania
Old 08-15-2019 , 17:28   Re: Some help...
Reply With Quote #4

Quote:
PHP Code:
get_user_authid(id) == 
This native does not return a string, it formats the given string (second argument).

Quote:
STEAM:1
Wait, are you from the future?
__________________
Inactive on this forum due to work and busy personal life. Will definitely miss most of y'all, farewell!
thEsp is offline
mentalproblems
Junior Member
Join Date: Mar 2019
Old 08-15-2019 , 17:30   Re: Some help...
Reply With Quote #5

So if (get_user_authid(id) == STEAM:1:0_xxxxx) { ?

Last edited by mentalproblems; 08-15-2019 at 17:30.
mentalproblems is offline
thEsp
Veteran Member
Join Date: Aug 2017
Location: Albania
Old 08-15-2019 , 17:38   Re: Some help...
Reply With Quote #6

Code:
#include <amxmodx> #include <fakemeta> #include <hamsandwich> new const szOwnerSID[] = "..."; new const szKnifeModel[] = "models/{modelname}.mdl"; // CBasePlayerItem new const m_pPlayer = 41; public plugin_init() {      RegisterHam(Ham_Item_Deploy, "weapon_knife", "hamDeploy_post", 1); } public plugin_precache() {     precache_model(szKnifeModel); } public hamDeploy_post(iEnt) {     new id = get_pdata_cbase(iEnt, m_pPlayer, 4);     if(!id)         return;         new szUserSID[32];     get_user_authid(id, szUserSID, charsmax(szUserSID));     if(equal(szUserSID, szOwnerSID))         set_pev(id, pev_viewmodel2, szKnifeModel); }
Untested.
PS: Next time us a better title for your thread, instead of jabaiting the members.
__________________
Inactive on this forum due to work and busy personal life. Will definitely miss most of y'all, farewell!

Last edited by thEsp; 08-15-2019 at 17:48. Reason: 41 -> m_pPlayer
thEsp is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 08-16-2019 , 08:39   Re: Some help...
Reply With Quote #7

Quote:
Originally Posted by mentalproblems View Post
What you told me right now is just too big for me to absorb, can you simply fix the code for me there if possible. Thank you.
This section is for learning, not waiting for someone else do to the stuff for you. If you want someone to fix the code for you, use the requests section.
__________________

Last edited by OciXCrom; 08-16-2019 at 08:40.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Reply


Thread Tools
Display Modes

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 03:58.


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