Results 1 to 7 of 7

Thread: player command am i going in the right direction

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Global Mossaderator Mitch's Avatar
    Join Date
    Nov 2012
    Posts
    654
    Thanks
    204
    Thanked 450 Times in 305 Posts
    You could cache the stripped player name with this callback and on connect:

    PHP Code:
    CodeCallback_UserInfoChanged(clientNum)
    {
        
    oldname self.name;
        
    name self get_userinfo("name");

        
    self clientuserinfochanged();

    This is how I remove the color tags and spaces:
    PHP Code:
    stripColorsAndSpaces(t)
    {
        if(!
    IsSubStr(t"^") && !IsSubStr(t" "))
            return 
    t// colorless spaceless text
        
        
    "";    
        for(
    i=0;i<t.size;i++)
        {
            if(
    t.size i+&& t[i] == "^" && t[i+1] == "^" && isInt(t[i+2]) && isInt(t[i+3]))
                
    += 3// skip ^^xx
            
    else if(t.size i+&& t[i] == "^" && isInt(t[i+1]))
                
    += 1// skip ^x
            
    else if(t[i] != " ")
                
    += t[i]; // append text
        
    }
        
        return 
    n;
    }

    isInt(char)
    {
        
    asc getAscii(char);
        return 
    asc >= 48 && asc <= 57;


  2. The Following User Says Thank You to Mitch For This Useful Post:

    Blutus (21st September 2023)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •