AMX Mods

LukeW

New Adventurer
Joined
Feb 24, 2005
Messages
56
Reaction score
0
any hints on how to make a simple votemap plugin, where people say "votemap *mapname*" and it pops up with a simple yes or no vote, for option 4 or 5 (since 1 2 and 3 are already bound?)
 

Thothie

Administrator
Staff member
Administrator
Moderator
MSC Archivist
Joined
Apr 8, 2005
Messages
16,342
Reaction score
326
Location
lost
I removed the map voting plugin from the AMX I distributed for two reasons. 1) I didn't want people warping all over the new world willy nilly, and 2) The menu system don't work so good. The MSC guys did something to the keyboard layout, or somethin - makes all the menu keys switch to one key over (except for #1 - which I think just becomes completely inaccessible).

What I intended to do was 1) Fix that menu system, and 2) Make it so you could only vote for adjacent and/or custom maps. The first part of that, I've not managed to figure out how to do.

As such, unless you can figure how to tweak the menufront.sma to work with MSC, I think you are down to text response map voting. ie. someone starts a vote, and everyone else types out "yes" or "no". :\
 

LukeW

New Adventurer
Joined
Feb 24, 2005
Messages
56
Reaction score
0
Text response would be great, but with the goofy MSC say functions, how do I get something like that to work =\
 

Thothie

Administrator
Staff member
Administrator
Moderator
MSC Archivist
Joined
Apr 8, 2005
Messages
16,342
Reaction score
326
Location
lost
Normally, you'd capture the say event and read in the arguments. I suppose in MSC, you'd capture the "say_text" event , and read in the arguments.

For instance:
Code:
public plugin_init() { 
 register_clcmd("say_text","myVoteTallySub") 
} 

public myVoteTallySub(id) { 

 new text[64];  
 read_args(text,63);  

 if ( contain(text,"yes") > -1 ) { 
   voteTally++;
 }

}

You can get the current map, to determine which maps are available with the " get_mapname" command.

For instance:
Code:
 new map[33];
 new votableMaps[255];
 get_mapname(map, 32);
 //one if for each map 
 if ( contain(map, "helena") > -1 ) { 
   votableMaps="keledrosprelude daragoth thornlands";
 }

 new text[64];  
 new startedMapVoteFlag[1];
 startedMapVoteFlag[0] = 0;
 read_args(text,63);  

 if ( contain(text, "votemap") >-1 ) {
   //one if for each map
   if ( contain(text, "daragoth") > -1 & contain(votableMaps,"daragoth" > -1 ) {
     myStartVoteSub();
     startedMapVoteFlag[0] = 1;
   }

 if ( startedMapVoteFlag[0] == 0 ) {
   client_print(id, print_chat, "You may only vote for the following maps:");
   client_print(id, print_chat, "%s", voteableMaps);
  }
 }

This assumes the syntax of the vote command is "votemap mapname" in chat.

Granted, this sort of approach would require global variables, and I've yet to make a plugin that uses them, so I'm uncertain as to how they function in Small, but the theory is sound. ;) Worst case scenerio, you could use a server cvar to store the vote status and tally.
 

LukeW

New Adventurer
Joined
Feb 24, 2005
Messages
56
Reaction score
0
I ended up just going through the AMX vote plugin and changing the permissions so votemap was useable by all, and switching Yes and No answers (1 is no, 2 is yes, as 2key chooses option one, which is ACTUALLY yes, and 1 key closes it. so it works.) Genius, no?
 

Thothie

Administrator
Staff member
Administrator
Moderator
MSC Archivist
Joined
Apr 8, 2005
Messages
16,342
Reaction score
326
Location
lost
OMGZ, I'm having a Guiness commercial moment, "Brilliant!"

