Özetle eklenti map ilk açılışında belli bi kaç sorudan sonra çalışmıyor.^
PHP Kod:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <cstrike>
#include <hlsdk_const>
#include <fakemeta>
#include <fun>
#include <engine>
#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("csa_mat_aralik","80.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));
client_printc(0,"!gQuiz: !t%s !nsoruyu dogru bildi ve !t5 HP !nkazandi.", szname);
client_cmd(id,"spk ^"events/enemy_died^"")
//client_printc(0,"!nYeni soru %i saniye icerisinde hazirlanacak.", get_pcvar_num(aralik));
set_user_health(id,get_user_health(id) + 5)
remove_task(1051);
set_task(get_pcvar_float(aralik),"sorusor",1050);
cevaplar = true;
}
}
public surebitti()
{
//client_printc(0,"!n{ !gOsmanLi !n} !t: !nSure bitti, !gkimse cevabi bilemedi. !t(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,"!gSORU: !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,"!gSORU: !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,"!gSORU: !t%i : %i = ?",gAnswer*l,l);
}
case 4:
{
new i = random_num(50,100);
new l = random_num(1,50);
client_printc(0,"!gSORU: !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();
}
}
}
}