Raised This Month: $ Target: $400
 0% 

Remove Characters


Post New Thread Reply   
 
Thread Tools Display Modes
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-28-2015 , 20:24   Re: Remove Characters
Reply With Quote #11

Just because you aren't using my original function doesn't change the fact that you should provide some context for those who have no idea what you are actually wanting to do. So, explain what you are actually trying to do so that they can help you properly.

Those functions are poorly written BTW (which doesn't surprise me if you got it by p1mp).
__________________
fysiks is online now
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-29-2015 , 18:11   Re: Remove Characters
Reply With Quote #12

Can you give some examples of the names and how you want them to look after getting fixed?

ie.
<lol> bugsy -> bugsy
bugsy <lol> -> bugsy
<123> bugsy <lol> -> bugsy
__________________
Bugsy is offline
pepe_thugs
Senior Member
Join Date: Aug 2010
Location: Portugal , Braga
Old 04-29-2015 , 20:11   Re: Remove Characters
Reply With Quote #13

What I really wanted was some help to make a plugin equal to the p1mp but better written and more optimized and without so many things. But I'm trying to do it gradually and improve some things and remove other plugin made by p1mp. But maybe that's too much to ask if anyone wanted to help me. Regarding the question of this topic I wanted was before starting the game the player can change the name and when the game starts the player's name change to "a." or "b." as does the function I posted but add points after the name and admin is adding another "<A>" after the points. And after changing the name, the player can not change the name more. At the end of the match the server automatically restarts and the players remain on the server to play another game I wanted the code to remove "a." or "b." and points in front of the name to update the points and put the new tag.I did explained myself better. Sorry for my English.

Examples:

Admin:
a. pepethugs <1234><A> -> pepethugs
b. bugsy lol <1232><A> -> bugsy lol

Not Admin:
a. pepethugs <1234> -> pepethugs
b. bugsy lol <1232> -> bugsy lol
pepe_thugs is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-29-2015 , 20:18   Re: Remove Characters
Reply With Quote #14

Ok, so when a player first connects he is "pepethugs". Your plugin will change his name to "pepethugs <1234><A>"?

If yes, then I would store the players name in an array when he first connects so you have a clean copy. This way you do not need to manipulate it in any way to remove certain parts. You can then easily set it to whatever you want throughout the game. You can also prevent him from changing his name.
__________________

Last edited by Bugsy; 04-29-2015 at 20:18.
Bugsy is offline
pepe_thugs
Senior Member
Join Date: Aug 2010
Location: Portugal , Braga
Old 04-30-2015 , 08:24   Re: Remove Characters
Reply With Quote #15

Quote:
Originally Posted by Bugsy View Post
Ok, so when a player first connects he is "pepethugs". Your plugin will change his name to "pepethugs <1234><A>"?

If yes, then I would store the players name in an array when he first connects so you have a clean copy. This way you do not need to manipulate it in any way to remove certain parts. You can then easily set it to whatever you want throughout the game. You can also prevent him from changing his name.

The plugin changes the name to "a. Pepethugs <1232><A>" if he is admin if is normal user will change to "a. pepethugs <1232>".

Doesn't work bugsy. Because when start a new game the plugin restart the server automatic and the players staying at the server, the names are left with "a." and "b." and points in the name and i want to remove before start new match.

Last edited by pepe_thugs; 04-30-2015 at 08:27.
pepe_thugs is offline
GoldBoy1
Junior Member
Join Date: Apr 2015
Old 04-30-2015 , 13:54   Re: Remove Characters
Reply With Quote #16

claudiuhks give you a stock to remove string between two characters . Do you have any prob with it ?
GoldBoy1 is offline
pepe_thugs
Senior Member
Join Date: Aug 2010
Location: Portugal , Braga
Old 05-01-2015 , 19:09   Re: Remove Characters
Reply With Quote #17

Quote:
Originally Posted by GoldBoy1 View Post
claudiuhks give you a stock to remove string between two characters . Do you have any prob with it ?
I dont understand very well the stock and how to use it.
pepe_thugs is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-01-2015 , 23:15   Re: Remove Characters
Reply With Quote #18

Quote:
Originally Posted by pepe_thugs View Post
I dont understand very well the stock and how to use it.
But when the player first joins your server, his name is clean, correct? This can be stored somewhere so it can be retrieved at a later time. This can be handled with timestamps/pruning in nvault.
__________________
Bugsy is offline
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 05-02-2015 , 05:07   Re: Remove Characters
Reply With Quote #19

Quote:
Originally Posted by Bugsy View Post
But when the player first joins your server, his name is clean, correct? This can be stored somewhere so it can be retrieved at a later time. This can be handled with timestamps/pruning in nvault.
or just store the names in a matrix of strings
and update the player id's string every time he changes his name while he's allowed to
then in the end just set the name back to the string
__________________
Meanwhile, in 2050:
Quote:
Originally Posted by aron9forever
useless small optimizations
Quote:
Originally Posted by Black Rose View Post
On a map that is 512x512x128 units you end up with 3,355,443,200,000 different "positions". To store each one of those positions individually in the variable "user_or" you need 12 terabytes of memory.
aron9forever is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 05-02-2015 , 06:45   Re: Remove Characters
Reply With Quote #20

PHP Code:
#include <amxmodx>

new Trie:TrieRestoreNames

public plugin_init()
{
    
TrieRestoreNames TrieCreate()
}

public 
plugin_end()
{
    
TrieDestroy(TrieRestoreNames)
}

public 
client_putinserver(id)
{
    if(
is_user_connected(id))
    {
        new 
TrieKey[32]; IdToString(idTrieKeycharsmax(TrieKey))
        new 
CurrentName[32]; get_user_name(idCurrentNamecharsmax(CurrentName))
        
        
//Save old names into trie -> Must be done before changing names and adding points!
        
TrieSetString(TrieRestoreNamesTrieKeyCurrentName)
    }
}

//Call it when you want to set back player names to what they were
RestoreNames()
{
    new 
Players[32], NumidTrieKey[32], NewName[32]
    
get_players(PlayersNum)
    for(new 
iNumi++)
    {
        
id Players[i]
        
IdToString(idTrieKeycharsmax(TrieKey))
        if(
TrieKeyExists(TrieRestoreNamesTrieKey))
        {
            
TrieGetString(TrieRestoreNamesTrieKeyNewNamecharsmax(NewName))
            
set_user_info(id"name"NewName)
        }
    }
}

IdToString(idBuffer[], Size)
{
    
num_to_str(idBufferSize)

Not sure if I understood fully what you want, but you can try that. Call RestoreNames() when you want to set back old names. This is a possible solution, you may need to do some adjustments depending on the context(e.g. removing the key when a player disconnect)
__________________

Last edited by HamletEagle; 05-02-2015 at 06:48.
HamletEagle 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 22:27.


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