- Dołączył
- Kwiecień 17, 2008
- Posty
- 70
- Liczba reakcji
- 0
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:
Nast?pnie pod tym wklejcie to:
Kolejn? rzecz? jak? trzeba znale?? to plik Magic.cpp a w nim:
I pod tym wklejcie to:
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]:
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?.
Znajd?cie plik o nazwie Game.cpp i w nim znajd?cie to:
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:
//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:
int MagicEffectClass::getDamage(Creature *target, const Creature *attacker /*= NULL*/) const
{
I pod tym wklejcie to:
//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]:
-------------------------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?.