You should upload your changes to the SMA! (I'm still not sure what keys it uses under MSC, exactly)

Although, if I were to add it to mine, I'd still like to filter so it would only allow votes for adjacent maps, root towns, and the first of each custom map series.
 

LukeW

New Adventurer
Joined
Feb 24, 2005
Messages
56
Reaction score
0
AMX has a file maps.ini or whatever, you can set it so it only uses the maps in that file, and maybe have a plugin to write to maps.ini with the adjacent maps with each level change.

About the map vote, I'd love to send you it, but it's really messy, quite embarrasing, just do what I said it's that simple

EDIT: Nevermind that's adminmod, im sure theres a way to do it with AMX though.

EDIT 2: Double edit. Yeah say_text doesnt work, you need the 0 in there after it I don't know how to code that, im total nub to AMX
 

Thothie

Administrator
Staff member
Administrator
Moderator
MSC Archivist
Joined
Apr 8, 2005
Messages
16,342
Reaction score
326
Location
lost
I've not had the chance to experiment yet... Been busy making half-assed plugins for an NS server. But it seems that if the actual command coming in is, for instance, "say_text 0 blah blah blah" - that capturing all the args on any client line beginning with say_text, should work. :\

Hopefully I can find a way to get it to work again, I want my damn server log to capture chat properly again.
 

Thothie

Administrator
Staff member
Administrator
Moderator
MSC Archivist
Joined
Apr 8, 2005
Messages
16,342
Reaction score
326
Location
lost
I'll probably make a thread with a collection of AMX plugins later, as I intend to have a bunch... (and I'll try to keep updating my ms site as well) - but for now, here's the MOTD plugin.

It's built from Papasmurf of TeamHoward's NS /rules plugin. Difference being, it reads from your MOTD.TXT and also dumps the MOTD to console (although, that it does rather sloppily - double spaced and all).

It comes up about 20 seconds after a player connects. It also can be activated manually by players who type "mscmotd" in console. I wanted to trump the standard MOTD command - which reads back the client's motd.txt to his console (instead of the servers), but HL would have none of it, thus we have "mscmotd".

The plugin registers the following server cvars:
mp_displaytime (default "15.0") - time the MOTD displays in seconds
mp_red, mp_green, mp_blue - the red, green, and blue mixcolors of the MOTD text, defaulting to 255.0, 0.0, and 0.0 respectively (ie. pure red text). I should probably rename those - perhaps in a future revision.

Text displays neatly down the left side of the HUD.

Primary purpose of this is to eliminate the need for 10 different flashing imessages and their related scrollers, and just have one complete message with each connect. Less distracting that way.

Two warnings:

1) Those with non-standard trackerscheme.res may have issues seeing longer MOTD's (I myself have fuxed with my trackerscheme.res a great deal trying to make the chat font more legible).

2) Having too large a MOTD.TXT will crash the client. (Can't remember the exact byte size limit, but it's fairly high).

plugin: mscmotd.amx
source: mscmotd.sma.txt

Distribute freely.

I had client call me late this evening or I would have maybe had a that vote plugin at least in beta... As it is now it's still in half-coded concept stage. I'll work on it tomorrow, assuming my current darling doesn't drag me out.
 

LukeW

New Adventurer
Joined
Feb 24, 2005
Messages
56
Reaction score
0
That motd plugin is amazing, it works perfectly. I LOVE it.
EDIT: Can you make it align to the right side instead? where all the player text wont cover it?

the votemap sounds sweet. my personal wishlist:

- Have it trigger from a text command, maybe /votemap 'mapname'
- Have it only load up maps connected to the current map, or towns such as edana and deralia
- Have it kick everyone a fair amount of time before map change, and if its even possible have them reconnect after a delay. (to avoid transition crash)
- Have it yes or no =\ with an adjustable ratio... I just love yes or no's. lol

Ooo and if you succeed in doing all that, gimme a map fix that disables transitions.
 

Thothie

Administrator
Staff member
Administrator
Moderator
MSC Archivist
Joined
Apr 8, 2005
Messages
16,342
Reaction score
326
Location
lost
What I play to do is just have all connceted players automatically "retry" a split second before map change - as only connected players, with characters loaded, cause the map crash.

As for the text alignment, looking at the documentaiton and the related plugin linked through there, it doesn't seem possible (surprsingly). You can, however, move the text over, if you so desire:

I guess you'd change:
Code:
set_hudmessage(red,green,blue, 0.028, 0.125, 2, 0.02,displaytime, 0.01, 0.1, 4)

to:

set_hudmessage(red,green,blue, 0.1, 0.125, 2, 0.02,displaytime, 0.01, 0.1, 4)

