Announcement

Collapse
No announcement yet.

Possible to have a coop server auto restart when 'end' has been won?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #46
    yes you could just type cmd1 155 in the console and get the same result without the alias the alias is just to make it user friendly.

    Comment


    • #47
      ok, well that isn't working. Says 'Unknown command cmd1'

      However if I use temp1 then I don't get that error, but it still doesn't register:

      Code:
      void() vote_command =
      {
          local float command;
      
          command = cvar("temp1");
          bprint(ftos(command));
          bprint("\n");
          //cvar_set("temp1", "0");
      
          if (command)
              bprint("TEST\n");
      
      };
      I tried 'temp1 10' and 'set temp1 10'
      Last edited by slackhead; 09-11-2014, 05:12 PM.

      -r0t.uk- cOOp - Mapvote - r0t.uk:26001
      -r0t.uk- DM - Mapvote - r0t.uk:26000

      Comment


      • #48
        I am not sure what the issue here is but maybe something is wrong in your code. So here is a simplified example. In world.qc near the top place this:


        Code:
        void () vote_command =
        {
        	local float command;
        	command = cvar("temp1");
        	cvar_set("temp1", "0");
        	if (command)
        	   if (command == 1)
                sprint(self,"TEST\n");
        		else
        		sprint(self,"unknown command\n");
        	    
        };
        And place this at the bottom of StartFrame in world.qc:

        Code:
        vote_command ();
        No need for "set temp1 1" because this is a builtin.

        That is it. Basically when you enter the server you'll be able to type temp1 "1" and it will send you a sprint to self letting you know the command works. Now type anything else besides one like temp1 "3" and it will kick back an unkown command sprint. Now if you want you can make an alias for it by typing this in the console:

        Code:
        alias test "temp1 1"
        Now you can just use test. So this is as simple as I can make it. This should work no question. I am not sure about why you are getting the unknown command error if you are doing it like this. Maybe post whatever code you were using? I suppose I was confusing with the use of cmd1 but I had forgotten about the temp1 builtin for mods. So my apologies if it has been confusing you. My instructions are not always well thought out.

        Obviously most of the code I send assumed using arrays and additional functions to set up alias to the client machines using a call to stuffcmd. But for testing this will show you that they at least work.

        Comment


        • #49
          No output at all :/

          -r0t.uk- cOOp - Mapvote - r0t.uk:26001
          -r0t.uk- DM - Mapvote - r0t.uk:26000

          Comment


          • #50
            Wha? Remember sprint will not automatically print to the console until you press ~ and go back to console again. But you don't need to use sprint. It was just an example. I have no idea why you aren't getting an output but show your code and I'll check. Something simple must be wrong. Are you just not getting an output or actually getting an error?

            Comment


            • #51
              No output at all

              -r0t.uk- cOOp - Mapvote - r0t.uk:26001
              -r0t.uk- DM - Mapvote - r0t.uk:26000

              Comment


              • #52
                lemme see the code.

                Comment


                • #53
                  Code:
                  void () vote_command =
                  {
                      local float command;
                      command = cvar("temp1");
                      cvar_set("temp1", "0");
                      if (command)
                         if (command == 1)
                          sprint(self,"TEST\n");
                          else
                          sprint(self,"unknown command\n");
                      
                  };
                  and

                  Code:
                  void() StartFrame =
                  {
                      teamplay = cvar("teamplay");
                      skill = cvar("skill");
                      framecount = framecount + 1;
                      vote_command();
                  };
                  I copy/pasted yours.

                  -r0t.uk- cOOp - Mapvote - r0t.uk:26001
                  -r0t.uk- DM - Mapvote - r0t.uk:26000

                  Comment


                  • #54
                    you could do something like
                    stuffcmd(self,"alias tacos impulse 201\n");
                    somewhere parse impulse 201 then set temp1 = self.impulse - 200; vote_command();
                    www.quakeone.com/qrack | www.quakeone.com/cax| http://en.twitch.tv/sputnikutah

                    Comment


                    • #55
                      Ah ok. I made the assumption you were testing this locally. Here ya go use this instead for a quick test to get an echo.

                      Code:
                      void () vote_command =
                      {
                      	local float command;
                      	command = cvar("temp1");
                      	cvar_set("temp1", "0");
                      	if (command)
                      	   if (command == 1)
                      	   {
                                      localcmd("echo ");
                      		localcmd("TEST");
                      		localcmd("\n");
                      	   }
                      	  else
                      	   {
                      		localcmd("echo ");
                      		localcmd("unknown command");
                      		localcmd("\n");
                      	   }
                      	    
                      };
                      Everything else is the same. The other code only works if you are the local server (IN DP anyway). Otherwise it is trying to send the command to a non-client. :/ LOL! So this will work. You could also use that custom localcmd function from earlier here if you want to clean this up a bit. But this will echo test or unknown command depending on the situation. This works because now we are sending a localcmd to the server that is actually using the command. Make sense? Before it was assuming self and it couldn't find a self because it runs that code in world.qc. If it had been running in Postthink or similar self would have applied. Hope that makes sense. Sorry bout that. I shouldn't have assumed.
                      Last edited by PrimalLove; 09-11-2014, 07:25 PM.

                      Comment


                      • #56
                        Great, that prints in the server console

                        Still not sure why bprint() doesn't work though... I'd probably want to use that at some point to let players know that a vote has started

                        -r0t.uk- cOOp - Mapvote - r0t.uk:26001
                        -r0t.uk- DM - Mapvote - r0t.uk:26000

                        Comment


                        • #57
                          @r00k

                          Yes ideally he would set up all the additional other aliases for say his voting impulse, etc. using a stuffcmd to the client when they first connect. But I think right now he is just trying to get the proof of concept working from earlier.

                          Comment


                          • #58
                            Originally posted by PrimalLove View Post
                            This works because now we are sending a localcmd to the client that is actually using the command.
                            Still not seeing anything in the local client console

                            -r0t.uk- cOOp - Mapvote - r0t.uk:26001
                            -r0t.uk- DM - Mapvote - r0t.uk:26000

                            Comment


                            • #59
                              Arg. It still isn't working. When I checked it I up-arrowed to the last command, which was an rcon command... (I tested rcon earlier to see what would happen)...

                              I think r00k is right and I'd have to use an impulse to set it or some such.

                              -r0t.uk- cOOp - Mapvote - r0t.uk:26001
                              -r0t.uk- DM - Mapvote - r0t.uk:26000

                              Comment


                              • #60
                                Looking at and testing it, command never resolves to anything but 0. I think that the client isn't sending the var temp1 to the server. Maybe that's why so many of the tutorials I've looked at use impulse...

                                -r0t.uk- cOOp - Mapvote - r0t.uk:26001
                                -r0t.uk- DM - Mapvote - r0t.uk:26000

                                Comment

                                Working...
                                X