Hey peeps,
I am trying to sort out a user freindly interface for voting in MOHAA.
I have made a simple voting tool in a .pk3 file which works perfectly when installed client side.
The mod uses not custom pics/sounds/files etc, just a simple coloured pop up box similar to this... http://medalofhonor.filefront.com/file/MOHAA_Tools;6443
Bassically what it does is bind F9 key to bring up a popup box with clickable commands.
So my question is can the mod be turned into a server side mod?, allowing all clients to the sever to utilise the feature.
I guess I need to know if a server side mod can force clients key bindings? or do I need to go about it in a different way?
Cheers in Advance,
AJ
Server Side Voting Mod
Moderator: Moderators
-
@(...:.:...)@
- Corporal
- Posts: 37
- Joined: Wed Nov 23, 2005 3:42 pm
- Location: Cambridge UK
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:
note that you cannot use quote marks inside the stufftext string, as that would make the script end the string half way through.
eg:
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 ;)
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:
Code: Select all
locla.player stufftext "say hi"
You can also bind stuff:
Code: Select all
local.player stufftext "bind d +attack"
eg:
Code: Select all
local.player stufftext "bind b "say hi my name is bob!""
"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 ;)

<3 arrays.
I did this mod a short time ago. back on TMT.
Called it AA Democracy. Made with trig menus, and state files.
http://files.filefront.com/AA_Democracy ... einfo.html
was my first mod with custom states
install it like normal and to open the menu press fire and use at the same time. Then u movement determines which buton on the menu u select.
so if it says [Move forward] Change Map
then if u move forward then it brings open the change map menu.
it also has 2 keys bound to vote yes and no but i 4got which. if u open it up youll see.
i forgot i made this mod
i never got around to using it cause it has a big custom state changes. combining the many i have would take a while/
EDIT
the way i did it is the way hal mentioned basically. One thing i could not ad was vote to kick.
Called it AA Democracy. Made with trig menus, and state files.
http://files.filefront.com/AA_Democracy ... einfo.html
was my first mod with custom states
install it like normal and to open the menu press fire and use at the same time. Then u movement determines which buton on the menu u select.
so if it says [Move forward] Change Map
then if u move forward then it brings open the change map menu.
it also has 2 keys bound to vote yes and no but i 4got which. if u open it up youll see.
i forgot i made this mod
EDIT
the way i did it is the way hal mentioned basically. One thing i could not ad was vote to kick.
AJ gives me an idea, something I have wanted to provide my clan is a lower level of rcon - more like a vote, but just for the clan members.
e.g. vote options for clan members
kick player -
next map -
gametype -
restart -
maybe specific maps?
Is it possible to have a download just for clan members to enable these types of options? and just recognize clan members in the vote tally?
doesn't need to be server side.
e.g. vote options for clan members
kick player -
next map -
gametype -
restart -
maybe specific maps?
Is it possible to have a download just for clan members to enable these types of options? and just recognize clan members in the vote tally?
doesn't need to be server side.
The tool can be completley customized, If you don't mind your clan members having rcon access, you just need to adjust the functions to suit yourself.
This is the voting_tool I came up with...
http://www.zshare.net/download/voting_tool-pk3.html
I still haven't able to figue out how to make this a server-side mod, but will keep trying...
This is the voting_tool I came up with...
http://www.zshare.net/download/voting_tool-pk3.html
I still haven't able to figue out how to make this a server-side mod, but will keep trying...
Viper wrote:AJ gives me an idea, something I have wanted to provide my clan is a lower level of rcon - more like a vote, but just for the clan members.
e.g. vote options for clan members
kick player -
next map -
gametype -
restart -
maybe specific maps?
Is it possible to have a download just for clan members to enable these types of options? and just recognize clan members in the vote tally?
doesn't need to be server side.
http://software.tatakai.co.uk/TSS.shtml

