Znalazłem ostatnio na otfans.net skrypt C++ na pvp od danego lvl. Bardzo przydatne jeśli
ots jest PvP ponieważ niektórzy gracze narzekają gdy zaczną grę zostają zabijani jako pierwsi. Więc zacznijmy:
Znajdźcie plik o nazwie
Game.cpp i w nim znajdźcie to:
Cytat:
void Game::checkCreatureAttacking(unsigned long id)
{
OTSYS_THREAD_LOCK_CLASS lockClass(gameLock, "Game::checkCreatureAttacking()");
Creature *creature = getCreatureByID(id);
if (creature != NULL && creature->isRemoved == false)
{
creature->eventCheckAttacking = 0;
Monster *monster = dynamic_cast<Monster*>(creature);
if (monster) {
monster->onAttack();
}
else {
if (creature->attackedCreature != 0)
{
Creature *attackedCreature = getCreatureByID(creature->attackedCreature);
|
Następnie pod tym wklejcie to:
Cytat:
//PVP from lvl by Palladineq
Player *attacker = dynamic_cast<Player*>(creature);
Player *attacked = dynamic_cast<Player*>(attackedCreature);
bool protection = false;
if(attacker && attacked)
{
if(attacked->level >= g_config.getGlobalNumber("pvplvl", 50) && attacked->level <= 99999 && attacker->level >= g_config.getGlobalNumber("pvplvl", 50) && attacker->level <= 99999)
protection = true;
}
if(attacker && attacked && !protection)
{
attacker->sendCancelAttacking();
attacker->sendCancel("Both of You must reach PVP level to use PVP");
playerSetAttackedCreature(attacker, 0);
return;
}
//PVP from lvl by Palladineq
|
Kolejną rzeczą jaką trzeba znaleźć to plik
Magic.cpp a w nim:
Cytat:
int MagicEffectClass::getDamage(Creature *target, const Creature *attacker ) const
{
|
I pod tym wklejcie to:
Cytat:
//PVP from lvl by Palladineq
Player *attacked = dynamic_cast<Player*>(target);
bool protection = false;
if(attacker && attacked)
{
if(attacked->level >= g_config.getGlobalNumber("pvplvl", 50) && attacked->level <= 99999 && attacker->level >= g_config.getGlobalNumber("pvplvl", 50) && attacker->level <= 99999)
protection = true;
}
const Monster *monster = dynamic_cast<const Monster*>(attacker);
if(attacker && attacked && !protection && !monster)
if (offensive)
{
attacker->sendCancel("Both of You must reach PVP level to use PVP");
return 0;
}
//PVP from lvl by Palladineq
|
Teraz przejdźmy do pliku
Config.lua I na samym dole dodajcie taką linijkę za pomocą której możecie ustawić lvl od którego można zacząć [pekować] i być [pekowanym]:
Cytat:
-------------------------PVP lvl--------------------------
pvplvl = 50
|
Proszę o komentarze mam nadzieje że będą pozytywne a skrypt będzie poprawnie działał. Mi działał na silniku YurOTS 094f. Ja zawszę przed dodaniem testuje dany skrypt

.Na innych silnikach 7.6 powinien też działać.