AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Could this code crash server? (https://forums.alliedmods.net/showthread.php?t=60179)

Miczu 08-28-2007 14:33

Could this code crash server?
 
I made a plug to prewent all players from changing nick in game :mrgreen:
But 2 from 3 servers with this plug got crashed, and last one has some problems (kicing players - svg_bad and other errors :( ). And i need to know, if i could make this problem :oops:

Code:

#include <amxmod>
#include <amxmisc>
new szName[33][36]

public plugin_init() {
        register_plugin("","","")
}

public client_connect(id)
{
        get_user_name(id , szName[id] , 35)
}

public client_infochanged(id)
{
        SetName(id)
}

stock SetName( id )
{
        client_cmd(id , "name ^"%s^"" , szName[id]);
        client_cmd(id , "setinfo name ^"%s^"" , szName[id]);
}

This is all of the code. (sorry for my english).

YamiKaitou 08-28-2007 14:38

Re: Could this code crash server?
 
Code:
#include <amxmod> #include <amxmisc> new szName[33][36]; public plugin_init() {     register_plugin("","",""); } public client_connect(id) {     get_user_name(id , szName[id] , 35); } public client_infochanged(id) {     client_cmd(id , "name ^"%s^"" , szName[id]);     set_user_info(id,"name",szName[id]); }

That should work just fine

Miczu 08-28-2007 14:56

Re: Could this code crash server?
 
Thenks YamiKaitou for help :) I'll use the new code.

But could the old one crash server or make errors?

YamiKaitou 08-28-2007 14:58

Re: Could this code crash server?
 
It might be the client_cmd(id,"setinfo..."); stuff, but I doubt that. It looked perfectly fine to me, I just optimized it a bit

Miczu 08-28-2007 15:06

Re: Could this code crash server?
 
Thx YamiKaitou for all help, karma for you :up:

Miczu 08-28-2007 15:14

Re: Could this code crash server?
 
I was little too fast with karma :wink:

I got unendless message in my console:

Code:

* Privileges set
* Privileges set
* Privileges set
...
* Privileges set
* Privileges set
* Privileges set

End i heven't change nick!

Funny but I heven't got this in old code :mrgreen:

Alka 08-28-2007 15:21

Re: Could this code crash server?
 
1 Attachment(s)
LuLz >.> ... This is the proper way to block name change in game : by VEN!

*Updated*

Miczu 08-28-2007 15:24

Re: Could this code crash server?
 
Alka VEN,s plug will kick players that change nick in game - i want to make it inposible :p by changing nick back to the form from connecting ;)

Alka 08-28-2007 15:31

Re: Could this code crash server?
 
Updated! Now if a player change his name, the name will not be changed, and player is not kicked!

Miczu 08-28-2007 15:42

Re: Could this code crash server?
 
Alka nice, thenks this code it block changing nick :) it's look like i heva never used command "name" lol.

It's great work then i can give you some karma :p


All times are GMT -4. The time now is 16:08.

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