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

nickname changer


Post New Thread Reply   
 
Thread Tools Display Modes
samobiezny133
Junior Member
Join Date: Jan 2024
Old 01-16-2024 , 03:13   Re: nickname changer
Reply With Quote #11

Quote:
Originally Posted by fysiks View Post
Ok, so here is this plugin working based on my understanding of your request.
Code:
Plugin failed to compile! Please try contacting the author.
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

/home/forums/content/files/3/0/7/1/9/202861.attach(432) : error 029: invalid expression, assumed zero
/home/forums/content/files/3/0/7/1/9/202861.attach(432 -- 434) : error 008: must be a constant expression; assumed zero

2 Errors.
Could not locate output file /home/groups/amxmodx/public_html/compiled3/202861.amx (compile failed).

Last edited by samobiezny133; 01-16-2024 at 06:32.
samobiezny133 is offline
samobiezny133
Junior Member
Join Date: Jan 2024
Old 01-16-2024 , 06:21   Re: nickname changer
Reply With Quote #13

Quote:
Originally Posted by mlibre View Post
try amxxStudio no web
Code:
//AMXXPC compile.exe
// by the AMX Mod X Dev Team


//// force_player_name.sma
// C:\Users\admin\Desktop\addons\amxmodx\scripting\force_player_name.sma(432) : error 029: invalid expression, assumed zero
// C:\Users\admin\Desktop\addons\amxmodx\scripting\force_player_name.sma(432 -- 434) : error 008: must be a constant expression; assumed zero
//
// 2 Errors.
// Could not locate output file C:\Users\admin\Desktop\addons\amxmodx\scripting\compiled\force_player_name.amx (compile failed).
//
// Compilation Time: 0,14 sec
// ----------------------------------------

Press enter to exit ...
I don't know why it won't compile. am I doing something wrong?
samobiezny133 is offline
mlibre
Veteran Member
Join Date: Nov 2015
Location: return PLUGIN_CONTINUE
Old 01-16-2024 , 07:04   Re: nickname changer
Reply With Quote #14

Code:
    //...     "Biohazard",     "Bodzio", }



PHP Code:
    //...
    
"Biohazard",
    
"Bodzio"

__________________
mlibre is offline
samobiezny133
Junior Member
Join Date: Jan 2024
Old 01-16-2024 , 08:36   Re: nickname changer
Reply With Quote #15

Quote:
Originally Posted by mlibre View Post
Code:
    //...     "Biohazard",     "Bodzio", }



PHP Code:
    //...
    
"Biohazard",
    
"Bodzio"

Thanks a lot @fysiks and @mlibre, live for 200 years!
The plugin compiled and works.
However, when I reconnect my body is hanging in the air. What could be the cause of this?
Attached Thumbnails
Click image for larger version

Name:	20240116142729_1.jpg
Views:	30
Size:	92.5 KB
ID:	202863  
samobiezny133 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-16-2024 , 23:30   Re: nickname changer
Reply With Quote #16

I wrote it using AMX Mod X 1.9.0 and it's generally the recommended version. It's a miracle that anything older still works at all.

I can't imagine this plugin affecting a player model but I'm not saying it's not possible. I uses all the same mechanisms that my plugin does so I find it unlikely.
__________________

Last edited by fysiks; 01-16-2024 at 23:31.
fysiks is offline
samobiezny133
Junior Member
Join Date: Jan 2024
Old 01-17-2024 , 04:10   Re: nickname changer
Reply With Quote #17

Quote:
Originally Posted by fysiks View Post
I wrote it using AMX Mod X 1.9.0 and it's generally the recommended version. It's a miracle that anything older still works at all.

I can't imagine this plugin affecting a player model but I'm not saying it's not possible. I uses all the same mechanisms that my plugin does so I find it unlikely.

I updated AMX and the problem disappeared.
Thanks for everything!
samobiezny133 is offline
CAN2323
Junior Member
Join Date: Oct 2022
Old 03-08-2024 , 02:59   Re: nickname changer
Reply With Quote #18

Quote:
Originally Posted by samobiezny133 View Post
Hello, I would like to create a plugin that changes the nickname of each player joining the server to one of the nicknames from my pool. I would also like the plugin to draw a nickname from the pool every time the map changes, and so that the drawn nickname cannot be changed by the player.
How to do it?
#include <amxmodx>
#include <fun>

#max_clients 32

#pool "Nickname 1", "Nickname 2", "Nickname 3", "Nickname 4"

#init
{
register_plugin("nickname_changer", PLUGIN_PRIORITY_MIDDLE);

register_clcmd("say /nick <name>", nickname_changer_clcmd);
}