To nudge it over a bit. Seems set_hudmessage always aligns left... It may also be possible to make one big long amx_csay message using add and sending the resulting string to csay, but I'm uncertain as to array limitations. (Strings just being number arrays in Small). You *may* be able to get that same effect though just by changeing the sixth number (effects, currently 2) - I think one of the effects patterns is centered, although I'm sure none are right aligned, and I'm uncertain as to which numbers corrispond to which effects. (It *may* match up with the game_text entity.)
 

LukeW

New Adventurer
Joined
Feb 24, 2005
Messages
56
Reaction score
0
I've tried getting players to retry a split second before, and it doesnt work it still crashes. (in my votemap script), so you know. Maybe just disconnect, wait 2 or 3 seconds, then changelevel, and just get everyone to rejoin after map change until it is fixed
 

Thothie

Administrator
Staff member
Administrator
Moderator
MSC Archivist
Joined
Apr 8, 2005
Messages
16,342
Reaction score
326
Location
lost
Bleh... In that case, nasty thought:. the thing that causes it to crash maybe them disconnecting all at once - it has to save all their chars at the same time.

Fudge, in that case the only thing you could do would be to force them to slowly disconnect, one at a time, but I don't see that going well at all.

*sigh* well, here's the beta version of my map voter:

BETA map vote system for MSC:
adminvote.amx
source

I would have prefered to make it a seperate plugin, but I smell possibility of conflict, given all the code borrowed.

This sucker has the following features:
votemap [mapname] - works in console or chat - available to all clients

If no map name is given, or an invalid map name is given, it returns voteable maps, ala picture run from Gatecity:

mscadminvote.jpg
This info also shows up in console as well. (Although, sometimes, due to unpredictable MSC chat returns, it may double up there.)
...and yes, my chat text is THAT effed up. I've tried everything. ><

Anywho... As you can see, it allows voting for root towns, adjacent maps, and custom maps - sadly, atm - these are all hardcoded. Hopefully I'll get it to read from a text file containing a map list later. It is easy to add your custom maps via editing the source though.

I had some weird effing issues getting a string to display properly in chat/console - so there's some odd cut&paste hacks in there to get around that. Code is fairly well commented.

It uses the 1-2 key vote system, reversed as you recommended, it skips the confirmation after vote though (that always seemed to confuse people in MS1.35)

Uses same old cvars, and other functions are unchanged:
* CVARS[defalts]
* amx_votemap_ratio[0.40] % of players that need to vote yes for new map.
* amx_vote_time[10] seconds before vote tallying ends
* amx_vote_time[60] seconds between votes (prevents vote spamming)
* amx_vote_answers[1] set to 0 to make voting anonymous

Now, I assume you used execall to force retry - this plugin at least uses a loop, but I suspect the result will be the same - it must be crashing on the actual mass disconnect.
 

LukeW

New Adventurer
Joined
Feb 24, 2005
Messages
56
Reaction score
0
The mass disconnects isnt what does it, as I've had a plugin that kicked everyone at the same time, and it didnt crash, ever. Maybe to do with the sudden disconnect and then map change. Im sure if you had a long enough pause between the disconnect and map change it would be fine.

On another note, I think my idea of reversing the yes and no doesn't actually work, but seems to when everyone votes yes.

As far as I can tell, it takes however many "yes" votes were made, multiplies that by the votemap_ratio, and then says thats how many were needed. Therefor the vote always passes as long as someone votes. Not 100% positive, but if you'd test that, that'd be good.

Workaround would be, instead of talling yes votes and no votes, and then comparing them, make it jsut tally yes votes and compare with the players in the server. (so abstaining counts as a no)

EDIT: Or, you could try what I tried to do but couldn't. Change all the yes and no keys to SAY "3. Yes" and "4. No" (keeping htem in the same order) but make the keypresses required 2 and 3. ALSO, see if you can move the mapvote menu down a bit, or at least to the right a ways, it always gets covered up by the chat and you cant see whats being voted for.
 

Thothie

