Hi :-)
You can force key bindings with the stufftext script command.
It sends the text you specify to the clients console, as if they had enterd it.
eg:
would make the player say hi.
You can also bind stuff:
Code: Select all
local.player stufftext "bind d +attack"
note that you cannot use quote marks inside the stufftext string, as that would make the script end the string half way through.
eg:
Code: Select all
local.player stufftext "bind b "say hi my name is bob!""
would send to the client:
"bind b"
because the script thinks the string has ended as soon as it finds the second quote sign.
This also means that stufftext is more limited than actualy being at the console to type in your own commands.
If I remember right, you can't use the ";" command to sepearate commands when stufftexting.
You will not be able to make your menu server side however. Textures and ui files cannot be transferd to the client when they connect, so the client would have to download the mod themself.
You can stufftext "globalwidgetcommand" which allows you to modify exisiting menus with a unique name. I think you can only use that to display text and textures, I don't think you can make buttons to click with it.
If you have time to spare, it is possible to make a voting system server side without using MoHAA's voting system at all.
You would have to know allot about state files to do this, but it could be done like this:
1)
Define a string of commands a player could do to start voting.
Eg, it could be jump, bash, jump, crouch. You can detect strings of actions with state files by execing a script each time a player makes an action, recording which it was. YOu could then check if the player had done a certian string of actions.
I would assign a number to each command, (eg jump is 1, crouch is 2, bash is 6).
Then as your script detects functions used, it adds the last 4 numbers to a string. For example,
for jump, bash, jump, crouch you would get the string:
"1612" You could then compare that against an array of known 'codes' to see if a player has done a spesific action.
It might be best to do this with letters rarther than numbers, otherwise you are limited to 10 commands, before you have to start using 10,11 etc. That would require a bit more complex management of the string.
2) Ok, so you can detect when a player wants to vote now. Now you need to force them into a new state to record their choices more eaysily.
Using globalwidgetcommand (talk to sorridstroker about this) you would display text on the screen with instructions.
The menu text would change depending on if there was a vote taking place or if there wasent you could call a new vote.
In your new state, it would be easy to make jump or move left/right etc into a chose to eg chose vote to change map. When you do that, a new state is forced, and you get a list of maps to chose from.
When you chose one, a message is put up using huddraw showing the map and the % who have voted for or against.
Once 50% of players have voted for or against, the vote either ends or does whatever the vote was for.
As you no doubt noticed, this is allot of work, and tbh if you realy want voting, I would just play sh or bt which already have an exelent voting system. you can customize the choices server side, and it has a menu for players to use.
Cya ;)