przerobienie "odpowiedz i wygraj"
gring0 27.01.2012
proszę o przerobienie tego pluginu w taki sposób by można było wygrać tylko fragi bądź kase.
Edited by gring0, 27.01.2012 20:16.
Attached Files
Edited by gring0, 27.01.2012 20:16.
gring0 31.01.2012
hmm myślałem, że tam daje losowo. jeżeli tak nie jest to prosiłbym o:
fragi: 5
kasa: 10k
i jakbyś mógł to ustaw by te "pytania" były co 5 minut
speedkill po co się pytasz jak i tak tego nie robisz?
fragi: 5
kasa: 10k
i jakbyś mógł to ustaw by te "pytania" były co 5 minut
speedkill po co się pytasz jak i tak tego nie robisz?
speedkill
31.01.2012
g_cvarTimeToNextQuiz = register_cvar("quiz_timetonextquiz", "8")http://amxx.pl/wklejka/132804657113249/
Tak o dla zabawy.speedkill po co się pytasz jak i tak tego nie robisz?
gring0 31.01.2012
to taki quiz. myślałem, że to będzie na zasadzie: wszyscy widzą pytanie i kto pierwszy odpowie ten wygrywa a nie, że każdy może sobie w swoim czasie wpisać /quiz i odpowiedzieć.
przerobiłby ktoś tak jak bym chciał?
przerobiłby ktoś tak jak bym chciał?
speedkill
01.02.2012
Zapytaj autora czy przerobi tak aby był automat
może wtedy zrobi dwie wersje jedna taka jedna taka.
może wtedy zrobi dwie wersje jedna taka jedna taka.
gring0 01.02.2012
ok, napisałem.
mimo wszystko jeżeli ktoś byłby w stanie przerobić ten plugin tak jak napisałem to wyżej, to niech to zrobi w tym temacie. byłbym wdzięczny.
mimo wszystko jeżeli ktoś byłby w stanie przerobić ten plugin tak jak napisałem to wyżej, to niech to zrobi w tym temacie. byłbym wdzięczny.
MarWit
01.02.2012
Łap ( nie testowane )
W katalogu configs tworzysz plik fast_ansewer.ini i dodajesz tam pytania w formacie
#include <amxmodx>
#include <amxmisc>
#include <ColorChat>
#include <fakemeta_util>
#if cellbits == 32
#define OFFSET_CSMONEY 115
#else
#define OFFSET_CSMONEY 140
#endif
enum FastAnsInfo {
Array:InfoQuestion,
Array:InfoAnsewer
}
new Array:gaFastAnsInfo[FastAnsInfo]
new giQuestion, giHudTimes;
public plugin_init() {
register_plugin("Fast Ansewer", "0.1", "MarWit")
register_clcmd("say", "handleSay")
register_clcmd("say_team", "handleSay")
gaFastAnsInfo[InfoQuestion] = ArrayCreate(256)
gaFastAnsInfo[InfoAnsewer] = ArrayCreate(192)
LoadConfigFile();
set_task(random_float(90.0, 190.0), "SayQuestion", _, _, _, "b");
}
public LoadConfigFile()
{
new szFile[128]
get_configsdir(szFile, charsmax(szFile))
format(szFile, 127, "%s/fast_ansewer.ini", szFile)
new iFile;
if(!(iFile = fopen(szFile, "r")))
set_fail_state("[Fast Ansewer] Nie ma pliku quiz.ini!")
new szBuffer[512], szFastAnsQuestion[256], szFastAnsAnsewer[192]
while(!feof(iFile))
{
fgets(iFile, szBuffer, 511)
trim(szBuffer)
if(!szBuffer[0] || szBuffer[0] == ';' || szBuffer[0] == ' ')
continue;
parse(szBuffer, szFastAnsQuestion, 255, szFastAnsAnsewer, 191);
remove_quotes(szFastAnsQuestion);
remove_quotes(szFastAnsAnsewer);
ArrayPushString(gaFastAnsInfo[InfoQuestion], szFastAnsQuestion)
ArrayPushString(gaFastAnsInfo[InfoAnsewer], szFastAnsAnsewer)
}
if(!ArraySize(gaFastAnsInfo[InfoQuestion]))
log_amx("[Fast Ansewer] W pliku nie ma zadnych pytan!");
else
log_amx("[Fast Ansewer] Zaladowano %d pytan!", ArraySize(gaFastAnsInfo[InfoQuestion]));
}
public handleSay(id)
{
if(giQuestion == -1)
return PLUGIN_CONTINUE
new szBuffer[192], szAnsewer[192];
read_args(szBuffer, 191);
ArrayGetString(gaFastAnsInfo[InfoAnsewer], giQuestion, szAnsewer, 191);
if(equali(szBuffer, szAnsewer))
GiveAward(id);
return PLUGIN_CONTINUE
}
public SayQuestion()
{
new giQuestion = random_num(0, ArraySize(gaFastAnsInfo[InfoQuestion]));
new szBuffer[256];
ArrayGetString(gaFastAnsInfo[InfoQuestion], giQuestion, szBuffer, 255);
ColorChat(0, RED, "[Fast Ansewer]^x01 %s", szBuffer);
set_task(1.0, "_taskHud", 9741, _, _, "a", 10)
giHudTimes = 10;
}
public GiveAward(id)
{
remove_task(9741);
giHudTimes = 0;
giQuestion = -1;
new szName[64], iAwardAmount;
get_user_name(id, szName, 63);
set_hudmessage(255, 0, 0, -1.0, 0.01, 0, 0.1, 3.0, 0.1, 0.1)
switch(random(1))
{
case 0:
{
iAwardAmount = random_num(1, 8);
show_hudmessage(0, "[Fast Ansewer]^x01 %s za poprawna odpowiedz dostal %d fragow!", szName, iAwardAmount);
set_pev(id, pev_frags, float(pev(id, pev_frags)+iAwardAmount))
message_begin(MSG_ALL, get_user_msgid("ScoreInfo"));
write_byte(id);
write_short(pev(id, pev_frags));
write_short(get_user_deaths(id));
write_short(0);
write_short(pev(id, pev_team));
message_end();
}
case 1:
{
iAwardAmount = random_num(800, 16000);
iAwardAmount = get_pdata_int(id, OFFSET_CSMONEY, 5) + iAwardAmount > 16000 ? 16000 : iAwardAmount;
show_hudmessage(0, "[Fast Ansewer]^x01 %s za poprawna odpowiedz dostal +%d $!", szName, iAwardAmount);
set_pdata_int(id, OFFSET_CSMONEY, iAwardAmount, 5);
message_begin(MSG_ONE, get_user_msgid("Money"), {0, 0, 0}, id);
write_long(iAwardAmount);
write_byte(1);
message_end();
}
}
}
public _taskHud(iTask)
{
if(--giHudTimes > 0)
{
set_hudmessage(255, 0, 0, -1.0, 0.01, 0, 0.1, 3.0, 0.1, 0.1)
show_hudmessage(0, "[Fast Ansewer]^x01 Zostalo %d sekund!", giHudTimes)
}
else
{
set_hudmessage(255, 0, 0, -1.0, 0.01, 0, 0.1, 3.0, 0.1, 0.1)
show_hudmessage(0, "[Fast Ansewer]^x01 Niestety, nikt nie wygral ")
giHudTimes = 0;
giQuestion = -1;
}
}
W katalogu configs tworzysz plik fast_ansewer.ini i dodajesz tam pytania w formacie
"pytanie" "odpowiedz"
gring0 10.02.2012
dzięki za zainteresowanie się. niestety nie do końca działa - gdy ktoś odpowie poprawnie na pytanie to się nic nie dzieje.
odświeżam
Edited by gring0, 10.02.2012 17:57.
odświeżam
Edited by gring0, 10.02.2012 17:57.