Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
760 B
1
Indexable
Never
else if (actual_command.substr(0, 8) == "/search " && pInfo(peer)->adminLevel >= 3) {

string item = to_lower(cmd.substr(8, cmd.length() - 8).c_str());
string results = "";

gamepacket_t p;

if (item.length() < 3) {
    p.Insert("OnConsoleMessage");
    p.Insert("`4Error! `oYou can search minumum 3 letter item.");
    p.CreatePacket(peer);
    return;
}
 for (int i = 0; i < items.size(); i++) {
     if (items[i].name).find(item) != string::nposs) {
         results += "\nadd_label_with_icon|small|"+ items[i].name +"|left|"+ to_string(i) +"|";
     }
 }
 
 p.Insert("OnDialogRequest");
 p.Insert("\nadd_label_with_icon|big|`2Search Results|left|1252|\nadd_spacer|small|"+ results +"\nadd_spacer|small|\nadd_button|clsls|Close");
 p.CreatePacket(peer);
 
}