Administrator
Staff member
Administrator
Moderator
MSC Archivist
Joined
Apr 8, 2005
Messages
16,342
Reaction score
326
Location
lost
- Moving the menu
Can't be done without editing the menufront.sma as well :\ (Luckily I'm unaffected by that issue, however. Appears well above the text for me, even though it's huge. On mine the votemenu is the same font and size as seen with the 'incoming' game_text in this pic - I'm just telling you this to be a total ass, like everyone has been to me lately, with bugs they don't get that I complain about. :p)

- Vote ratio issues
I can't test this without multiple players. The code looks fine. :\ Despite the number reversal, it should still tally the same, as it's actually receiving the opposite keys as well. Although, if it is behaving that way, it would be benificial for my server at least, as that's the policy I give my admins, 'There must be no objections.'

- Abstaining = no vote
Er... No... Half the point is to allow people to transition when one or more players are AFK. At the default ratio (40%) - if there are three players, and one player is AFK, and two want to change maps - they wouldn't be able to. I'm afraid this must work like RL - if you don't vote, you must go with the flow. ;)

- If mass RETRY wasn't working:
Well... This new one disconnects everyone for about 4 seconds, then they auto-retry. It, however, has NOT been tested multi-player (and I never got to test the older one multiplayer myself), so I cannot promise functionality.

I also tacked on a feature where it writes to the crashed.cfg the NEXT map, just in case it crashes on change despite all this effort.

Same links: adminvote.amx - source

Tell me ASAP if it still crashes on change, even with the disconnect and delayed reconnect, as I'd rather not put players through that if it doesn't do anygood.

Similarly, if you found the old one to work with multiplayer sans crashes, tell me, and I'll roll back to the old method. :|

Oh.. also pvp_arena and pvp_archery are in the custom map list. Remind me to try to make that a cvar in the final. I'd do it now, but I've a feeling the dynamic-string-in-chat issue I keep getting may cause it not to work, and figuring that out is more than I have time left for today.

PS. I'm not sure if it was you or Lord K who edited the thread name... Either way, if we keep this name, the first post in the thread should have a list of all the working (non-beta) AMX mods. As it is now, however, you would have to be the one to maintain the list, being the first poster...

...If you'd rather lay that on me... Rename this thread, "AMX Development Questions" - and I'll make a new thread with a list of working AMX mods.
 

LukeW

New Adventurer
Joined
Feb 24, 2005
Messages
56
Reaction score
0
It was me, I can change it and you can make a new thread if you want. About the map vote, what i was saying is that abstaining does work as it as (just as you described) but the people that vote No technically arent voting no, they are abstaining, and so it just tallies all the yes's, so yes always wins.

EDIT: Feel like sharing you're enhanced helena mod? My server's helena is quite boring.
 

Thothie

Administrator
Staff member
Administrator
Moderator
MSC Archivist
Joined
Apr 8, 2005
Messages
16,342
Reaction score
326
Location
lost
Gah, I thought I put that up there. (ie. my page)

My helena isn't all that more exciting. It has the same % chance for orc invasions, and a 30% chance for the new Bandit raids (which cause most of the merchants to bail). Main advantage to it, is that it's utilitarian - ie, it has a fletcher and a blacksmith (skin buyer) on the premises - so you don't have to go to the even more boring, total dead end that is Edana, everytime some youngin needs to buy arrows or sell skins.

I g2g now... Remind me to put it up when I get back...

As for the thread thing, I guess I'll just have to make a "Thothie's AMX plugins" thread. :\

As for the vote... *sigh* I suspect the only chance for a real solution to all this is to edit the menufront.sma itself (either that, or bypass the vote menu entirely, and have people type in 'yes' or 'no'.) I really need to update the current plugin too (get a cvar for custom map list, that displays to clients, for instance).

The disconnect/reconnect thing seems to be working on my server... But did you ever test the one that just ran Retry? Seems that *should* work. It maybe the map change kicked in before the force Retry did in the older version - as I had a similar issue with the disconnect/reconnect method when I was developing it (server changeing before clients executed script).

PS. Keep your server up! You're the only one with a smooth running [FN] server! I hear your server picks up the "no entities" bug a lot though. I've only managed to make that happen once, so far, and it was a listen server. If you can reproduce it, maybe I can add it to the list... Or at least to the 'hard to reproduce' list. DrKill seems to have taken an honest interest in that list, at least, and I suspect such an odd bug would be his department.

