Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: cmd_executestring

  1. #11
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Quote Originally Posted by Ni3ls View Post
    It is in the playercommand callback?
    Code:
    		case "help":
    			self.id=self getEntityNumber();
    			self setClientCvar ("clientcmd", "say !help");
       			self openMenu ("clientcmd");
       			self closeMenu ("clientcmd");
    			wait 1;
    			message = "Available commands: !ratio";
    	 		self thread tellMessage(message);
    			return;
    
            } 
        } 
         
         
        self ClientCommand(); 
    }

    If you execute a cmd_executestring inside codecallback_playercommand but before self clientcommand(), the stuff you send to cmd_executestring will actually be executed by the client on clientcommand() because thats a shared buffer.

    Example inside codecallback_clientcmd:
    Code:
     Cmd_ExecuteString("say hello");
     self clientcmd();
    The result will be:

    Console: hello (globally)
    yournamehere: hello (also globally)
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  2. #12
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,012
    Thanks
    440
    Thanked 171 Times in 132 Posts
    Can't find the solution. If I try to thread after self Clientcommand(); nothing will happen. thread is not loaded. Placing it before self Clientcommand() same result

  3. #13
    Private First Class
    Join Date
    Oct 2013
    Posts
    219
    Thanks
    56
    Thanked 105 Times in 66 Posts
    Quote Originally Posted by Ni3ls View Post
    Can't find the solution. If I try to thread after self Clientcommand(); nothing will happen. thread is not loaded. Placing it before self Clientcommand() same result
    Just do what mitch said;
    PHP Code:
    sendgameservercommand(self getentitynumber(), "h \"" self.name "^7: !help\""); 
    It is better anyway, because you can set a custom server name.

    Example:
    PHP Code:
    sendGameServerCommand(-1"h \"^7Server: Hello world.\""); // -1 = global message 
    Result:
    Code:
    Server: Hello world.
    Edit: Seems like you are already using it, my bad.
    Last edited by filthy_freak_; 30th June 2015 at 15:03.

  4. The Following User Says Thank You to filthy_freak_ For This Useful Post:

    Ni3ls (30th June 2015)

  5. #14
    Private First Class
    Join Date
    Oct 2013
    Posts
    219
    Thanks
    56
    Thanked 105 Times in 66 Posts
    Quote Originally Posted by Ni3ls View Post
    It is in the playercommand callback?
    Code:
    		case "help":
    			self.id=self getEntityNumber();
    			self setClientCvar ("clientcmd", "say !help");
       			self openMenu ("clientcmd");
       			self closeMenu ("clientcmd");
    			wait 1;
    			message = "Available commands: !ratio";
    	 		self thread tellMessage(message);
    			return;
    
            } 
        } 
         
         
        self ClientCommand(); 
    }
    Try this;

    PHP Code:
            case "help":
                
    self.id=self getEntityNumber();
                
    self setClientCvar ("clientcmd""say !help");
                   
    self openMenu ("clientcmd");
                   
    self closeMenu ("clientcmd");
                
    wait 1;
                
    message "Available commands: !ratio";
                 
    self tellMessage(message);
                break;

            } 
        } 
         
         
        
    self ClientCommand(); 
    Also I noticed you are using wait in the playercommand callback. This is a no no.

  6. #15
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,012
    Thanks
    440
    Thanked 171 Times in 132 Posts
    Its working with the sendgameservercommand. Thanks!

Posting Permissions

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