Raised This Month: $7 Target: $400
 1% 

Solved Add XP/skill to players name


Post New Thread Reply   
 
Thread Tools Display Modes
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-19-2019 , 10:11   Re: Can't figure this out :)
Reply With Quote #21

May want to consider something simpler, like a HUD on the left or right side of the screen that shows all players and their skills. This would be easy to implement, and you can do things like show only alive players, show only team-mates, etc.

Also, my above code did not account for setting skill if the name already had the skill in it, I assumed you were handling this somehow. I know your problem is solved but you can use this as a backup if needed. I also added the ability to easily customize how the skill is displayed, see szSkillPrefix[] and szSkillSuffix[]. This is what encloses the skill at the end of the players name.
PHP Code:
public SetSkillInNameid szOutput[] , maxchars )
{
    new 
iNameLen szSkill10 ] , iSkillLen iSetPos Float:fSkill iBracketStart iBracketEnd iBracketSize;
    new const 
szSkillPrefix[] = " [ ";
    new const 
szSkillSuffix[] = " ]";
    
    
iNameLen get_user_nameid szOutput maxchars );
    
iBracketStart strfindszOutput szSkillPrefix );
    
iBracketEnd strfindszOutput szSkillSuffix , .pos=iBracketStart charsmaxszSkillPrefix ) );
    
iBracketSize charsmaxszSkillPrefix ) + charsmaxszSkillSuffix );
    
    if ( ( 
iBracketStart > -) && ( iBracketEnd > -) && ( ( iBracketEnd charsmaxszSkillSuffix ) ) == iNameLen ) )
        
iNameLen iBracketStart;
    
    
get_user_skillid fSkill );
    
iSkillLen formatexszSkill charsmaxszSkill ) , "%0.2f" fSkill );
    
iSetPos = ( ( iNameLen iSkillLen iBracketSize ) > maxchars  ) ? maxchars - ( iSkillLen iBracketSize ) : iNameLen;
    
    return 
formatexszOutputiSetPos ] , maxchars iSetPos "%s%s%s" szSkillPrefix szSkill szSkillSuffix );

__________________

Last edited by Bugsy; 01-19-2019 at 11:35.
Bugsy is offline
deprale
Senior Member
Join Date: Oct 2018
Location: Leeds
Old 01-22-2019 , 08:20   Re: Add XP/skill to players name
Reply With Quote #22

Sorry for reviving a dead topic, just wanted to thank you again Bugsy, I will indeed use it in warmup mode, I will still stick to the name thingy when a match is in progress even tho its buggy at times I've managed to find a fix for my issue, and here's how I did it. (I used to pause the points plugin via my PUG plugin upon map change but then figured out that it just bugs and corrupts a lot of data in the process thus the 0.00 SKILL players must be removed manually from the DB)

(FOR ANYONE WHO - LIKE ME - IN THE FUTURE WILL NEED THIS) -> I found an easy quick fix to my Database problem and the [0.00] skill displayed in the name thing ->

Just make it so the plugin requires a certain flag before adding any points (ELO) for the player, let's just say ADMIN_LEVEL_H (flag "t" in my case), I remove it upon connect with the PUG plugin (private) and assign it via my pug plugin once the match is in progress, when it ends, I remove the flags again and here we go, no bugs whatsoever, working fine and perfectly! But to achieve this you'll have to edit the original AES cstrike to require whichever flag you want the player to have to be able to get any points at all. Overall it is a much better fix than just pausing the plugin as I did!
One small thing also: nicknames cannot contain special characters like fancy letters and stuff, because it will still not work even though in the database the name works fine it will corrupt half of your table and you should either implement something that restricts those player names(I've tried some things on my own, didn't succeed, by just changing their nickname and if they refuse I just ban them).
__________________

Last edited by deprale; 01-22-2019 at 08:23.
deprale is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 01-22-2019 , 10:56   Re: Add XP/skill to players name
Reply With Quote #23

Quote:
(I've tried some things on my own, didn't succeed, by just changing their nickname and if they refuse I just ban them).
Sounds like a terrible solution.
__________________
HamletEagle is offline
Airkish
AlliedModders Donor
Join Date: Apr 2016
Location: Lithuania
Old 01-22-2019 , 11:09   Re: Add XP/skill to players name
Reply With Quote #24

Quote:
Originally Posted by deprale View Post
One small thing also: nicknames cannot contain special characters like fancy letters and stuff, because it will still not work even though in the database the name works fine it will corrupt half of your table and you should either implement something that restricts those player names(I've tried some things on my own, didn't succeed, by just changing their nickname and if they refuse I just ban them).[/B]
Did you set connection charset to utf8?

PHP Code:
SQL_SetCharset(g_SqlTuple,"utf8"); 
__________________
Airkish is offline
deprale
Senior Member
Join Date: Oct 2018
Location: Leeds
Old 01-22-2019 , 12:05   Re: Add XP/skill to players name
Reply With Quote #25

Quote:
Originally Posted by Airkish View Post
Did you set connection charset to utf8?

PHP Code:
SQL_SetCharset(g_SqlTuple,"utf8"); 
By reading the official CSS_STATS_SQL topic I have found that you MUST use 1.8.3> to be able to use utf8.

Quote:
Originally Posted by HamletEagle View Post
Sounds like a terrible solution.
What I meant by that, is that there are some people aware of that, and they do it on purpose, so I just ban them.
And by some things I have tried out I meant by checking their name on connect and if the char ascii number was higher than 128 I would simply just replace it with a space, didn't work at all, the worst solution I found is to make an enum of every single keystroke on my keyboard and loop through each of the char in the player's name to see if it was found, if not, replace it with an empty space, ofc I thought that would be the worst solution overall and that it wasn't practical because of the lag it would generate if let's say 10 people connect at once with illegal chars.
__________________

Last edited by deprale; 01-22-2019 at 12:09.
deprale is offline
Reply


Thread Tools
Display Modes

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:12.


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