Register for your free account! | Forgot your password?

You last visited: Today at 02:37

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Mini-Guide]C++ neue Chat-Commands

Discussion on [Mini-Guide]C++ neue Chat-Commands within the Metin2 PServer Guides & Strategies forum part of the Metin2 Private Server category.

Reply
 
Old   #1
 
Dyshaxo's Avatar
 
elite*gold: 0
Join Date: Sep 2009
Posts: 665
Received Thanks: 444
[Mini-Guide]C++ neue Chat-Commands

Da grade so viele nützliche Guides und Releases gemacht werden will ich mich an der Welle der "So beschissen schrecklichen" Metin2-Community beteiligen

Hier erkläre ich euch, wie ihr neue Chat-Commands (Wie man's kennt, z.B. /kill) für euren Core bastelt.

Kurzes Vorwort: Nach kurzer recherche hab' ich kein HowTo dazu gefunden. Es gibt in 'nem anderen Forum 'n Guide zur Client/Core - Core/Client-Kommunikation mittels Packets, der Vorteil an Commands ist - dass die Implementierung bei weitem einfacher ist, und man für die Client-Server-Kommunikation nurnoch via Aufruf der Python-Function net.SendChatCommand("/command") das gewünschte... wasauchimmer ausführen kann

Im Beispiel werd' ich 'nen Command schreiben, mit dem man ein gewünschtes Pet mittels Vnum als Argument spawnen kann.

Fangen wir an:

Ihr öffnet "cmd.cpp" - dort seht ihr sehr viele Functions wie "ACMD(do_warp)" - sucht euch eine Stelle irgendwo zwischen den ganzen Functions, wo ihr das gefühl habt, dass es dort richtig ist, und fügt hinzu:
Code:
ACMD(do_pet_summon);
Scrollt weiter zu:
"struct command_info cmd_info[] ="

Dort sind die ganzen im Core implementierten Chatcommands aufgelistet.
Hier wird auch festgelegt, wann ein solcher Befehl verwendet werden kann, und welche Rechte ein Spieler benötigt, um diesen zu verwenden.

Wo's gerade Sinn macht fügt ihr ein:
Code:
{ "pet_summon",			do_pet_summon,			0,	POS_DEAD,	GM_IMPLEMENTOR	},
Bei mir steht das ganze unter "ride" und sieht so aus:

"POS_DEAD" weil - ich hab' ganz offen keine Ahnung, muss ich mir mal genauer anschauen. "GM_IMPLEMENTOR" weil - nur GM's mit IMPLEMENTOR-Rechten (Wird in der Datenbank von euch selbst bestimmt) den Befehl nutzen können sollen. Wenn ihr wollt, dass jeder normale Player den Befehl auch nutzen kann - schreibt ihr stattdessen "GM_PLAYER".

Und damit steht soweit auch das gerüst, jetzt müssen wir noch bestimmen, was der Command denn genau machen soll
Dazu öffnen wir "cmd_general.cpp", hier findet die eigentliche Implementierung statt.

Da wir mit dem PetSystem arbeiten - macht es Sinn, die Funktionen des PetSystems auch aufrufen zu können, dazu gehen wir bei der Datei ganz nach oben und fügen bei den Includes hinzu:
Code:
#include "PetSystem.h"
Dort seht ihr dann wieder die ganzen Functions wie "ACMD(do_pvp)". an einer Stelle wo's grade passt fügen wir hinzu:

Code:
ACMD(do_pet_summon)
{
	if (ch->IsDead())
		return;
	
	char arg1[256];
	one_argument(argument, arg1, sizeof(arg1));
	
	if (!*arg1)
	{
		ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("do_pet_summon: not enough Argument"));
		return;
	}
	
	int vnum = 0;
	str_to_number(vnum, arg1);

	CPetSystem* petSys = ch->GetPetSystem();

	if (!petSystem)
		return;
	
	CPetActor* pet = petSys->Summon(vnum, NULL, NULL, false);
	
	if (!pet)
		ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Could not summon pet");
}
Sooo... wollte das ganze eigentlich noch testen bevor ich jetzt in die Schule muss, da ich mir bei den Argumenten für den Summon-Befehl nicht ganz sicher war, aber verdammt mein Bus fährt in 5 Minuten >_<

Jedenfalls - solltet ihr jetzt mit "/pet_summon 101" <- 'nen Wildhund als Pet rufen können =) Viel Spaß!

