Trivia
Ok this is one for AJAX
I'm looking for an events script that can, when people die whisper the question to them, and this happens for each player in turn, (same question) and then the first correct answer gets a cash reward. I know how to do the player death whispering, the cash reward, however selecting a question from a text file or database and the answer bit I don't have a clue. So ajax can you help me make this? Nat |
okay first of all i don't see why this question is ajax-restricted, but thanks for the shout out. i don't want the responsibility of answering all questions :D
some people have done something similar before (random selection) but i don't remember the threads. basically you use es_rand to generate a random number. then... Quote:
|
AHA cheers ajax
|
What do you mean by "this is not the code" ?? I understand it though and how to write it (I think)
I'm guessing this will have to be a script pack as I need to use the player_say.cfg to get the answers? |
I've got this:
random_question.cfg Code:
setinfo questionnum 0 Nat |
Quote:
Code:
//sample code Quote:
|
An Idea of how to make it more complicated; The more answers they get right the harder they get!
|
Quote:
you could also do something like this Code:
// here's your database Code:
// references your database |
Quote:
|
Quote:
Whenever a player is asked a question, you should store the answer in a userid specific cvar. edit: nvm |
Ok here's my starting blocks that i've made so far, i'm trying to get my head around eventscripts still remember though so any bugs please report ;)
(btw ajax I corrected the variables, that was just adapting some previous coding;)) Ok here goes: (all in a script pack) player_say.cfg Code:
// Trivia commands Code:
es_tell event_var(userid) #lightgreen The trivia question is: server_var(question) Code:
setinfo questionnum 0 |
(By the way, I just want to chime in here to state that I think this is a really neat script idea.)
|
Cheers mattie, found any bugs?
|
Well done.
But I think your missing the line to exec random_question.cfg! Could be in either round_start.cfg or round_end.cfg! edit: or you could just change random_question.cfg to round_start.cfg/round_end.cfg Another thing, you wouldn't want anyone to find out what your default answer is!!! ie. abcdefghij.......890. I suggest es_xsetinfo answer "" because a player cant say nothing! Also.....(last thing i promise, bet ajax's response will be faster than mine lol) any line that has es or es_ at the beginning will not need es_ for any of the other commands down the like. This will help with performance. e.g. Instead of: Code:
if (event_var(text) equalto server_var(question)) then es_tell event_var(userid) #yellow CORRECT ANSWER!!! Code:
if (event_var(text) equalto server_var(question)) then es_xtell event_var(userid) #yellow CORRECT ANSWER!!! |
Quote:
btw here's something i could use and maybe volmasoft could use it too... es_msg_deadonly |
It sounds a great idea, but what concerns me is that for it to be any good, you are going to need hundreds and hundreds of questions and answers, so as they don't repeat over and over again... :?
|
Quote:
and it covers up my shortcomings in ES expansion understanding ;) |
Cheers guys,
Firstly, to ichthys - I hadn't finished the script and the colour isn't a token colour, just a random one to differentiate as I was in a rush. Cheers for the ideas on how to minimise it (you can tell i'm new) I hadn't finished up that's why nothing was there to execute but cheers mate ;) Also thanks about the variable, I didn't know how to clear it so I made it as long as possible i'll edit that now. To ajax cheers for that snippet of code it will make it even better, i'm hoping to have this up and ready for testing before 12pm midnight my time (55 minutes) . This community is so good;) BTW anyone want to come test it on a server? I'm willing to host (UK) or play on someone elses? Nat |
Quote:
|
mcbain, i'm hoping to put together a massive colleciton of questions so if anyone wants to help please add a list to this post and i'll add them, i'll then release it as a script pack hopefully tommorow evening.
As in my last post i'm hoping to be testing before midnight so i'm going to sotp replying and clear up my coding ;) (and make my usual readme files) |
post the ip and ill ping it.
|
I might be able to set a load of questions. If I can, I'll mail them to you. Is there any specific format you would want them in?
|
Quote:
i think i fixed some bugs in your posted code... Quote:
|
Quote:
Cheers ajax, right as usual, every little helps ;) Server i'm suggesting is 84.234.17.36:27015 For questions, I need the format of: question answer question answer Cheers guys for all this help. I'll of course release this tomorrow or as soon as i've got enough questions. |
yeah, latency for me is 250+
|
If u want a diff server suggest it I don't mind ;) (if not then i'll remove the high ping kick for tonight ;))
|
i'm pinging 200. open it up for us tonight.
|
I love matrix fights
|
I'm just running some tests to make sure it works.
I thought i'd done it wrong as it didn't respond a second ago, I forgot to register it in eventscripts ;) |
Currently i'm getting a blank question, any ideas?
|
Quote:
|
roundstart.cfg
Code:
setinfo questionnum 0 Code:
// Trivia commands |
Just noticed another problem, the alive players can say Trivia and get the question, and can therefore guess the answer? I'll take a look at ajax's suggestion about telling dead people.
|
Quote:
Quote:
you've got 6 minutes ;) |
Quote:
I've got around the dead thing, it now has this line. Code:
if (event_var(text) equalto "question") then es_msg_deadonly event_var(userid) #green The trivia question is: server_var(question) |
Quote:
ready or not here we come! |
Currently only selects the same question in round_Start.cfg (see above posts)
It only selects the first question? I'm hoping that my fix of resetting the random number in round_end might work (yet to test) Also the money works great they get the amount, but the money it says that has been given to all of the users misses a 0 from the end which seems odd. Match is delayed hopefully only 20 mins but might be until 1. |
Ok in conclusion.
After the lovely match of spam wars between ajax and ich to get the most money, the var's aren't clearing so i'm going to fix them now ;) |
you could add a var trivia_answered = 0/1
|
hmm, and use if statements? yes it could be done.
However if I can set the question to a random one then there is no way to answer anyway ;) And it's cleaner code. |
All times are GMT -4. The time now is 08:53. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.