Örnek olarak bir eklenti bıraksam onu dediğim şekile getirebilir misiniz?
PHP Kod:
/**
* Created by AMXX-Stuido
* User: ITenGriTR
* Date: 26.07.2019
* Time 11.43
*/
#include <amxmodx>
#include <nvault>
new gVault,Array:gNames;
public plugin_init(){
register_plugin
("Name List",
"1.0",
"Berk");
gNames = ArrayCreate(512);
gVault = nvault_open("NameSaver");
new lKey[16],lCountNames;
formatex(lKey,charsmax(lKey),"TotalNames");
lCountNames = nvault_get(gVault,lKey);
if(lCountNames){
new lGetName[28];
for(new i; i < lCountNames; i++){
formatex(lKey,charsmax(lKey),"%i-Name",i);
nvault_get(gVault,lKey,lGetName,charsmax(lGetName));
ArrayPushString(gNames,lGetName);
}
}
register_concmd("amx_ekle","pAddName",ADMIN_RCON,"<isim>, listeye eklemek icin");
register_concmd("amx_cikar","pRemoveName",ADMIN_RCON,"<isim>, listeden cikarmak icin");
register_clcmd("say /liste","pShowNames");
}
public plugin_end(){
new lKey[16],lCountNames = ArraySize(gNames),lNTS[6],lSearchForName[29];
for(new i; i < lCountNames; i++){
ArrayGetString(gNames,i,lSearchForName,charsmax(lSearchForName));
formatex(lKey,charsmax(lKey),"%i-Name",i);
nvault_set(gVault,lKey,lSearchForName);
}
num_to_str(lCountNames,lNTS,charsmax(lNTS));
formatex(lKey,charsmax(lKey),"TotalNames");
nvault_set(gVault,lKey,lNTS);
nvault_close(gVault);
}
public pShowNames(uIndex){
new bmMotd[1680],bmAnlat;
bmAnlat += formatex(bmMotd[bmAnlat],charsmax(bmMotd)-bmAnlat,"<head><style>table,th,td { border: 1px solid green;color:white; } td { width:100% }</style></head>");
bmAnlat += formatex(bmMotd[bmAnlat],charsmax(bmMotd)-bmAnlat,"<center><ul>");
new lTotal = ArraySize(gNames),lSearchForName[29];
if(lTotal){
for(new i; i < lTotal; i++){
ArrayGetString(gNames,i,lSearchForName,charsmax(lSearchForName));
bmAnlat += formatex(bmMotd[bmAnlat],charsmax(bmMotd)-bmAnlat,"<li>%s</li>",lSearchForName);
}
}
else{
bmAnlat += formatex(bmMotd[bmAnlat],charsmax(bmMotd)-bmAnlat,"<span>Listede Hic Kimse Yok!</span>",lSearchForName);
}
bmAnlat += formatex(bmMotd[bmAnlat],charsmax(bmMotd)-bmAnlat,"</ul><center>");
show_motd(uIndex,bmMotd,"Yasakli Isimler");
}
public pAddName(uIndex,cLVL){
new uFlags = get_user_flags(uIndex);
if(~uFlags & cLVL){
return PLUGIN_HANDLED;
}
new lFirstSaid[29];
read_argv(1,lFirstSaid,charsmax(lFirstSaid));
ArrayPushString(gNames,lFirstSaid);
return PLUGIN_CONTINUE;
}
public pRemoveName(uIndex,cLVL){
new uFlags = get_user_flags(uIndex);
if(~uFlags & cLVL){
return PLUGIN_HANDLED;
}
new lFirstSaid[29],lSearchForName[29];
read_argv(1,lFirstSaid,charsmax(lFirstSaid));
for(new i; i < ArraySize(gNames); i++){
ArrayGetString(gNames,i,lSearchForName,charsmax(lSearchForName));
if(equali(lFirstSaid,lSearchForName)){
ArrayDeleteItem(gNames,i);
}
}
return PLUGIN_CONTINUE;
}