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.
Announcement
Collapse
No announcement yet.
Possible to have a coop server auto restart when 'end' has been won?
Collapse
X
-
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"); };
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
-
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"); };
Code:vote_command ();
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"
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
-
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
-
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"); };
Code:void() StartFrame = { teamplay = cvar("teamplay"); skill = cvar("skill"); framecount = framecount + 1; vote_command(); };
-r0t.uk- cOOp - Mapvote - r0t.uk:26001
-r0t.uk- DM - Mapvote - r0t.uk:26000
Comment
-
you could do something like
stuffcmd(self,"alias tacos impulse 201\n");
somewhere parse impulse 201 then set temp1 = self.impulse - 200; vote_command();
Comment
-
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"); } };
I shouldn't have assumed.
Last edited by PrimalLove; 09-11-2014, 07:25 PM.
Comment
-
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
-
-
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
-
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
Comment