Raised This Month: $32 Target: $400
 8% 

Solved [help!] Get active weapon if weapon == weapon_smg1


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ethorbit
Member
Join Date: Sep 2016
Location: Oregon
Old 03-18-2017 , 02:23   [help!] Get active weapon if weapon == weapon_smg1
Reply With Quote #1

I wanted to check if the active weapon was weapon_smg1

Last edited by Ethorbit; 03-22-2017 at 16:50.
Ethorbit is offline
sdz
Senior Member
Join Date: Feb 2012
Old 03-18-2017 , 06:15   Re: [help!] Get active weapon then do hud text
Reply With Quote #2

GetClientWeapon
SetHudTextParams
ShowHudText

If you need some code examples for HudText I can show you. It can be a little confusing at first.

Last edited by sdz; 03-18-2017 at 06:16.
sdz is offline
Ethorbit
Member
Join Date: Sep 2016
Location: Oregon
Old 03-18-2017 , 17:01   Re: [help!] Get active weapon then do hud text
Reply With Quote #3

Quote:
Originally Posted by EasSidezz View Post
GetClientWeapon
SetHudTextParams
ShowHudText

If you need some code examples for HudText I can show you. It can be a little confusing at first.
Are you able to provide a good starting point for
https://sm.alliedmods.net/api/index....d=show&id=425&

I didn't specify enough, but that's the only thing I'm having trouble with, hud text I can do.
Ethorbit is offline
Weetabix
Member
Join Date: Feb 2017
Location: United Kingdom
Old 03-18-2017 , 17:24   Re: [help!] Get active weapon then do hud text
Reply With Quote #4

Quote:
Originally Posted by Ethorbit View Post
Are you able to provide a good starting point for
https://sm.alliedmods.net/api/index....d=show&id=425&

I didn't specify enough, but that's the only thing I'm having trouble with, hud text I can do.
Example:
PHP Code:
public Action Command_Weapon(int iClientint iArgs)
{
    if(!
IsValidClient(iClient))
    {
        return 
Plugin_Handled;
    }
    
    
char sWeapon[64];
    
GetClientWeapon(iClientsWeaponsizeof(sWeapon));
    
    
ShowHudText(iClientsWeapon);

    return 
Plugin_Handled;


Last edited by Weetabix; 03-18-2017 at 17:24.
Weetabix is offline
Ethorbit
Member
Join Date: Sep 2016
Location: Oregon
Old 03-18-2017 , 18:13   Re: [help!] Get active weapon then do hud text
Reply With Quote #5

Quote:
Originally Posted by Weetabix View Post
Example:
PHP Code:
public Action Command_Weapon(int iClientint iArgs)
{
    if(!
IsValidClient(iClient))
    {
        return 
Plugin_Handled;
    }
    
    
char sWeapon[64];
    
GetClientWeapon(iClientsWeaponsizeof(sWeapon));
    
    
ShowHudText(iClientsWeapon);

    return 
Plugin_Handled;

Is this compatible with Half-Life 2: Deathmatch?
https://sm.alliedmods.net/api/index....d=show&id=425& looks as if it's for TF2 only.
Ethorbit is offline
Ethorbit
Member
Join Date: Sep 2016
Location: Oregon
Old 03-18-2017 , 20:04   Re: [help!] Get active weapon then do hud text
Reply With Quote #6

Quote:
Originally Posted by Weetabix View Post
Example:
PHP Code:
public Action Command_Weapon(int iClientint iArgs)
{
    if(!
IsValidClient(iClient))
    {
        return 
Plugin_Handled;
    }
    
    
char sWeapon[64];
    
GetClientWeapon(iClientsWeaponsizeof(sWeapon));
    
    
ShowHudText(iClientsWeapon);

    return 
Plugin_Handled;

Yes, but how can you do an if sWeapon == weapon_smg1 statement?
I always get unknown symbol "weapon_smg1" errors
Ethorbit is offline
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 03-19-2017 , 07:31   Re: [help!] Get active weapon if weapon == weapon_smg1
Reply With Quote #7

Did you just totally changed your question?

Please don't do that... If you have another question, create another topic so there is some history of questions and answers for other people who might seek the same answers.

btw try StrEqual
__________________
Plugins: TeamGames
Includes: Menu stocks, ColorVariables, DownloadTableConfig

> No help through PM, make a topic.

Last edited by KissLick; 03-19-2017 at 07:32.
KissLick is offline
sdz
Senior Member
Join Date: Feb 2012
Old 03-19-2017 , 09:10   Re: [help!] Get active weapon then do hud text
Reply With Quote #8

Quote:
Originally Posted by Ethorbit View Post
Are you able to provide a good starting point for
https://sm.alliedmods.net/api/index....d=show&id=425&

I didn't specify enough, but that's the only thing I'm having trouble with, hud text I can do.
PHP Code:
public Action showHudText(Handle timerany client)
{
    if(!
IsClientConnected(client) || !IsClientInGame(client)) return Plugin_Handled;

    
char playerWeapon[32];
    
GetClientWeapon(clientplayerWeaponsizeof(playerWeapon));

    if(
StrEqual(playerWeapon"weapon_smg1"false))
    {
        
SetHudTextParams(-1.00.981.0025525525525500.00.10.0);
        
ShowHudText(client, -1"Current Weapon: SMG");
    }
    return 
Plugin_Handled;

Could use this in a timer with a TIMER_REPEAT flag and it would redraw every 1 second
sdz is offline
Ethorbit
Member
Join Date: Sep 2016
Location: Oregon
Old 03-22-2017 , 16:51   Re: [help!] Get active weapon then do hud text
Reply With Quote #9

Quote:
Originally Posted by EasSidezz View Post
PHP Code:
public Action showHudText(Handle timerany client)
{
    if(!
IsClientConnected(client) || !IsClientInGame(client)) return Plugin_Handled;

    
char playerWeapon[32];
    
GetClientWeapon(clientplayerWeaponsizeof(playerWeapon));

    if(
StrEqual(playerWeapon"weapon_smg1"false))
    {
        
SetHudTextParams(-1.00.981.0025525525525500.00.10.0);
        
ShowHudText(client, -1"Current Weapon: SMG");
    }
    return 
Plugin_Handled;

Could use this in a timer with a TIMER_REPEAT flag and it would redraw every 1 second
Working very nicely. If only it were possible to change text size (not coordinates) and make it transparent so it doesn't annoy players.
Ethorbit is offline
Ethorbit
Member
Join Date: Sep 2016
Location: Oregon
Old 03-22-2017 , 16:53   Re: [help!] Get active weapon if weapon == weapon_smg1
Reply With Quote #10

Quote:
Originally Posted by KissLick View Post
Did you just totally changed your question?
Nope, just made it more understandable.
Just compare the changes and you would figure that out.
Ethorbit is offline
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 13:34.


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