Öncelikle merhaba, ilettiğim quiz sisteminde sadece her soruda 2TL vermektedir bunun tutarını 1 TL ila 7 TL arasında random yapabilir miyiz acaba ?
xGame[TR] Clan / 213.238.173.54 - 45 / TS3 IP : xgametrclan
#include <amxmodx>
#include <amxmisc>
#if defined _jail_included
#endinput
#endif
#define _jail_included
native jb_set_user_packs(id, ammount)
native jb_get_user_packs(id)
#define PLUGIN "Matematik Quiz"
#define VERSION "1.0"
#define AUTHOR "aLeX"
new gAnswer, aralik;
new bool:cevaplar;
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("say", "hooksay");
aralik = register_cvar("amx_quizsure", "20.0");
set_task(30.0, "sorusor");
}
public hooksay(id) {
new say[50], stringim[8];
static szname[33];
read_args(say, charsmax(say));
remove_quotes(say);
num_to_str(gAnswer, stringim, 7);
if (equali(say, stringim) && !cevaplar) {
get_user_name(id, szname, charsmax(szname));
new kactl = random_num(1, 7);
client_printc(0, "!gxGame[TR] : !t%s !nsoruyu dogru bildi ve !t%i TL !nkazandi.", szname, kactl);
client_cmd(id, "spk ^"events/enemy_died^"");
client_printc(0, "!nYeni soru %i saniye icerisinde hazirlanacak.", get_pcvar_num(aralik));
jb_set_user_packs(id, jb_get_user_packs(id) + kactl);
remove_task(1051);
set_task(get_pcvar_float(aralik), "sorusor", 1050);
cevaplar = true;
}
}
public surebitti() {
client_printc(0, "!gxGame[TR] : !nSure bitti, kimse cevabi bilemedi. (Cevap: %i)", gAnswer);
client_printc(0, "!nYeni soru %i saniye icerisinde hazirlanacak...", get_pcvar_num(aralik));
set_task(get_pcvar_float(aralik), "sorusor", 1050);
cevaplar = true;
}
public sorusor() {
cevaplar = false;
new a = random_num(1, 4);
switch (a) {
case 1: {
new i = random_num(1, 50);
new l = random_num(1, 50);
client_printc(0, "!gxGame[TR] Soruyor : !t%i + %i = ?", i, l);
gAnswer = i + l;
}
case 2: {
new i = random_num(1, 10);
new l = random_num(1, 10);
client_printc(0, "!gxGame[TR] Soruyor : !t%i x %i = ?", i, l);
gAnswer = i * l;
}
case 3: {
gAnswer = random_num(1, 10);
new l = random_num(1, 20);
client_printc(0, "!gxGame[TR] Soruyor : !t%i : %i = ?", gAnswer * l, l);
}
case 4: {
new i = random_num(50, 100);
new l = random_num(1, 50);
client_printc(0, "!gxGame[TR] Soruyor : !t%i - %i = ?", i, l);
gAnswer = i - l;
}
}
set_task(get_pcvar_float(aralik), "surebitti", 1051);
}
stock client_printc(const id, const input[], any:...) {
new count = 1, players[32];
static msg[191];
vformat(msg, 190, input, 3);
replace_all(msg, 190, "!n", "^x01");
replace_all(msg, 190, "!g", "^x04");
replace_all(msg, 190, "!t", "^x03");
if (id) players[0] = id;
else get_players(players, count, "ch"); {
for (new i = 0; i < count; i++) {
if (is_user_connected(players[i])) {
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}
}