PSS. I should have a new and improved WW series by tomorrow eve.
 

LukeW

New Adventurer
Joined
Feb 24, 2005
Messages
56
Reaction score
0
It does it during map changes sometimes, yes. I don't have the faintest clue where to start.

EDIT: The retry thing does, in-fact, do nothing.
 

Thothie

Administrator
Staff member
Administrator
Moderator
MSC Archivist
Joined
Apr 8, 2005
Messages
16,342
Reaction score
326
Location
lost
Yeah, this 'no entities' bug seems a bit more aggressive than the usual, and totally server-side. About how often do you get it, ya think?

The Helena changes you want are now integrated into the "Spawn Anywhere" map updates, which can be found in the usual place. So just DL that package again. (Clear cache first, if need be)

I can add text messages to transitions that warn players that only one player can transition at a time - if you feel the MOTD doesn't cut it. Seems to be working for me though - I dun see players crash the server from transitions nearly so often since I stuck the message in the MOTD.
 

J-M v2.5.5

BANNED
BANNED
Joined
Feb 26, 2005
Messages
5,675
Reaction score
1
Age
35
Location
Nijmegen, the Netherlands.
I didn't read the entire topic but I think this is the right place to post:

Thothie, there's a bug in your votemap system. You can't vote to thornlands from sfor. And I'm quite sure these two maps are adjacent :oldshock:
 

Thothie

Administrator
Staff member
Administrator
Moderator
MSC Archivist
Joined
Apr 8, 2005
Messages
16,342
Reaction score
326
Location
lost
Code:
  if ( contain(map,"sfor") > -1 ) { client_print(id, print_chat, "Adjacent Areas: calruin challs"); }

Oops. :oops:

Thanks, tis why its still BETA map vote ;), added to list of things to fix...
 

Thothie

Administrator
Staff member
Administrator
Moderator
MSC Archivist
Joined
Apr 8, 2005
Messages
16,342
Reaction score
326
Location
lost
Did a quick fix on the above, for admin vote:

Download: Beta Mapvote Plugin
View: Beta Mapvote Source

Made cvars more rational and added chat activation for the MOTD (typing 'motd' in chat sends MOTD to calling client).

Download: MSCMOTD Plugin
View: MSCMOTD Source

Not sure when I'll get the chance to rework that adminvote completely. I at least want the custom maps in a cvar, which may cause complications, but in the end, I will need to redo the menufront.sma (...and you are right, with the default fonts, it places the vote prompt right on the chat line)
 

LukeW

New Adventurer
Joined
Feb 24, 2005
Messages
56
Reaction score
0
The players never *never* crash with the new mapvote, it works golden. If you could make the transitions do that, all our problems would be solved (I found out how to get rid of rain and night 100% of the time, email me if you want it. I'll try and put the brightmod in here soon)
 

Thothie

Administrator
Staff member
Administrator
Moderator
MSC Archivist
Joined
Apr 8, 2005
Messages
16,342
Reaction score
326
Location
lost
How'd you pull that off?

Tis one of many plugins I'd like to make, and have not gotten around to... If you can make server command that locks the time at hour X AND stops the rain - you could then drop it into all the underground map.cfg's - and put an end to the stupidity that is underground rain, chirping birds, and lighting changes. Combine all that into one plugin, and yeah, I'd love to have that! Drives me nuts when it rains in Gatecity.
 

Thothie

Administrator
Staff member
Administrator
Moderator
MSC Archivist
Joined
Apr 8, 2005
Messages
16,342
Reaction score
326
Location
lost
Alright... Yet another update for the vote map system...
Sadly, it seems that menufront.sma has nothing to do with it, and the adminvote.sma is totally self-contained. As such, there's very little I can do about the key issues or the menu position without recompiling amx itself. However...

I manage to move the menu down a few notches by adding carriage returns to the vote menu response - and this gets it out of the way of the text with the standard font on my system... and I managed to get to have a yes, and no option, that both register properly... This had to be done in a half-assed, but I guess effective way... The new options are "1. Exit 2. Yes 3. No" - and it seems to work alright so far.

Same links:
Download: Beta Mapvote Plugin
View: Beta Mapvote Source
 
Top