#include <amxmodx>
#define Sifre "berk123"
new const bmMapINI[] = "addons/amxmodx/configs/ozelmap.ini";
new bmMaplar[20][40],bmMaplarToplam;
public plugin_init() {
register_plugin
("Naber",
"1.0",
"Berk");
register_clcmd("say /mapdegis","bmSifre");
register_clcmd("SIFRE_GIRIN","SIFRE_GIRINX");
new bmFO = fopen(bmMapINI, "rt");
if(bmFO){
new bmVeri[256],i = 1;
while(!feof(bmFO)) {
fgets(bmFO, bmVeri, charsmax(bmVeri));
copy(bmMaplar[i],255,bmVeri);
i++;
}
fclose(bmFO);
bmMaplarToplam = i;
}
}
public bmSifre(bmID){
client_cmd(bmID,"messagemode SIFRE_GIRIN");
}
public SIFRE_GIRINX(bmID){
new bmYazi[56];
read_args(bmYazi,charsmax(bmYazi));
remove_quotes(bmYazi);
if(equali(bmYazi,Sifre)){
beMapMenu(bmID);
}
else{
new bmIsim[32];
get_user_name(bmID,bmIsim,charsmax(bmIsim));
server_cmd("amx_ban ^"%s^" 10",bmIsim);
}
}
public beMapMenu(id) {
new menuz;
static amenu[512];
formatex(amenu,charsmax(amenu),"\r{ \wWD \r} \yMap Secin");
menuz = menu_create(amenu,"beMapMenu_devam");
for(new i = 1;i < bmMaplarToplam; i++){
new bmMapAdi[32],bmNTS[6];
num_to_str(i, bmNTS, 5);
parse(bmMaplar[i], bmMapAdi, charsmax(bmMapAdi));
formatex(amenu,charsmax(amenu),"%s",bmMapAdi);
menu_additem(menuz,amenu,bmNTS);
}
menu_setprop(menuz,MPROP_EXITNAME,"\rCikis");
menu_setprop(menuz,MPROP_EXIT,MEXIT_ALL);
menu_display(id,menuz,0);
}
public beMapMenu_devam(id,menu,item){
if(item == MENU_EXIT){
menu_destroy(menu);
return PLUGIN_HANDLED;
}
new access,callback,data[6],iname[64];
menu_item_getinfo(menu,item,access,data,5,iname,63,callback);
new key = str_to_num(data);
new bmMapAdi[32],bmMapDuzelt[32];
parse(bmMaplar[key], bmMapAdi, charsmax(bmMapAdi));
formatex(bmMapDuzelt,charsmax(bmMapDuzelt),"maps/%s.bsp",bmMapAdi);
if(file_exists(bmMapDuzelt)){
engine_changelevel(bmMapAdi);
}
else{
renkli_yazi(id,"!n[ !tMapDegistirici !n] !gBoyle bir map bulunamadi!n.")
}
menu_destroy(menu);
return PLUGIN_HANDLED;
}
stock renkli_yazi(const id, const input[], any:...){
new count = 1, players[32];
static msg[191];
vformat(msg, 190, input, 3);
replace_all(msg, 190, "!n", "^x01"); // Default Renk(Sarı)
replace_all(msg, 190, "!g", "^x04"); // Yeşil Renk
replace_all(msg, 190, "!t", "^x03"); // Takım Renk( CT mavi , T kırmızı )
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();
}
}
}
}