PHP- Kodu:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#define PLUGIN "Menu - Admin Yap"
#define VERSION "1.0"
#define AUTHOR "akcaliberkk"
new const file[] = "addons/amxmodx/configs/users.ini";
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("say .bejadmin","AdminlikVer_Menu")
register_clcmd("say /bejadmin","AdminlikVer_Menu")
register_clcmd("say !bejadmin","AdminlikVer_Menu")
}
public AdminlikVer_Menu(id) {
if(!access(id,ADMIN_RCON)) return PLUGIN_CONTINUE
new menu = menu_create("\yAdmin Yapmak Istediginiz^nOyuncuyu Seciniz","AdminlikVer_Handler")
new players[32],inum,tempid;
new szName[32],szID[10];
get_players(players,inum)
for(new i;i<inum;i++) {
tempid = players[i];
get_user_name(tempid,szName,31)
num_to_str(tempid,szID,9)
menu_additem(menu,szName,szID,ADMIN_RCON)
}
menu_setprop(menu,MPROP_EXIT,MEXIT_ALL)
menu_display(id,menu,0)
return PLUGIN_HANDLED
}
public AdminlikVer_Handler(id,menu,item) {
if(item == MENU_EXIT) {
menu_destroy(menu)
return PLUGIN_HANDLED
}
new szID[10],szName[32];
new access,callback;
menu_item_getinfo(menu,item,access,szID,9,szName,31,callback)
new Uid = str_to_num(szID);
if(!is_user_connected(Uid)) {
client_print(id,print_chat,"Oyuncu Bulunamadi !")
menu_display(id,menu,0)
return PLUGIN_HANDLED
}
if(is_user_admin(Uid)) {
client_print(id,print_chat,"Bu Oyuncu Zaten Admin !")
menu_display(id,menu,0)
return PLUGIN_HANDLED
}
EminMisin(id,Uid)
return PLUGIN_HANDLED
}
public EminMisin(id,Uid) {
new target_name[32],szID[10];
get_user_name(Uid,target_name,31)
new menutitle[128];
format(menutitle,127,"\y%s \rAdli Oyuncuyu^nAdmin Yapmak Uzeresiniz. Devam Etmek Istediginize^nEmin Misiniz?",target_name)
new menu = menu_create(menutitle,"EminMisin_Handler")
num_to_str(Uid,szID,9)
menu_additem(menu,"\yEvet",szID,ADMIN_RCON)
menu_additem(menu,"\rHayir","0",ADMIN_RCON)
menu_setprop(menu,MPROP_EXIT,MEXIT_ALL)
menu_display(id,menu,0)
return PLUGIN_HANDLED
}
public EminMisin_Handler(id,menu,item) {
if(item == MENU_EXIT) {
menu_destroy(menu)
return PLUGIN_HANDLED
}
new data[10],name[32];
new access,callback;
menu_item_getinfo(menu,item,access,data,9,name,31,callback)
new Uid = str_to_num(data);
if(!Uid) {
AdminlikVer_Menu(id)
}
else {
new Uname[32]
get_user_name(Uid,Uname,31)
client_print(id,print_chat,"%s Adli Oyuncuyu Admin Yaptiniz !",Uname)
MakeAdmin(Uid);
}
return PLUGIN_HANDLED
}
public MakeAdmin(id) {
new name[32],steamid[32];
get_user_name(id,name,31)
get_user_authid(id,steamid,31)
if(!file_exists(file)) {
new f = fopen(file,"wt")
fclose(f);
}
new WriteData[96];
format(WriteData,sizeof(WriteData),"^"%s^" ^"^" ^"abceimnopqrst^" ^"ce^"",steamid)
write_file(file,WriteData)
server_cmd("amx_reloadadmins")
return PLUGIN_HANDLED
}