Weapon - Owner Name-

Unpaid Requests, Public Plugins
Post Reply
User avatar
ArminC
Senior Member
Senior Member
Romania
Posts: 137
Joined: 6 years ago
Location: Bucharest
Contact:

Weapon - Owner Name-

#1

Post by ArminC » 6 years ago

Can you make a plugin that:

a) if you "aim/put the corsshair" on the dropped gun, to show in hud or under the crosshair a message of who's the weapon ? using the plugin below..
or
b) Using plugin below put a other way than chat message (hud/under crosshair message or other method) -- to avoid the spam..

Plugin:

Code: Select all

#include <amxmodx>
#include <reapi>

#if !defined client_print_color || !defined MAX_NAME_LENGTH
    #error NOTSUPPORT AMXX < 1.8.3!
#endif

#define _GetItemInfo_iId(%1)    rg_get_iteminfo(%1, ItemInfo_iId)
#define _SetItemInfo_iId(%1,%2)    rg_set_iteminfo(%1, ItemInfo_iId, %2)

const UNQUEID = 32; //minimum 32, because of there are max. 32 item ids.

public plugin_init()
{
    register_plugin("Whose The Weapon", "2.1", "Yek'-ta");
    RegisterHookChain(RG_CBasePlayer_AddPlayerItem, "CBasePlayer_AddPlayerItem", .post = true);
}

public CBasePlayer_AddPlayerItem(pPlayer, pItem)
{
    if(_GetItemInfo_iId(pItem) < UNQUEID){
        _SetItemInfo_iId(pItem, get_user_userid(pPlayer) + UNQUEID);
        return;
    }

    static piId, szName[MAX_NAME_LENGTH], szItemName[16];
    piId = _GetItemInfo_iId(pItem) - UNQUEID;

    if(get_user_userid(pPlayer)==piId){
        rg_get_iteminfo(pItem, ItemInfo_pszName, szItemName, charsmax(szItemName));

        client_print_color(pPlayer, pPlayer, "^1You picked up the weapon ^4%s ^1of ^3your own", szItemName[7]);
        return;
    }

    for (new i = 1; i <= MAX_CLIENTS; i++){
        if(get_user_userid(i)==piId && is_user_connected(i)){
            get_user_name(i, szName, charsmax(szName));
            rg_get_iteminfo(pItem, ItemInfo_pszName, szItemName, charsmax(szItemName));

            client_print_color(pPlayer, i, "^1You picked up the weapon ^4%s ^1of player ^3%s", szItemName[7], szName);
            return;
        }
    }
    return;
}

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#2

Post by Raheem » 6 years ago

Center Chat Message will be great in such plugin. So use it.
He who fails to plan is planning to fail

User avatar
ArminC
Senior Member
Senior Member
Romania
Posts: 137
Joined: 6 years ago
Location: Bucharest
Contact:

#3

Post by ArminC » 6 years ago

The problem is that I don't want as a priority center chat message but if I aim at the gun dropped to say who's.. (like if I aim a player it says his name).. anyway this stress the cpu?

User avatar
TheWhitesmith
Member
Member
Morocco
Posts: 33
Joined: 6 years ago
Location: Temara/Rabat
Contact:

#4

Post by TheWhitesmith » 6 years ago

It won't stress the cpu as far as you use a reasonable timer, or if you use client_PreThink
[SYA] CSGO-Mod for CS 1.6 [ Cases/Keys/Rank ][/size]
IP: 149.202.251.74:27016

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#5

Post by Raheem » 6 years ago

client_PreThink which will stress the CPU but if you hooked when player aim and if it's weapon entity you try to get it's owner, This is better.
He who fails to plan is planning to fail

Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Who is online

Users browsing this forum: No registered users and 2 guests