AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Mattie's Plugins (https://forums.alliedmods.net/forumdisplay.php?f=71)
-   -   Trivia (https://forums.alliedmods.net/showthread.php?t=38082)

volmasoft 05-26-2005 17:35

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

ajax 05-26-2005 17:51

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:

(this is not code)
if number=1, then question=question1, answer=answer1
if number=2, then question=question1, answer=answer2
if number=3, then question=question1, answer=answer3
etc.
you'll have to write this out explicitly, so no drawing from a database. but the cfg file running this code would essentially serve as your database.

volmasoft 05-26-2005 17:52

AHA cheers ajax

volmasoft 05-26-2005 17:54

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?

volmasoft 05-26-2005 18:01

I've got this:
random_question.cfg
Code:

setinfo questionnum 0
es_rand questionnum 1 2

// Question
if (rsoundnum equalto 1) then es_setinfo question how do you spell hello?
if (rsoundnum equalto 1) then es_setinfo answer hello
if (rsoundnum equalto 2) then es_setinfo question Does this work?
if (rsoundnum equalto 2) then es_setinfo answer dunno

I'm unsure whether the question and answer variables are set correctly, can you tell me Ajax? Do they have to be in quotation marks?
Nat

ajax 05-26-2005 18:04

Quote:

Originally Posted by volmasoft
What do you mean by "this is not the code" ?? I understand it though and how to write it (I think)

i mean if it was code it would look something like this
Code:

//sample code
if (server_var(my_random_number) equalto 3) then es_setinfo my_question_text "how smart is ichy? (a) not very (b) not very (c) not very (d) all of the above"
if (server_var(my_random_number) equalto 3) then es_setinfo my_answer_text "d"

Quote:

I'm guessing this will have to be a script pack as I need to use the player_say.cfg to get the answers?
nothing ever really NEEDS to be a script pack. script packs just allow for easier installation and will work no matter what eventscript_subdirectory is set to.

ichthys 05-26-2005 18:10

An Idea of how to make it more complicated; The more answers they get right the harder they get!

ajax 05-26-2005 18:16

Quote:

Originally Posted by volmasoft
I've got this:
random_question.cfg
Code:

setinfo questionnum 0
es_rand questionnum 1 2

// Question
if (rsoundnum equalto 1) then es_setinfo question how do you spell hello?
if (rsoundnum equalto 1) then es_setinfo answer hello
if (rsoundnum equalto 2) then es_setinfo question Does this work?
if (rsoundnum equalto 2) then es_setinfo answer dunno

I'm unsure whether the question and answer variables are set correctly, can you tell me Ajax? Do they have to be in quotation marks?
Nat

well rsoundnum should be server_var(questionnum) but other than that i'm not sure about the quotation marks.

you could also do something like this
Code:

// here's your database
es_setinfo question1 "blah?"
es_setinfo answer1 "blah"
es_setinfo question2 "blah blah?"
es_setinfo answer2 "blah blah"
es_setinfo question3 "blah blah blah?"
es_setinfo answer3 "blah blah blah"

Code:

// references your database
if (server_var(questionnum) equalto 1) then es_setinfo question server_var(question1)
if (server_var(questionnum) equalto 1) then es_setinfo answer server_var(answer1)

actually you could token your questionnum # into your server_var(question#) if your database is huge, but that's more advanced.

ajax 05-26-2005 18:18

Quote:

Originally Posted by ichthys
An Idea of how to make it more complicated; The more answers they get right the harder they get!

yeah i guess the sample question i used as an example is pretty easy.

ichthys 05-26-2005 18:27

Quote:

Originally Posted by ajax
Quote:

Originally Posted by ichthys
An Idea of how to make it more complicated; The more answers they get right the harder they get!

yeah i guess the sample question i used as an example is pretty easy.

I can think of an even easier one :D

Whenever a player is asked a question, you should store the answer in a userid specific cvar.


edit: nvm


All times are GMT -4. The time now is 11:00.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.