Posts: 2,136
Threads: 50
Joined: Jun 2010
I have another script request, which is unusual for me. Could someone help me disconnect immediately when a vote for a specific map passes, please? Bonus points for editable config file of maps. Maybe even stick in a "gg; nty..." in there.
Posts: 108
Threads: 8
Joined: Dec 2010
22 Feb 14, 11:48PM
(This post was last modified: 22 Feb 14, 11:50PM by Thrawn.)
I could, but I'd probably have to use tools.cfg, which is intended for 1104, and possibly buggy in 1202 (also, it seems to throw errors sometimes). Unless.. Has anyone updated it for the latest version?
Also, doing it the way I'm thinking of.. there exists the possibility of other people exploiting your script and causing the script to fire, when you don't want it to..
Posts: 1,039
Threads: 77
Joined: Jun 2010
I tried to make:
/onNewMap [ if (= (curmap) ac_douze) [ disconnect; joinservermenu ] ]
But that didn't work for me. I don't know how to use these new "on****" aliases.
Posts: 101
Threads: 2
Joined: Sep 2011
A dev who can't write code should not be a dev. That is why ac is dead.
alias vote_map_list [
"ac_douze say eaeaee; sleep 500 [ disconnect ]"
"ac_shine say Im to noob for this map; sleep 500 [ disconnect ]"
"ac_raptrap I dont understand how this shi**y map is official; sleep 500 [ disconnect ]"
]
alias last_voted_type [ 0 ]
alias last_voted_map [ 0 ]
alias map_commands [ 0 ]
alias map_commands_flag [ 0 ]
alias onCallVote [
last_voted_type = $arg1
if (= $arg1 7) [
last_voted_map = (format "%1" $arg3)
]
]
alias run_map_commands [
looplist $vote_map_list lemap [
if (strcmp (at $lemap 0) $last_voted_map) [
map_commands = (substr $lemap (strlen $last_voted_map))
map_commands_flag = 1
break
]
]
]
alias onVoteEnd [
// unfortunately u cant determine if the vote passed or failed
if (strcmp $conline "vote passed") [
if (= $last_voted_type 7) [
echo (format "vote for map %1 passed" $last_voted_map)
run_map_commands
]
]
]
//
alias check_map_command_loop [
if (= $map_commands_flag 1) [
execute $map_commands
map_commands_flag = 0
]
sleep 250 [ check_map_command_loop ]
]
if (! (strstr $mapstartalways check_map_command_loop)) [
add2alias mapstartalways [ sleep 250 [ check_map_command_loop ] ]
]
Posts: 2,067
Threads: 11
Joined: Jun 2010
23 Feb 14, 03:17AM
(This post was last modified: 23 Feb 14, 03:21AM by Orynge.)
Uh, RK and jamz aren't in the dev team for coding. RK does packages and jamz manages server/blacklist stuff. :|
(among other things, but coding isn't one of them)
Posts: 1,331
Threads: 44
Joined: Jun 2010
23 Feb 14, 03:22AM
(This post was last modified: 23 Feb 14, 03:45AM by Bukz.)
For real, kinda harsh there.
Jamz, you're looking for something like onCallVote, but I don't know for sure if its possible to do what you're looking for with it. I'll look into it more and report back.
Randum you're a bit off, that onNewMap alias is executed everytime the /newmap command is, not really what jamz is looking for here.
Edit:
Maybe try something like:
[cubescript]checkinit onCallVote [
btp = $arg1
bcn = $arg2
bmp = $arg3
if (&& (= $btp 7) (strcmp $bmp ac_douze)) [
say "lol no ty noobs"
sleep 1000 disconnect
]
][/cubescript]
Edit #2: Thats not at all on vote pass. I'm stupid. Maybe just change it to "onVoteEnd" ;)
Posts: 205
Threads: 6
Joined: Oct 2012
23 Feb 14, 03:44AM
(This post was last modified: 23 Feb 14, 04:00AM by TheNihilanth.)
Nice fence script.
This could come in fence handy.
No need to shotthrupickups be harsh.
Posts: 1,331
Threads: 44
Joined: Jun 2010
Posts: 1,039
Threads: 77
Joined: Jun 2010
(23 Feb 14, 03:11AM)Jpablon Wrote: A dev who can't write code should not be a dev. That is why ac is dead.
You're a dick and I should ban you, but that hasn't had me do so, has it.
Posts: 1,039
Threads: 77
Joined: Jun 2010
(23 Feb 14, 03:22AM)Bukz Wrote: Randum you're a bit off, that onNewMap alias is executed everytime the /newmap command is, not really what jamz is looking for here.
*updates docs*
Posts: 2,136
Threads: 50
Joined: Jun 2010
I'm pleased to see no-one could just shoot through a simple answer on this one, but I can pick up some ideas. Are we missing an obvious command here? Perhaps we should fence this thread off for future reference.
Posts: 1,039
Threads: 77
Joined: Jun 2010
23 Feb 14, 11:26AM
(This post was last modified: 23 Feb 14, 12:11PM by RandumKiwi.)
Bro, Jamz, don't throw a hizzy! I've got your back, I just needed some time to work through this and debug:
// Disconnect on map vote:
onVoteEnd = [ sleep 500 [
// Sleep allows the client to change map, so that (curmap 1) works properly.
disconnectmaps = [ map1 map2 ]
// Space delimited list of maps that we don't like.
n = (listlen $disconnectmaps)
// How many maps are there in the disconnectmaps alias?
loop i $n [
// Loop as many times as there are maps, as found out above.
discmapname = (at $disconnectmaps $i)
// Each loop, pull the next map from the disconnectmaps list.
if (strcmp $discmapname (curmap 1)) [
// Then, compare it to the current map.
say "Hmm, bad map choice..."; sleep 500 [ disconnect; joinservermenu ]
// then if the current map matches the list, leave the server and show the server menu.
]
]
] 1 // Required: This makes the first sleep ignore any map changes.
]
NOTE: I worry that the sleep for (curmap 1), as commented in this script, might not always work (I'm sure it will, but there's that little bit of doubt that it might not). It would be much better, to remove the need for sleep, and instead have this run as a onMapLoad alias, if that did exist (which it doesn't).
Jpablon: Your code is overly complex.
Posts: 1,331
Threads: 44
Joined: Jun 2010
Theres always mapstartonce and mapstartalways.
Posts: 2,136
Threads: 50
Joined: Jun 2010
(23 Feb 14, 11:26AM)RandumKiwi Wrote: Bro, Jamz, don't throw a hizzy! I think you missed my point
(23 Feb 14, 02:38PM)Bukz Wrote: Theres always mapstartonce and mapstartalways. It has to be before the maps starts, to avoid getting the irrelevant crap uploaded by shitty akimbo 'administrators'.
Posts: 101
Threads: 2
Joined: Sep 2011
(23 Feb 14, 11:26AM)RandumKiwi Wrote: ...
Jpablon: Your code is overly complex.
I had no idea about persistent sleeps.
alias vote_map_list [
"ac_douze say eaeaee; sleep 500 [ disconnect ] 1"
"ac_shine say Im to noob for this map; sleep 500 [ disconnect ] 1"
"ac_raptrap say I dont understand how this shi**y map is official; sleep 500 [ disconnect ] 1"
]
alias last_voted_type [ 0 ]
alias last_voted_map [ 0 ]
alias onCallVote [
last_voted_type = $arg1
if (= $arg1 7) [
last_voted_map = (format "%1" $arg3)
]
]
alias onVoteEnd [
if (&& (strcmp $conline "vote passed") (= $last_voted_type 7)) [
looplist $vote_map_list lemap [
if (strcmp (at $lemap 0) $last_voted_map) [
execute (substr $lemap (strlen $last_voted_map))
break
]
]
]
]
There was not a big difference between having fences or not, I used to have a large percentage of unhits anyway.
Posts: 1,039
Threads: 77
Joined: Jun 2010
23 Feb 14, 07:42PM
(This post was last modified: 23 Feb 14, 07:45PM by RandumKiwi.)
(23 Feb 14, 02:38PM)Bukz Wrote: Theres always mapstartonce and mapstartalways.
Cheers:
// Disconnect on map vote:
mapstartalways = [
autodownload 0
autogetmap 0
// Turn-off auto-map download features. Jamz will getmap manually.
disconnectmaps = [ camper ]
// Space delimited list of maps that we don't like.
n = (listlen $disconnectmaps)
// How many maps are there in the disconnectmaps alias?
loop i $n [
// Loop as many times as there are maps, as found out above.
discmapname = (at $disconnectmaps $i)
// Each loop, pull the next map from the disconnectmaps list.
if (strcmp $discmapname (curmap 1)) [
// Then, compare it to the current map.
say "Hmm, bad map choice..."; sleep 0 [ disconnect; joinservermenu ]
// If the current map matches the list, say something, sleep to allow the
// message to be sent, then leave the server and show the server menu.
]
]
]
Posts: 1,331
Threads: 44
Joined: Jun 2010
For the love of bukz start using checkinit, its the same thing but better. :p
Posts: 1,039
Threads: 77
Joined: Jun 2010
28 Feb 14, 11:08AM
(This post was last modified: 28 Feb 14, 11:09AM by RandumKiwi.)
(28 Feb 14, 10:29AM)Bukz Wrote: For the love of bukz start using checkinit, its the same thing but better. :p
Thanks for not showing us the relevance.
Posts: 1,438
Threads: 54
Joined: Jun 2010
(28 Feb 14, 10:29AM)Bukz Wrote: For the love of bukz
Awwwwwwwwwwww
Posts: 1,331
Threads: 44
Joined: Jun 2010
Using alias = value forcibly overwrites an alias. checkinit won't overwrite it if it already exists, it will just inject the code.
|