#amx_run
{
new nickname[256];
int client_index = get_amxinterfaces()->client_interfaces()->amx_find_player(amx, params[1]);

if (client_index < 1 || client_index > 32)
{
amx_strcpy(nickname, "Invalid client index.");
return PLUGIN_HANDLED;
}

if (get_amxinterfaces()->client_interfaces()->amx_get_player_name(amx, client_index, nickname, sizeof(nickname)) < 1)
{
amx_strcpy(nickname, "Failed to get player name.");
return PLUGIN_HANDLED;
}

if (is_nickname_available(nickname))
{
set_nickname(client_index, nickname);
}
else
{
amx_strcpy(nickname, "Nickname is not available.");
}

return PLUGIN_HANDLED;
}

int nickname_changer_clcmd(int client, int args)
{
if (args != 2)
{
return PLUGIN_HANDLED;
}

amx_run(amx, "nickname_changer", client, args);
return PLUGIN_HANDLED;
}

bool is_nickname_available(char* nickname)
{
int i;
char* pool_nickname;

for (i = 1; i <= max_clients(); i++)
{
if (get_amxinterfaces()->client_interfaces()->amx_get_player_name(amx, i, nickname, sizeof(nickname)) < 1)
{
continue;
}

pool_nickname = get_next_nickname_from_pool();

if (stricmp(nickname, pool_nickname) == 0)
{
return false;
}
}

return true;
}

char* get_next_nickname_from_pool()
{
static int index = 0;
char* pool_nickname;

index = (index + 1) % (array_length(nickname_pool) - 1);
pool_nickname = nickname_pool[index];

return pool_nickname;
}

void set_nickname(int client, char* nickname)
{
get_amxinterfaces()->client_interfaces()->amx_set_player_name(amx, client, nickname);
}


Replace the #pool line with your list of nicknames, separated by commas.
CAN2323 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-08-2024 , 19:57   Re: nickname changer
Reply With Quote #19

Quote:
Originally Posted by CAN2323 View Post
#include <amxmodx>
#include <fun>

#max_clients 32

#pool "Nickname 1", "Nickname 2", "Nickname 3", "Nickname 4"

#init
{
register_plugin("nickname_changer", PLUGIN_PRIORITY_MIDDLE);

register_clcmd("say /nick <name>", nickname_changer_clcmd);
}

#amx_run
{
new nickname[256];
int client_index = get_amxinterfaces()->client_interfaces()->amx_find_player(amx, params[1]);

if (client_index < 1 || client_index > 32)
{
amx_strcpy(nickname, "Invalid client index.");
return PLUGIN_HANDLED;
}

if (get_amxinterfaces()->client_interfaces()->amx_get_player_name(amx, client_index, nickname, sizeof(nickname)) < 1)
{
amx_strcpy(nickname, "Failed to get player name.");
return PLUGIN_HANDLED;
}

if (is_nickname_available(nickname))
{
set_nickname(client_index, nickname);
}
else
{
amx_strcpy(nickname, "Nickname is not available.");
}

return PLUGIN_HANDLED;
}

int nickname_changer_clcmd(int client, int args)
{
if (args != 2)
{
return PLUGIN_HANDLED;
}

amx_run(amx, "nickname_changer", client, args);
return PLUGIN_HANDLED;
}

bool is_nickname_available(char* nickname)
{
int i;
char* pool_nickname;

for (i = 1; i <= max_clients(); i++)
{
if (get_amxinterfaces()->client_interfaces()->amx_get_player_name(amx, i, nickname, sizeof(nickname)) < 1)
{
continue;
}

pool_nickname = get_next_nickname_from_pool();

if (stricmp(nickname, pool_nickname) == 0)
{
return false;
}
}

return true;
}

char* get_next_nickname_from_pool()
{
static int index = 0;
char* pool_nickname;

index = (index + 1) % (array_length(nickname_pool) - 1);
pool_nickname = nickname_pool[index];

return pool_nickname;
}

void set_nickname(int client, char* nickname)
{
get_amxinterfaces()->client_interfaces()->amx_set_player_name(amx, client, nickname);
}


Replace the #pool line with your list of nicknames, separated by commas.
Umm . . no. What language do you think you're writing in? It kind of looks like you're trying to mix C and Pawn with random stuff that isn't valid in either.
__________________
fysiks is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 03-09-2024 , 09:29   Re: nickname changer
Reply With Quote #20

This renaming script might be easier to canabolize. Comment out the IF condition before @player_rename(id) to do all players. One will need to do more work to lock their names down. The nickname list is a separate file and auto-generates one if file is not found. Unsure how old script is as I put it on GitHub also with more updates.
__________________

Last edited by DJEarthQuake; 03-09-2024 at 09:30. Reason: paraphrase
DJEarthQuake 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 05:32.


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