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

How to get victim name?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
pyresdiablo
New Member
Join Date: Apr 2018
Old 04-21-2018 , 06:06   How to get victim name?
Reply With Quote #1

Hey, I am creating this plugin which blocks vote command from console, but i want to show the people in the server that who is using the command and who is the victim.
I was able to get users name using get_user_id but how do i get victim's name?
thank you.
pyresdiablo is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-21-2018 , 07:54   Re: How to get victim name?
Reply With Quote #2

Can you clarify victim? Do you mean dead player? Give an example of what you're trying to do
__________________

Last edited by Bugsy; 04-21-2018 at 07:54.
Bugsy is offline
pyresdiablo
New Member
Join Date: Apr 2018
Old 04-21-2018 , 08:05   Re: How to get victim name?
Reply With Quote #3

I mean, there is a command for client called "vote".
when a player types vote in console a list of joined players with #number appears.
they can use the command to kick people like
vote #113.
I have disabled that command but want to print the message in chat as
User1(voter) is trying to kick User2(Victim).
I have got user1's ID but dont know how to get user2's.
pyresdiablo is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 04-24-2018 , 05:31   Re: How to get victim name?
Reply With Quote #4

Check find_player API or cmd_target
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 04-24-2018 at 05:32.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
pyresdiablo
New Member
Join Date: Apr 2018
Old 04-28-2018 , 05:56   Re: How to get victim name?
Reply With Quote #5

Can you give an example?
pyresdiablo is offline
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 04-28-2018 , 06:55   Re: How to get victim name?
Reply With Quote #6

If the hash code(#123) is the actual user id, then just get the name using this value.
Code:
new userid2 = 456, ui2[32] get_user_name(userid2, ui2, charsmax(ui2))
__________________
Relaxing is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-28-2018 , 11:47   Re: How to get victim name?
Reply With Quote #7

@Relaxing that will not work. get_user_name() expects a 1-32 client id.

PHP Code:

#include <amxmodx>
#include <amxmisc>

public plugin_init() 
{
    
register_concmd"vote" "VoteConCmd" );
}

public 
VoteConCmdid )
{
    new 
szArg32 ] , iVictim szVoter32 ];
    
    
read_argvszArg charsmaxszArg ) );
    
iVictim cmd_targetid szArg );
    
    if ( 
iVictim )
    {
        
get_user_nameid szVoter charsmaxszVoter ) );
        
get_user_nameiVictim szArg charsmaxszArg ) );
        
        
console_printid "%s voted %s" szVoter szArg);
    }

__________________
Bugsy 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 16:29.


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