ACH VERDAMMT MAN VÖLLIG FALSCHE SECTION WAS SOLL DAS WIESO PASSIERT MIR DAS ahhh >_<

#moverequest
Dyshaxo is offline  
Thanks
3 Users
Old 04/28/2015, 10:17   #2
 
elite*gold: 0
Join Date: Jan 2015
Posts: 239
Received Thanks: 585
Ist schon public so weit ich weiß.
i[Remix] is offline  
Old 04/28/2015, 15:10   #3
 
Dyshaxo's Avatar
 
elite*gold: 0
Join Date: Sep 2009
Posts: 665
Received Thanks: 444
Quote:
Originally Posted by i[Remix] View Post
Ist schon public so weit ich weiß.
Hab' sowieso total verkackt man so verpeilt aufgewacht und was soll's, vergessen wir einfach dass ich das gepostet habe.
Dyshaxo is offline  
Old 04/29/2015, 20:40   #4



 
.aNNdii#'s Avatar
 
elite*gold: 1
Join Date: Aug 2008
Posts: 7,744
Received Thanks: 3,605
Arrow Metin2 PServer - Discussions / Questions -> Metin2 PServer Gu…

#moved
.aNNdii# is offline  
Thanks
1 User
Old 05/07/2015, 17:04   #5
 
elite*gold: 0
Join Date: Sep 2010
Posts: 73
Received Thanks: 31
Thanks !

PS : In game if I type /pet_summon 101, the wild dog disappears
galetlefrancais is offline  
Old 05/08/2015, 11:51   #6


 
Benhero's Avatar
 
elite*gold: 964
Join Date: Mar 2008
Posts: 2,634
Received Thanks: 1,637
yeah^^ because the Pet's need an "Summon Item" and with a command you don't have one so every Pet will disapear.
You can try to use horse book to summon your horse and after this i think you can summon a pet with the command to.

Greatz
Benhero is offline  
Old 05/08/2015, 13:07   #7
 
Dyshaxo's Avatar
 
elite*gold: 0
Join Date: Sep 2009
Posts: 665
Received Thanks: 444
Quote:
Originally Posted by Benhero View Post
yeah^^ because the Pet's need an "Summon Item" and with a command you don't have one so every Pet will disapear.
You can try to use horse bug du summon your horse and after this i think you can summon a pet with the command to.

Greatz
Ich wusste ich hab' irgendetwas wichtiges vergessen!
Dyshaxo is offline  
Old 05/09/2015, 12:23   #8
 
elite*gold: 0
Join Date: Sep 2010
Posts: 73
Received Thanks: 31
But if "!PetSystem" stays, it returns me an error, because it is "not declared in this scope" :x
galetlefrancais is offline  
Reply


Similar Threads Similar Threads
[S] Coder [MINI-Job] 2 commands .exe
09/10/2014 - elite*gold Trading - 0 Replies
Hallo, ich suche für eine ganz ganz kleine Aufgabe einen Coder es geht nur um eine .exe die 2 Befehle beinhaltet. Würde mich sehr freuen wenn mich dahingehend jemand adden kann in Skype. MfG
problem in GM Commands , Chat And More/Problem bei GM Befehle,Chat und vieles mehr :(
11/14/2011 - Metin2 Private Server - 4 Replies
Hello, I have a problem very difficult :( I have tried to Fix it but it was not successful Problem in GM Commands and chat and logout Button and change character Button and everything :( These images When I type GM Commands or chat I get this problem: http://store2.up-00.com/Mar11/o8876099.jpg Or when i press the button to change character Show me the same problem I have tried on another client but i have same problem
Alle GM Commandos + Neue Items+ Neue Maps+Neue commands u.s.w?
07/16/2010 - Metin2 Private Server - 6 Replies
Kann mir wer mal die komplette itemliste + die neuen Sachen u.s.w geben wie Regenbogenstein/Drachenknochenohrringe/Neue Waffen/Neue Rüstungen/Neue Maps/Neue commands.... PLS....Habe SUFU benutzt und nur das gefunden dort sind aber nicht die neuen........:confused:
Chat Commands
10/22/2004 - Lin2 Guides & Templates - 0 Replies
Flüstern "<name> <msg> Rufen !<msg> Gilde @<msg> Gruppe #<msg> Handel +<msg> ALT und Strg Befehle



All times are GMT +1. The time now is 02:37.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.