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

Change bot name


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
XHeadHunterX
Member
Join Date: Aug 2013
Old 10-15-2013 , 17:34   Change bot name
Reply With Quote #1

How can I change a bot name? I've searched the forum and I can't seem to make it work with a few code lines. Here is what I'm trying

PHP Code:
public Action:OnPlayerTeam(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    if(
GetClientTeam(client) == CS_TEAM_T && IsFakeClient(client) == true)
        
SetClientInfo(client"name""Testname");

This is for CS:GO, thanks!
XHeadHunterX is offline
Impact123
Veteran Member
Join Date: Oct 2011
Location: Germany
Old 10-15-2013 , 22:40   Re: Change bot name
Reply With Quote #2

You can try to set this too, but i'm not sure if CS:GO needs a special workaround.
PHP Code:
SetEntPropString(clientProp_Data"m_szNetname""Testname"); 
Btw, you don't need to check functions (which return a bool) excplicitly for true, just do it like this.
PHP Code:
if (someBooleanFunction())
{
    
// Is true

__________________

Last edited by Impact123; 10-15-2013 at 22:43.
Impact123 is offline
XHeadHunterX
Member
Join Date: Aug 2013
Old 10-16-2013 , 00:01   Re: Change bot name
Reply With Quote #3

Thanks for the reply. I tried that too but it acts weird, it says Testname changed name to HeadHunter, which should be the contrary.
XHeadHunterX is offline
Oshizu
Veteran Member
Join Date: Nov 2012
Location: Warsaw
Old 10-16-2013 , 14:08   Re: Change bot name
Reply With Quote #4

You can try to hook player_changename event
And stop it from showing up by using
PHP Code:
return Plugin_Handled
on bots
__________________
...
Oshizu is offline
XHeadHunterX
Member
Join Date: Aug 2013
Old 10-16-2013 , 14:58   Re: Change bot name
Reply With Quote #5

Still the same
XHeadHunterX is offline
Oshizu
Veteran Member
Join Date: Nov 2012
Location: Warsaw
Old 10-16-2013 , 17:48   Re: Change bot name
Reply With Quote #6

Did you used EventHookMode_Pre?
example this:
PHP Code:
HookEvent("player_changename"Event_NameChangeEventHookMode_Pre
__________________
...

Last edited by Oshizu; 10-16-2013 at 17:48.
Oshizu is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 10-16-2013 , 18:05   Re: Change bot name
Reply With Quote #7

I'll have to double check my llama plugin, but I use the following and I thought I was able to llama bots...

PHP Code:
SetClientInfo(client"name"name); 
...:: TnT Edit ::...
Oh, for CS:GO... nevermind... I never could get my llama plugin to work... changing the players names caused all kinds of janky stuff on CS:GO

This was posted a while ago (in scripting section I think)... needs updating before testing though
PHP Code:
/**
 * Changes a clients name
 *
 * @param client        A client index.
 * @param name        Set to false to skip the IsClientConnected check
 * @param silent        Set to true to not broadcast the name change
 * @noreturn
 */
stock CS_SetClientName(client, const String:name[], bool:silent=false)
{
    
decl String:oldname[MAX_NAME_LENGTH];
    
GetClientName(clientoldnamesizeof(oldname));

    
SetClientInfo(client"name"name);
    
SetEntPropString(clientProp_Data"m_szNetname"name);

    new 
Handle:event CreateEvent("player_changename");

    if (
event != INVALID_HANDLE)
    {
        
SetEventInt(event"userid"GetClientUserId(client));
        
SetEventString(event"oldname"oldname);
        
SetEventString(event"newname"name);
        
FireEvent(event);
    }

    if (
silent)
        return;
    
    new 
Handle:msg StartMessageAll("SayText2");

    if (
msg != INVALID_HANDLE)
    {
        
BfWriteByte(msgclient);
        
BfWriteByte(msgtrue);
        
BfWriteString(msg"Cstrike_Name_Change");
        
BfWriteString(msgoldname);
        
BfWriteString(msgname);
        
EndMessage();
    }

__________________
View my Plugins | Donate

Last edited by TnTSCS; 10-16-2013 at 18:07.
TnTSCS is offline
XHeadHunterX
Member
Join Date: Aug 2013
Old 10-16-2013 , 20:53   Re: Change bot name
Reply With Quote #8

Quote:
Originally Posted by Oshizu View Post
Did you used EventHookMode_Pre?
example this:
PHP Code:
HookEvent("player_changename"Event_NameChangeEventHookMode_Pre
Yes that's what I used.

Quote:
Originally Posted by TnTSCS View Post
I'll have to double check my llama plugin, but I use the following and I thought I was able to llama bots...

PHP Code:
SetClientInfo(client"name"name); 
...:: TnT Edit ::...
Oh, for CS:GO... nevermind... I never could get my llama plugin to work... changing the players names caused all kinds of janky stuff on CS:GO

This was posted a while ago (in scripting section I think)... needs updating before testing though
PHP Code:
/**
 * Changes a clients name
 *
 * @param client        A client index.
 * @param name        Set to false to skip the IsClientConnected check
 * @param silent        Set to true to not broadcast the name change
 * @noreturn
 */
stock CS_SetClientName(client, const String:name[], bool:silent=false)
{
    
decl String:oldname[MAX_NAME_LENGTH];
    
GetClientName(clientoldnamesizeof(oldname));

    
SetClientInfo(client"name"name);
    
SetEntPropString(clientProp_Data"m_szNetname"name);

    new 
Handle:event CreateEvent("player_changename");

    if (
event != INVALID_HANDLE)
    {
        
SetEventInt(event"userid"GetClientUserId(client));
        
SetEventString(event"oldname"oldname);
        
SetEventString(event"newname"name);
        
FireEvent(event);
    }

    if (
silent)
        return;
    
    new 
Handle:msg StartMessageAll("SayText2");

    if (
msg != INVALID_HANDLE)
    {
        
BfWriteByte(msgclient);
        
BfWriteByte(msgtrue);
        
BfWriteString(msg"Cstrike_Name_Change");
        
BfWriteString(msgoldname);
        
BfWriteString(msgname);
        
EndMessage();
    }

I saw that code but it is basically the same thing as I am doing with some more options to show the chat name etc. but the basics are the same code lines I used:
PHP Code:
SetClientInfo(client"name"name);
SetEntPropString(clientProp_Data"m_szNetname"name); 
Looks like there might not be a way to do this without an extension
XHeadHunterX is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 10-17-2013 , 10:01   Re: Change bot name
Reply With Quote #9

ya, CS:GO is janky when it comes to changing the names...
__________________
View my Plugins | Donate
TnTSCS 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 18:26.


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