Forum Forum o faithles OTS Strona Główna Forum o faithles OTS
Forum o naszym Open Tibia Server
 
 FAQFAQ   SzukajSzukaj   UżytkownicyUżytkownicy   GrupyGrupy   GalerieGalerie   RejestracjaRejestracja 
 ProfilProfil   Zaloguj się, by sprawdzić wiadomościZaloguj się, by sprawdzić wiadomości   ZalogujZaloguj 

skrypty dla gma

 
Napisz nowy temat   Odpowiedz do tematu    Forum Forum o faithles OTS Strona Główna -> Forum Glowne
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
Wladca




Dołączył: 25 Lut 2007
Posty: 60
Przeczytał: 0 tematów

Ostrzeżeń: 1/5

PostWysłany: Pon 16:26, 26 Lut 2007    Temat postu: skrypty dla gma

gm jak chcesz to mam fajna skryte challowen rune zamienia w losowego potworka np.witch skeletor itp mam jeszcze inne Smile

Post został pochwalony 0 razy
Powrót do góry
Zobacz profil autora
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
Mikolaj




Dołączył: 25 Lut 2007
Posty: 26
Przeczytał: 0 tematów

Ostrzeżeń: 0/5
Skąd: WRock

PostWysłany: Pon 16:27, 26 Lut 2007    Temat postu:

Fajna ciekawe oby gm sie zgodził Smile
Pozdro dla forumowiczów i Gm Karola


Post został pochwalony 0 razy
Powrót do góry
Zobacz profil autora
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
Karol
Administrator



Dołączył: 24 Lut 2007
Posty: 131
Przeczytał: 0 tematów

Ostrzeżeń: 0/5
Skąd: Koszalin

PostWysłany: Pon 16:33, 26 Lut 2007    Temat postu:

No to Władco wklejaj je w tym temacie.Smile

Post został pochwalony 0 razy
Powrót do góry
Zobacz profil autora
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
Wladca




Dołączył: 25 Lut 2007
Posty: 60
Przeczytał: 0 tematów

Ostrzeżeń: 1/5

PostWysłany: Pon 17:55, 26 Lut 2007    Temat postu:

chcesz moze skrypt taka rune co daje skili duzo ?

Post został pochwalony 0 razy
Powrót do góry
Zobacz profil autora
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
Wladca




Dołączył: 25 Lut 2007
Posty: 60
Przeczytał: 0 tematów

Ostrzeżeń: 1/5

PostWysłany: Pon 18:07, 26 Lut 2007    Temat postu:

mam duzo nowych skryptow jak chcesz to pisz Very Happy Very Happy Very Happy

Post został pochwalony 0 razy
Powrót do góry
Zobacz profil autora
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
Wladca




Dołączył: 25 Lut 2007
Posty: 60
Przeczytał: 0 tematów

Ostrzeżeń: 1/5

PostWysłany: Pon 18:13, 26 Lut 2007    Temat postu:

mam tego npc z ringami

Post został pochwalony 0 razy
Powrót do góry
Zobacz profil autora
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
Wladca




Dołączył: 25 Lut 2007
Posty: 60
Przeczytał: 0 tematów

Ostrzeżeń: 1/5

PostWysłany: Pon 18:18, 26 Lut 2007    Temat postu:

jest to NPC sprzedajacy wszystkie pierscienie jakie znalazlem na tibia.pl z wyjatkiem golden ring, nie moglem znalesc jego ID. Skrypt przeznaczony do Tibii 7.6.

1. Zaczynamy od utworzenia pliku "Goldsmith.xml" w katalogu /data/npc
2. Otwieramy ten plik za pomoca notatnika i wklejamy tam ten kod:

<?xml version="1.0"?>
<npc name="Goldsmith" script="data/npc/scripts/ringi.lua" access="3">
<look type="128" head="78" body="71" legs="82" feet="114"/>
</npc>

Nastepnie zapisujemy i zamykamy.
3. Tworzymy plik "ringi.lua" w katalogu /data/npc/scripts
4. Otwieramy ten plik za pomoca notatnika i wklejamy tam ten kod:

focus = 0
talk_start = 0
target = 0
following = false
attacking = false

function onThingMove(creature, thing, oldpos, oldstackpos)

end


function onCreatureAppear(creature)

end


function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Good bye then.')
selfLook(cid)
focus = 0
talk_start = 0
end
end


function onCreatureTurn(creature)

end


function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end


function onCreatureSay(cid, type, msg)
msg = string.lower(msg)

if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then
selfSay('Hello ' .. creatureGetName(cid) .. '! I sell rings.')
focus = cid
talk_start = os.clock()

elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Sorry, ' .. creatureGetName(cid) .. '! I talk to you in a minute.')

elseif focus == cid then
talk_start = os.clock()

if msgcontains(msg, 'rings') then
selfSay('I sell axe ring (100gps), club ring (150gps), sword ring (200gps), crystal ring (150gps), emerald bangle (1k), energy ring (400gps), life ring (900gps), might ring (2k), power ring (80gps), ring of healing (1.2k), ring of the skies (20k), stealth ring (2k), time ring (2k) and wedding ring (100gps).')



elseif msgcontains(msg, 'axe ring') then
buy(cid,2208,1,100)

elseif msgcontains(msg, 'club ring') then
buy(cid,2209,1,150)

elseif msgcontains(msg, 'sword ring') then
buy(cid,2207,1,200)

elseif msgcontains(msg, 'crystal ring') then
buy(cid,2124,1,150)

elseif msgcontains(msg, 'emerald bangle') then
buy(cid,2127,1,1000)

elseif msgcontains(msg, 'energy ring') then
buy(cid,2167,15,400)

elseif msgcontains(msg, 'life ring') then
buy(cid,2168,15,900)

elseif msgcontains(msg, 'might ring') then
buy(cid,2164,10,2000)

elseif msgcontains(msg, 'power ring') then
buy(cid,2166,6,80)

elseif msgcontains(msg, 'ring of healing') then
buy(cid,2214,6,1200)

elseif msgcontains(msg, 'ring of the skies') then
buy(cid,2123,15,20000)

elseif msgcontains(msg, 'stealth ring') then
buy(cid,2165,4,2000)

elseif msgcontains(msg, 'time ring') then
buy(cid,2169,5,2000)

elseif msgcontains(msg, 'wedding ring') then
buy(cid,2121,1,100)

elseif string.find(msg, '(%a*)bye(%a*)') and getDistanceToCreature(cid) < 4 then
selfSay('Good bye, ' .. creatureGetName(cid) .. '!')
focus = 0
talk_start = 0
end
end
end


function onCreatureChangeOutfit(creature)

end


function onThink()
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('Next Please...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Good bye then.')
focus = 0
end
end
if focus == 0 then
cx, cy, cz = selfGetPosition()
randmove = math.random(1,20)
if randmove == 1 then
nx = cx + 1
end
if randmove == 2 then
nx = cx - 1
end
if randmove == 3 then
ny = cy + 1
end
if randmove == 4 then
ny = cy - 1
end
if randmove >= 5 then
nx = cx
ny = cy
end
moveToPosition(nx, ny, cz)
--summons = 30
--summons2 = 30
end
end

Nastepnie zapisujemy i zamykamy.
5. Przechodzimy do katalogu /data/world i otwieramy za pomoca notatnika plik "npc.xml".
6. Obojetnie gdzie wklejamy ten kod:

<npc name="Goldsmith" x="204" y="96" z="6"/>

Gdzie w miejsce "204", "96" i "6" nalezy wpisac wspolzedne w ktorych ma stac Goldsmith.

Dziekuje to na tyle.


Post został pochwalony 0 razy
Powrót do góry
Zobacz profil autora
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
Wladca




Dołączył: 25 Lut 2007
Posty: 60
Przeczytał: 0 tematów

Ostrzeżeń: 1/5

PostWysłany: Pon 18:19, 26 Lut 2007    Temat postu:

cos jeszcze need ?

Post został pochwalony 0 razy
Powrót do góry
Zobacz profil autora
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
Karol
Administrator



Dołączył: 24 Lut 2007
Posty: 131
Przeczytał: 0 tematów

Ostrzeżeń: 0/5
Skąd: Koszalin

PostWysłany: Pon 18:39, 26 Lut 2007    Temat postu:

Ładnie wytłumaczyłes ale nie potrzebnie,tłumaczyc mi nie trzeba wystarczy skrypt(skrypt tez bym potrafil zrobic ale mi sie nie chce)zrób jeszcze skrypt na takiego npc ktory by chodzil i sprzątał i masz tuorka od reki.

Post został pochwalony 0 razy
Powrót do góry
Zobacz profil autora
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
Wladca




Dołączył: 25 Lut 2007
Posty: 60
Przeczytał: 0 tematów

Ostrzeżeń: 1/5

PostWysłany: Pon 19:47, 26 Lut 2007    Temat postu:

wiesz takiego npc chyba sie nie da zrobic.. sorki ale przynajmniej ja nie wiem jak zrobic

Post został pochwalony 0 razy
Powrót do góry
Zobacz profil autora
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
Royal Caster




Dołączył: 24 Lut 2007
Posty: 128
Przeczytał: 0 tematów

Ostrzeżeń: 2/5
Skąd: Końskie

PostWysłany: Pon 19:51, 26 Lut 2007    Temat postu:

a ja wiem...

Post został pochwalony 0 razy
Powrót do góry
Zobacz profil autora
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
Wladca




Dołączył: 25 Lut 2007
Posty: 60
Przeczytał: 0 tematów

Ostrzeżeń: 1/5

PostWysłany: Pon 19:51, 26 Lut 2007    Temat postu:

moge jak chcesz dac ci jakiegos innego skrypta np.waspa co pilnuje pozadku itp

Post został pochwalony 0 razy
Powrót do góry
Zobacz profil autora
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
Wladca




Dołączył: 25 Lut 2007
Posty: 60
Przeczytał: 0 tematów

Ostrzeżeń: 1/5

PostWysłany: Pon 20:04, 26 Lut 2007    Temat postu:

Witam...

Zainspirował mnie temat założony przez "Lunar" (http://forum.tibia.org.pl/showthread.php?t=67592&highlight=parrot)
Zatem postanowiłem wcielić to w życie. U mnie jednak jest to Wasp (osa) latająca po całej mapie, która daje kicka osobie która w jego polu widzenia napisała niecenzuralne słowo. Mam nadzieję, że komuś się przyda Very Happy


Zamieszczam tutaj ten skrypt:


A więc, tworzymy plik wasp.lua w data\npc\scripts i wklejamy to:


focus = 0
talk_start = 0
target = 0
potwierdzenie = 0
following = false
attacking = false

function onThingMove(creature, thing, oldpos, oldstackpos)

end


function onCreatureAppear(creature)

end


function onCreatureDisappear(cid, pos)

end


function onCreatureTurn(creature)

end

function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end


function onCreatureSay(cid, type, msg)
msg = string.lower(msg)
if ((string.find(msg, '(%a*)kurw(%a*)')) or (string.find(msg, '(%a*)huj(%a*)')) or (string.find(msg, '(%a*)pizd(%a*)')) or (string.find(msg, '(%a*)dziwk(%a*)')) or (string.find(msg, '(%a*)suka(%a*)')) or (string.find(msg, '(%a*)suko(%a*)')) or (string.find(msg, '(%a*)pierd(%a*)')) or (string.find(msg, '(%a*)jeb(%a*)')) or (string.find(msg, '(%a*)qurw(%a*)')) or (string.find(msg, '(%a*)qrw(%a*)')) or (string.find(msg, '(%a*)fuck(%a*)')) and (focus == 0)) and getDistanceToCreature(cid) < 8 then
selfSay('' .. creatureGetName(cid) ..' nie przeklinaj wiecej...!!')
potwierdzenie = 1
focus = cid
talk_start = os.clock()
end
end


function onCreatureChangeOutfit(creature)

end


function onThink()
if potwierdzenie == 1 and (os.clock() - talk_start) > 1 then
selfSay('/kick ' .. creatureGetName(focus) ..'')
potwierdzenie = 0
talk_start = 0
focus = 0
end

if focus == 0 then
cx, cy, cz = selfGetPosition()
randmove = math.random(1,5)
if randmove == 1 then
nx = cx + 2
end
if randmove == 2 then
nx = cx - 2
end
if randmove == 3 then
ny = cy + 2
end
if randmove == 4 then
ny = cy - 2
end
if randmove >= 5 then
nx = cx
ny = cy
end
moveToPosition(nx, ny, cz)
--summons = 30
--summons2 = 30
end

if focus > 0 then
rand = math.random(1,6)
if rand == 1 then
item = 0
elseif rand == 2 then
item = 0
elseif rand == 3 then
item = 0
elseif rand == 4 then
item = 0
elseif rand == 5 then
item = 0
else
item = 0
end
end

if focus == 0 then
randsay = math.random(1,60)
if randsay == 1 then
selfSay('Nie przeklinaj...')
end
if randsay == 2 then
selfSay('Nie uzywaj wulgaryzmow...')
end
end

end





Następnie, tworzymy plik Wasp Security.xml w data\npc i wklejamy to:


<?xml version="1.0"?>

<npc name="Wasp Security" script="data/npc/scripts/wasp.lua" access="1" lookdir="2">
<mana now="800" max="800"/>
<health now="200" max="200"/>
<look type="44" head="20" body="30" legs="40" feet="50" corpse="2131"/>
</npc>




Na koniec, aby postawić ją na mapie wchodzimy do data\world\npc i wklejamy to:


<npc name="Wasp Security" x="Pozycja x" y="Pozycja y" z="Pozycja z"/>



End... Wink



.::Skrypt w 100% zrobiony przeze mnie::.


Post został pochwalony 0 razy
Powrót do góry
Zobacz profil autora
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
Royal Caster




Dołączył: 24 Lut 2007
Posty: 128
Przeczytał: 0 tematów

Ostrzeżeń: 2/5
Skąd: Końskie

PostWysłany: Pon 20:15, 26 Lut 2007    Temat postu:

Yhhh.....
mama fajna zecz ....
tak ze snieg pada...
Wyjeb...ta.. na swoim mialem RazzRazzRazz


Post został pochwalony 0 razy
Powrót do góry
Zobacz profil autora
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
Royal Caster




Dołączył: 24 Lut 2007
Posty: 128
Przeczytał: 0 tematów

Ostrzeżeń: 2/5
Skąd: Końskie

PostWysłany: Pon 20:16, 26 Lut 2007    Temat postu:

Zrób nowy plik tekstowy w twoich źródłach i nazwij go snow.cpp & snow.h

SNOW.CPP
#ifdef VITOR_SNOW

#include "snow.h"
#include "player.h"

Snow::Snow(Game* game, Position Radius)
{
this->game = game;
this->Radius = Radius;

DoAnimation = true;
FindPath = true;

IsFalling = false;

MakeFlakes = 0; // Flake creating chance
MeltFlakes = 0; // Flake melting chance

Angle = SNOWANGLE_SEPLAIN;
Intensity = SNOWINTENSITY_SUPERHIGH;

Range = 10;
}

Position Snow::GetRandomPosition()
{
UInt16 FlakeRange = (Range != 0xFF) ? Range : 300;

UInt16 xRange[] =
{
(Radius.x - FlakeRange),
(Radius.x + FlakeRange)
};

UInt16 yRange[] =
{
(Radius.y - FlakeRange),
(Radius.y + FlakeRange)
};

if(xRange[1] > MAP_WIDTH || yRange[1] > MAP_HEIGHT)
return Position(0, 0, 0);

UInt16 x = random_range(xRange[0], xRange[1]);
UInt16 y = random_range(yRange[0], yRange[1]);
Byte z = 7;

return Position(x, y, z);
}

OTSYS_THREAD_RETURN AsyncMeltSnowFlake(void* Data)
{
FlakeMelt_t FlakeMelt = *(FlakeMelt_t*)Data;

Game* game = FlakeMelt.game;
Item* Flake = FlakeMelt.Flake;

if(Flake->getItemCountOrSubtype() == 0) // Flake was moved - TODO: fix it after vip is done
return;

if(Flake->pos.x != 0xFFFF)
{
Tile *tile = game->getTile(Flake->pos);

if(tile)
{
UInt16 SleepTick = random_range(8000, 15000);
Sleep(SleepTick);

UInt16 Count = (UInt16)Flake->getItemCountOrSubtype();
Position Pos = Flake->pos;

bool HasMoreFlakes = false;

if(Count > 1) // More than 1 flake
HasMoreFlakes = true;

Item* Splash = Item::CreateItem(2025);

if(!HasMoreFlakes)
game->removeThing(NULL, Pos, Flake);

game->addThing(NULL, Pos, Splash);
game->startDecay(Splash);

if(HasMoreFlakes)
Flake->setItemCountOrSubtype((Count - 1));

game->creatureBroadcastTileUpdated(Pos);
}
}
}

OTSYS_THREAD_RETURN AsyncSnow(void* Data)
{
Snow* snow = (Snow*)Data;
Game* game = snow->game;

UInt16 tick;

while(snow->IsFalling)
{
Position From = snow->GetRandomPosition();
Position To = From;

if(snow->DoAnimation)
{
switch(snow->Angle)
{
case SNOWANGLE_NEPLAIN:
To.x += SNOWDISTANCE;
To.y -= SNOWDISTANCE;

break;

case SNOWANGLE_NWPLAIN:
To.x -= SNOWDISTANCE;
To.y -= SNOWDISTANCE;

break;

case SNOWANGLE_SEPLAIN:
To.x += SNOWDISTANCE;
To.y += SNOWDISTANCE;

break;

case SNOWANGLE_SWPLAIN:
To.x -= SNOWDISTANCE;
To.y += SNOWDISTANCE;

break;

case SNOWANGLE_NPLAIN:
To.y -= SNOWDISTANCE;

break;

case SNOWANGLE_EPLAIN:
To.x += SNOWDISTANCE;

break;

case SNOWANGLE_SPLAIN:
To.y += SNOWDISTANCE;

break;

case SNOWANGLE_WPLAIN:
To.x -= SNOWDISTANCE;

break;
}

Tile* toTile = NULL;

if(snow->FindPath)
{
bool Continue = false;

To.z = 1;

while(!toTile)
{
toTile = game->getTile(To);

if(toTile)
{
if(toTile->isBlocking((BLOCK_PROJECTILE | BLOCK_PATHFIND | BLOCK_SOLID), true, false) != RET_NOERROR)
{
Continue = true;
break;
}
else
break;
}

To.z++;
}

if(Continue)
continue;

From.z = To.z;
}

if(!toTile)
continue;
}

if(snow->MakeFlakes)
{
Byte Chance = random_range(0, 10);

if(Chance <= snow->MakeFlakes)
{
Tile* toTile = game->getTile(To);
Item* topItem = dynamic_cast<Item*>(toTile->getTopDownItem());

Item* Flake = NULL;

Chance = random_range(0, 10);

if(!(topItem && topItem->getID() == SNOWBALL) || topItem->getItemCountOrSubtype() == 100)
{
Flake = Item::CreateItem(SNOWBALL, 1);
Flake->pos = To;

game->addThing(NULL, To, Flake);
}
else
{
UInt16 Count = topItem->getItemCountOrSubtype();

topItem->setItemCountOrSubtype((Count == 0 ? 2 : (Count + 1)));
Flake = topItem;
}

if(snow->MeltFlakes && Chance <= snow->MeltFlakes)
{
FlakeMelt_t FlakeMelt(game, Flake);

OTSYS_CREATE_THREAD(AsyncMeltSnowFlake, (void*)&FlakeMelt);
}

game->creatureBroadcastTileUpdated(To);
}
}

if(snow->DoAnimation)
{
SpectatorVec specs;
game->getSpectators(Range(From, 18, 18, 14, 14), specs);

for(SpectatorVec::iterator it = specs.begin(); it != specs.end(); it++)
{
Player* player = dynamic_cast<Player*>((*it));

if(player)
player->sendDistanceShoot(From, To, NM_ANI_SNOWBALL);
}
}

Byte LowerIntensity = (5 + (snow->Intensity * Cool);
tick = random_range(LowerIntensity, (int)(LowerIntensity * 1.5f));

Sleep(tick);
}
}

void Snow::Start()
{
OTSYS_CREATE_THREAD(AsyncSnow, this);
}

#endif

SNOW.H:

#ifdef VITOR_SNOW
#ifndef _SNOW_H_

#define _SNOW_H_
#define SnowGetPtr(a) a*

#define SNOWBALL 2111
#define SNOWDISTANCE 6

#include <cstdlib>

#include "item.h"
#include "game.h"
#include "tile.h"

typedef unsigned short UInt16;
typedef unsigned char Byte;

struct FlakeMelt_t
{
FlakeMelt_t(Game* g, Item* i) : game(g), Flake(i) {};

Game* game;
Item* Flake;
};

enum FlakeAngle // Should be renamed to StormAngle
{
SNOWANGLE_EPLAIN = 0,
SNOWANGLE_NEPLAIN = 45,
SNOWANGLE_NPLAIN = 90,
SNOWANGLE_NWPLAIN = 135,
SNOWANGLE_WPLAIN = 180,
SNOWANGLE_SWPLAIN = 225,
SNOWANGLE_SPLAIN = 270,
SNOWANGLE_SEPLAIN = 315
};

enum FlakeSpeed // Should be renamed to StormIntensity
{
SNOWINTENSITY_SUPERHIGH = 0,
SNOWINTENSITY_HIGH = 1,
SNOWINTENSITY_NORMAL = 2,
SNOWINTENSITY_BELOW_NORMAL = 3,
SNOWINTENSITY_LOW = 4,
SNOWINTENSITY_SUPERLOW = 5
};

/* Effect Storm
class EffectStorm
{
public:

EffectStorm();
EffectStorm(Game*, Position);

Game* game;

bool FindPath;
bool IsFalling;

Position GetRandomPosition();
Position Radius;

void Start();
void Stop() { IsFalling = false; };

StormAngle Angle;
StormIntensity Intensity;

Byte Range;
}; */

class Snow // : public EffectStorm
{
public:

Snow() { };
Snow(Game*, Position);

Game* game;

bool DoAnimation;
bool IsFalling;
bool FindPath;

Position GetRandomPosition();
Position Radius;

void Start();
void Stop() { IsFalling = false; };

void MeltFlake(Item* Flake);

FlakeAngle Angle;
FlakeSpeed Intensity;

Byte MeltFlakes;
Byte MakeFlakes;

Byte Range;
};

#endif
#endif
Wejdź teraz w commands.cpp:
i znajdź:
{"/summon",&Commands::placeSummon},
dodaj poniżej:
#ifdef VITOR_SNOW
{"/snow",&Commands::DoSnow},
#endif
Na końcu pliku dodaj:
bool Commands::DoSnow(Creature* c, const std::string &cmd, const std::string &param)
{
static Snow* snow = new Snow(game, Position(g_config.getGlobalNumber("snowX", 139), g_config.getGlobalNumber("snowY", 3Cool));

snow->IsFalling = !snow->IsFalling;

if(snow->IsFalling)
{
FlakeSpeed speed;
FlakeAngle Angle;

Byte MeltFlakes;
Byte MakeFlakes;

Byte Range = 10;

std::stringstream sb;

if(param.size() >= 1)
Angle = (FlakeAngle)(atoi(&param[0]) * 45);

if(param.size() >= 3)
speed = (FlakeSpeed)atoi(&param[2]);

if(param.size() >= 6)
{
sb << param[4] << param[5];
Range = (Byte)atoi(sb.str().c_str());
sb.str("");
}

if(param.size() >= 9)
{
sb << param[7] << param[8];
MakeFlakes = (Byte)atoi(sb.str().c_str());
sb.str("");
}

if(param.size() >= 12)
{
sb << param[10] << param[11];
MeltFlakes = (Byte)atoi(sb.str().c_str());
sb.str("");
}

if(speed < 0 || speed > 5)
speed = (FlakeSpeed)0;

if(Angle > 315 || Angle < 0)
Angle = SNOWANGLE_SEPLAIN;

if(param.size() < 6 || MakeFlakes > 10)
MakeFlakes = 10;

if(param.size() < 9 || MeltFlakes > 10)
MeltFlakes = 10;

snow->Angle = (FlakeAngle)Angle;
snow->Intensity = (FlakeSpeed)speed;
snow->MakeFlakes = MakeFlakes;
snow->MeltFlakes = 0; // Naxedaxu tested and it's bugging on newest CVS', if you want to use this change 0 to MeltFlakes.
snow->Range = Range;

std::cout << "\nSnow started, info:\n - Flake Speed -> " << speed << "\n - Flake Falling Angle -> " << Angle << "\n - Make Flakes -> " << (int)MakeFlakes << "\n - Melt Flakes -> " << (int)MeltFlakes << "\n\n";
}

if(snow->IsFalling)
snow->Start();
else
snow->IsFalling = false;

return true;
}

#endifW commands.h blisko początku pliku dodaj:
#include "snow.h"
Znajdź:
class Game;
dodaj poniżej:
class Snow;
Znajdź:
bool placeSummon(Creature* c, const std::string &cmd, const std::string &param); Dodaj poniżej:
#ifdef VITOR_SNOW
bool DoSnow(Creature*,const std::string&,const std::string&);
#endif Wejdź do pliku position.h znajdź linijkę:
public: poniżej wklej:
#ifdef VITOR_SNOW

Position(int _x, int _y) : x(_x), y(_y), z(0) {}

#endif
W pliku config.lua dodaj:

-- Position Where Start Snowing (North-West map)
snowX = "139"
snowY = "38"
W Dev-Cpp naciśnij: ALT + P

Idź do "Parameters" i w "C++ Compiler" dodaj:
-DVITOR_SNOW
Edit:

Jeżeli masz taki błąd:
otserv/game.h:419: error: `void Game::startDecay(Item*)' is protected
Przenieś linijke z błędem pod linijke:
public:
EDIT2:
Komenda Testowa:
/snow 7 5 10 00 00
Using commands /snow

The commands works like:

/snow a b cc dd ee

Where:
a: The angle that the flakes fall.

They can be (From your point of view)

0 - East
1 - North-East
2 - North
3 - North-West
4 - West
5 - South-West
6 - South
7 - South-East (The one that looks more real)

---

b: The frequency of the falling snow flakes.

They can be:

5 - Super Slow
4 - Slow
3 - Less than Normal
2 - Normal
1 - Fast
0 - Super Fast

---

cc: The range that the random Position getting function will use to search for a new position. Can be from 0 to 99.

---

dd: The chances that the flakes have to actually appear (Be added to the tile) when snow falls, can be from 0 (never) to 10 (always)

---

ee: The chances that the flakes have to melt (If they appear!) Can also be from 0 to 10. If flakes are moved they won't melt.


Post został pochwalony 0 razy
Powrót do góry
Zobacz profil autora
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
Royal Caster




Dołączył: 24 Lut 2007
Posty: 128
Przeczytał: 0 tematów

Ostrzeżeń: 2/5
Skąd: Końskie

PostWysłany: Pon 20:39, 26 Lut 2007    Temat postu: NPC KTOEY ZMIENA PLEC..

data/npc/Plastyk.xml a wnim

<?xml version="1.0"?>
<npc name="Plastyk" script="data/npc/scripts/operacja.lua" access="3">
<look type="128" head="20" body="100" legs="50" feet="99"/>
</npc>

data/npc/scripts/operacja.lua a wnim

focus = 0
talk_start = 0
target = 0
following = false
attacking = false

function onThingMove(creature, thing, oldpos, oldstackpos)

end


function onCreatureAppear(creature)

end


function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Good bye then.')
focus = 0
talk_start = 0
end
end


function onCreatureTurn(creature)

end


function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end


function onCreatureSay(cid, type, msg)
msg = string.lower(msg)

if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then
selfSay('Hello ' .. creatureGetName(cid) .. '! I am Plastic Surgeon.')
selfLook(cid)
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Sorry, ' .. creatureGetName(cid) .. '! I talk to you in a minute.') elseif focus == cid then
talk_start = os.clock()

if msgcontains(msg, 'operation') or msgcontains(msg, 'change sex') then
selfSay('Do you Realy want change your Sex?! It will be cost 10000gp and 5 premium days.')
talk_state = 1

elseif talk_state == 1 then
if msgcontains(msg, 'yes') then
if pay(cid,10000) then
selfSay('/changesex ' .. creatureGetName(cid))
selfSay('You Operation was done succesful !')
else
selfSay('Sorry, you do not have enough money or Premium.')
end
end
talk_state = 0

elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('Good bye, ' .. creatureGetName(cid) .. '!')
focus = 0
talk_start = 0
end
end
end


function onCreatureChangeOutfit(creature)

end


function onThink()
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('Next Please...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Good bye then.')
focus = 0
end
end
end


Post został pochwalony 0 razy
Powrót do góry
Zobacz profil autora
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
Speedini




Dołączył: 25 Lut 2007
Posty: 72
Przeczytał: 0 tematów

Ostrzeżeń: 0/5

PostWysłany: Wto 15:17, 27 Lut 2007    Temat postu:

moim zdaniem by sie przydal taki npc ktory by za przeklenstwa i pszezwiska wsadzal do paki i nie tlyko za to gdzies mialem takiego skrypta ale gdzies zgubilem moze ktos ma? by sie przydal taki npc Smile

Post został pochwalony 0 razy
Powrót do góry
Zobacz profil autora
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
Wladca




Dołączył: 25 Lut 2007
Posty: 60
Przeczytał: 0 tematów

Ostrzeżeń: 1/5

PostWysłany: Wto 19:32, 27 Lut 2007    Temat postu:

Gm serio pisz jak potrzebujesz skrypty

Post został pochwalony 0 razy
Powrót do góry
Zobacz profil autora
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
Karol
Administrator



Dołączył: 24 Lut 2007
Posty: 131
Przeczytał: 0 tematów

Ostrzeżeń: 0/5
Skąd: Koszalin

PostWysłany: Śro 0:50, 28 Lut 2007    Temat postu:

Przydał by sie nnpc taki do ktorego ja tylko moge pisac i ktory by robił rózne invazje w gotti.

Post został pochwalony 0 razy
Powrót do góry
Zobacz profil autora
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
Wladca




Dołączył: 25 Lut 2007
Posty: 60
Przeczytał: 0 tematów

Ostrzeżeń: 1/5

PostWysłany: Śro 7:35, 28 Lut 2007    Temat postu:

ok zara dam

Post został pochwalony 0 razy
Powrót do góry
Zobacz profil autora
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
Wladca




Dołączył: 25 Lut 2007
Posty: 60
Przeczytał: 0 tematów

Ostrzeżeń: 1/5

PostWysłany: Śro 7:35, 28 Lut 2007    Temat postu:

Cały skrypt napisał Wedel, ja go tylko zedytowałem tak, że tylko GMowie mogą do niego mówić HI...
No to jedziem:
Najpierw zrób wszystko jak to podaje wedel w tym temacie:
[link widoczny dla zalogowanych]

Potem wchodzimy na npcinwazje.lua i zamieniamy go na to:

focus = 0
talk_start = 0
target = 0
following = false
attacking = false

function onThingMove(creature, thing, oldpos, oldstackpos)

end


function onCreatureAppear(creature)

end


function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Good bye then.')
focus = 0
talk_start = 0
end
end


function onCreatureTurn(creature)

end

function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end


function onCreatureSay(cid, type, msg)
msg = string.lower(msg)

if ((string.find(msg, '(%a*)hi(%a*)')) and (focus == 0)) and getDistanceToCreature(cid) < 4 then
if getPlayerVocation(cid) == 0 then
selfSay('Hello ' .. creatureGetName(cid) .. '! Chcesz inwazji ?? kogo ...: Orc,Dwarf,Minotaur,Elf,Human,Dragon,GS,Demon.')
focus = cid
talk_start = os.clock()
else
selfSay('Nie jestes GMem noobku...')
end

if msgcontains(msg, 'demon') and focus == cid then
selfSay('/m inwazja demon')
talk_start = os.clock()
end

if msgcontains(msg, 'dwarf') and focus == cid then
selfSay('/m inwazja dwarf')
talk_start = os.clock()
end

if msgcontains(msg, 'orc') and focus == cid then
selfSay('/m inwazja orc')
talk_start = os.clock()
end

if msgcontains(msg, 'minotaur') and focus == cid then
selfSay('/m inwazja minotaur')
talk_start = os.clock()
end

if msgcontains(msg, 'gs') and focus == cid then
selfSay('/m inwazja gs')
talk_start = os.clock()
end

if msgcontains(msg, 'elf') and focus == cid then
selfSay('/m inwazja elf')
talk_start = os.clock()
end

if msgcontains(msg, 'human') and focus == cid then
selfSay('/m inwazja human')
talk_start = os.clock()
end

if msgcontains(msg, 'dragon') and focus == cid then
selfSay('/m inwazja dragon')
talk_start = os.clock()
end

if string.find(msg, '(%a*)bye(%a*)') and focus == cid and getDistanceToCreature(cid) < 4 then
selfSay('Good bye, ' .. creatureGetName(cid) .. '!')
focus = 0
talk_start = 0
end
end

function onCreatureChangeOutfit(creature)

end

function onThink()
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('Next Please...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Good bye then.')
focus = 0
end
end
end


UWAGA!!! Nie wynika z tego że tylko GM może korzystać z niego!!! GM MUSI MIEĆ USTAWIONE VOC="0" INACZEJ NIE BĘDZIE DZIAŁAŁ!!!

Pozdro.


Post został pochwalony 0 razy
Powrót do góry
Zobacz profil autora
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
Super palla




Dołączył: 28 Lut 2007
Posty: 16
Przeczytał: 0 tematów

Ostrzeżeń: 0/5

PostWysłany: Śro 16:00, 28 Lut 2007    Temat postu:

mi by sie podobalo gdyby byla hallowen runa bo ona jest super xD

Post został pochwalony 0 razy
Powrót do góry
Zobacz profil autora
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
Wladca




Dołączył: 25 Lut 2007
Posty: 60
Przeczytał: 0 tematów

Ostrzeżeń: 1/5

PostWysłany: Śro 16:08, 28 Lut 2007    Temat postu:

da sie zrobic

Post został pochwalony 0 razy
Powrót do góry
Zobacz profil autora
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
Speedini




Dołączył: 25 Lut 2007
Posty: 72
Przeczytał: 0 tematów

Ostrzeżeń: 0/5

PostWysłany: Śro 19:11, 28 Lut 2007    Temat postu:

hallowen runa zadzi tylko zeby sie skonczyla dopiero po wylogowaniu Smile

Post został pochwalony 0 razy
Powrót do góry
Zobacz profil autora
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
Wladca




Dołączył: 25 Lut 2007
Posty: 60
Przeczytał: 0 tematów

Ostrzeżeń: 1/5

PostWysłany: Pią 15:19, 02 Mar 2007    Temat postu:

Może się komuś przydać Smile
Ale trzeba chwilke posiedzieć nad źródełkami Wink

Pliki do edycji:

game.h
game.cpp
player.h
player.cpp
protocol75.cpp
otserv.cpp


No to zabieramy się do pracy Razz
Otwieramy plik game.h i szukamy w nim tej linijki:
bool creatureSaySpell(Creature *creature, const std::string &text);
... i wklepujemy pod nią to :
//----------- Bed System Begin -----------

std::string getBedSleeper(const Position pos);
unsigned int getBedID(const Position pos);
Position getBedPos(std::string name);
bool changeBed(const Position pos, unsigned int oldid, std::string sleepname);
bool loadBeds(std::string file);

//----------- Bed System End -----------
Zapisujemy zmiany i otwieramy plik game.cpp szukamy tam:
#ifdef __DEBUG_PLAYERS__
std::cout << (uint32_t)getPlayersOnline() << " players online." << std::endl;

#endif
... i zamieniamy na:
#ifdef __DEBUG_PLAYERS__
std::cout << (uint32_t)getPlayersOnline() << " players online." << std::endl;
if (p->isSleeping()){
changeBed(getBedPos(p->getName()), getBedID(getBedPos(p->getName())), "Nobody");
}
#endif

Dalej plik game.cpp znajdź około wiersza 4100:
bool Game::playerUseItem(Player *player, const Position& pos, const unsigned char stackpos, const unsigned short itemid, unsigned char index)
{
OTSYS_THREAD_LOCK_CLASS lockClass(gameLock, "Game::playerUseItem()");
if(player->isRemoved)
return false;
actions.UseItem(player,pos,stackpos,itemid,index);
return true;
}
I zamień na:
bool Game::playerUseItem(Player *player, const Position& pos, const unsigned char stackpos, const unsigned short itemid, unsigned char index)
{
OTSYS_THREAD_LOCK_CLASS lockClass(gameLock, "Game::playerUseItem()");

if(itemid == 2455 || itemid == 2457 || itemid == 2459 || itemid == 2461 || itemid == 2471 || itemid == 2473 /*|| itemid == 1762 || itemid == 1764 || itemid == 1766 || itemid == 1768*/){
if (changeBed(pos, itemid, player->getName())){
teleport(player, pos);
player->sendLogout();
return true;
}
else{
player->sendCancel("Sorry, not possible.");
return false;
}
}

if(player->isRemoved)
return false;
actions.UseItem(player,pos,stackpos,itemid,index);
return true;
}

Jeszcze tylko to (dodaj na samym końcu pliku):


bool Game::loadBeds(std::string file)
{
xmlDocPtr doc;
doc = xmlParseFile(file.c_str());
if (doc){
xmlNodePtr root, p, tmp;
root = xmlDocGetRootElement(doc);
if (xmlStrcmp(root->name, (const xmlChar*)"beds")) {
xmlFreeDoc(doc);
return -1;
}
tmp = root->children;
int x,y,z,id;
while(tmp){
if (strcmp((char*) tmp->name, "bed")==0){
x = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "x"));
y = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "y"));
z = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "z"));
id = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "id"));
Position mainPos(x, y, z);
Item *mainItem = Item::CreateItem(id);
Tile *mainTile = getTile(mainPos.x, mainPos.y, mainPos.z);
if (mainTile && mainItem){
Position nextPos(x, y, z);
Item *nextItem = Item::CreateItem(id+1);
if (id == 2455 || id == 2459 || id == 2463 || id == 2467 || id == 2471 || id == 2475){
nextPos.y++;
}
else if(id == 2457 || id == 2461 || id == 2465 || id == 2469 || id == 2473 || id == 2477){
nextPos.x++;
}
Tile *nextTile = getTile(nextPos.x, nextPos.y, nextPos.z);
if (nextTile && nextItem){
mainTile->addThing(mainItem);
mainItem->pos = mainPos;
nextTile->addThing(nextItem);
nextItem->pos = nextPos;
}
}
}
tmp = tmp->next;
}
xmlFreeDoc(doc);
return 0;
}
return -1;
}
std::string Game::getBedSleeper(const Position pos)
{
std::string file="data/world/beds.xml";
xmlDocPtr doc;
doc = xmlParseFile(file.c_str());
if (doc){
xmlNodePtr root, tmp;
root = xmlDocGetRootElement(doc);
if (xmlStrcmp(root->name, (const xmlChar*)"beds")) {
xmlFreeDoc(doc);
return "Nobody";
}
tmp = root->children;
while(tmp){
if (strcmp((const char*) tmp->name, "bed")==0){
int x = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "x"));
int y = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "y"));
int z = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "z"));
if (x == pos.x && y == pos.y && z == pos.z){
return (const char*)xmlGetProp(tmp, (const xmlChar *)"name");
}
}
tmp = tmp->next;
}
xmlFreeDoc(doc);
}
return "Nobody";
}

unsigned int Game::getBedID(const Position pos)
{
std::string file="data/world/beds.xml";
xmlDocPtr doc;
doc = xmlParseFile(file.c_str());
if (doc){
xmlNodePtr root, tmp;
root = xmlDocGetRootElement(doc);
if (xmlStrcmp(root->name, (const xmlChar*)"beds")) {
xmlFreeDoc(doc);
return 0;
}
tmp = root->children;
while(tmp){
if (strcmp((const char*) tmp->name, "bed")==0){
int x = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "x"));
int y = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "y"));
int z = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "z"));
if (x == pos.x && y == pos.y && z == pos.z){
return atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "id"));
}
}
tmp = tmp->next;
}
xmlFreeDoc(doc);
}
return 0;
}

bool Game::changeBed(const Position pos, unsigned int oldid, std::string sleepname)
{
Tile *maintile = getTile(pos.x,pos.y,pos.z);
Item *mainitem = dynamic_cast<Item*>(maintile->getThingByStackPos(maintile->getThingCount()-1));
if (mainitem && maintile->isPz()){
Position tilePos(pos.x, pos.y, pos.z);
if (oldid == 2455 || oldid == 2459 || oldid == 2463 || oldid == 2467 || oldid == 2471 || oldid == 2475){
tilePos.y++;
}
else if(oldid == 2457 || oldid == 2461 || oldid == 2465 || oldid == 2469 || oldid == 2473 || oldid == 2477){
tilePos.x++;
}
Tile *nexttile = getTile(tilePos.x,tilePos.y,tilePos.z);
Item *nextitem = dynamic_cast<Item*>(nexttile->getThingByStackPos(maintile->getThingCount()-1));
if (nextitem && nexttile->isPz()){
if (oldid == 2455 || oldid == 2459){
mainitem->setID(oldid+Cool;
}
else if(oldid == 2457){
mainitem->setID(2469);
}
else if(oldid == 2461){
mainitem->setID(2465);
}
else if(oldid == 2463 || oldid == 2467){
mainitem->setID(oldid-Cool;
}
else if(oldid == 2475 || oldid == 2477){
mainitem->setID(oldid-Cool;
}
else if(oldid == 2465){
mainitem->setID(2461);
}
else if(oldid == 2469){
mainitem->setID(2457);
}
else if(oldid == 2475){
mainitem->setID(2471);
}
else if(oldid == 2477){
mainitem->setID(2473);
}

nextitem->setID(mainitem->getID()+1);

SpectatorVec list;
SpectatorVec::iterator it;
getSpectators(Range(tilePos, true), list);
//players
for(it = list.begin(); it != list.end(); ++it) {
if(dynamic_cast<Player*>(*it)) {
(*it)->onTileUpdated(pos);
(*it)->onTileUpdated(tilePos);
}
}


//Player *player = dynamic_cast<Player*>(player);
//player->onTileUpdated(pos);
//player->onTileUpdated(tilePos);

std::string file="data/world/beds.xml";
xmlDocPtr doc;
doc = xmlParseFile(file.c_str());
if (doc){
xmlNodePtr root, tmp;
root = xmlDocGetRootElement(doc);
if (xmlStrcmp(root->name, (const xmlChar*)"beds")) {
xmlFreeDoc(doc);
return false;
}
Position bedPos[1000];// 1000 = number of beds
unsigned int id[1000];
std::string name[1000];
int i = 0;
tmp = root->children;
while(tmp){
if (strcmp((const char*) tmp->name, "bed")==0){
i++;
bedPos[i].x = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "x" ));
bedPos[i].y = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "y" ));
bedPos[i].z = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "z" ));
id[i] = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "id" ));
name[i] = (const char*) xmlGetProp(tmp, (const xmlChar*) "name");
if (bedPos[i] == pos){
id[i] = mainitem->getID();
name[i] = sleepname;
}
}
tmp = tmp->next;
}
doc = xmlNewDoc((const xmlChar*)"1.0");
doc->children = xmlNewDocNode(doc, NULL, (const xmlChar*)"beds", NULL);
root = doc->children;

std::stringstream sb;
for(int x = 1; x <= i; x++){
tmp = xmlNewNode(NULL,(const xmlChar*)"bed");
sb << bedPos[x].x; xmlSetProp(tmp, (const xmlChar*) "x" , (const xmlChar*)sb.str().c_str()); sb.str("");
sb << bedPos[x].y; xmlSetProp(tmp, (const xmlChar*) "y" , (const xmlChar*)sb.str().c_str()); sb.str("");
sb << bedPos[x].z; xmlSetProp(tmp, (const xmlChar*) "z" , (const xmlChar*)sb.str().c_str()); sb.str("");
sb << id[x]; xmlSetProp(tmp, (const xmlChar*) "id", (const xmlChar*)sb.str().c_str()); sb.str("");
sb << name[x]; xmlSetProp(tmp, (const xmlChar*) "name", (const xmlChar*)sb.str().c_str()); sb.str("");
xmlAddChild(root, tmp);
}
xmlSaveFile(file.c_str(), doc);
xmlFreeDoc(doc);
return true;
}
return false;
}
}
}
Position Game::getBedPos(std::string name)
{
std::string file="data/world/beds.xml";
xmlDocPtr doc;
doc = xmlParseFile(file.c_str());
if (doc){
xmlNodePtr root, tmp;
root = xmlDocGetRootElement(doc);
if (xmlStrcmp(root->name, (const xmlChar*)"beds")) {
xmlFreeDoc(doc);
return Position(0xFFFF,0xFFFF,0xFF);
}
tmp = root->children;
while(tmp){
if (strcmp((const char*) tmp->name, "bed")==0){
std::string sleepname = (const char*)xmlGetProp(tmp, (const xmlChar *)"name");
if (sleepname == name){
int x = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "x"));
int y = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "y"));
int z = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "z"));
return Position(x,y,z);
}
}
tmp = tmp->next;
}
xmlFreeDoc(doc);
}
return Position(0xFFFF,0xFFFF,0xFF);
}



Zapisujemy zmiany i otwieramy plik player.h do klasy player w sekcji public dodajemy:
bool isSleeping();
void sendLogout();
Otwieramy plik player.cpp szukamy linijki:
#endif //YUR_LIGHT_ITEM
... podspodem dodajemy:
void Player::sendLogout()
{
client->logout();
}

bool Player::isSleeping()
{
std::string file="data/world/beds.xml";
xmlDocPtr doc;
doc = xmlParseFile(file.c_str());
if (doc){
xmlNodePtr root, tmp;
root = xmlDocGetRootElement(doc);
if (xmlStrcmp(root->name, (const xmlChar*)"beds")) {
xmlFreeDoc(doc);
return false;
}
tmp = root->children;
while(tmp){
if (strcmp((const char*) tmp->name, "bed")==0){
std::string sleepname = (const char*)xmlGetProp(tmp, (const xmlChar *)"name");
if (sleepname == this->name){
return true;
}
}
tmp = tmp->next;
}
xmlFreeDoc(doc);
}
return false;
}


Zapisujemy zmiany i otwieramy plik protocol75.cpp szukamy:
#endif //TLM_HOUSE_SYSTEM
{
... zamieniamy na :
#endif //TLM_HOUSE_SYSTEM
{
if(ItemNum >= 2463 && ItemNum <= 2470 || ItemNum >= 2475 && ItemNum <= 2477){
Position pos(LookPos.x, LookPos.y, LookPos.z);
std::stringstream bedtext;

if (ItemNum == 2464 || ItemNum == 2468 || ItemNum == 2472 ){
pos.y--;
}
else if(ItemNum == 2466 || ItemNum == 2470 || ItemNum == 2474){
pos.x--;
}
bedtext << "You see a bed"/*<< item->getName()*/ << ".\n " << game->getBedSleeper(pos) << " is sleeping there.";
AddTextMessage(newmsg, MSG_INFO, bedtext.str().c_str());
}
if(ItemNum == 2455 || ItemNum == 2461){
Position pos(LookPos.x, LookPos.y, LookPos.z);
std::stringstream bedtext2;
bedtext2 << "You see a bed\n Nobody is sleeping there.";
AddTextMessage(newmsg, MSG_INFO, bedtext2.str().c_str());
}
if(ItemNum == 2457 || ItemNum == 2459){
Position pos(LookPos.x, LookPos.y, LookPos.z);
std::stringstream bedtext2;
bedtext2 << "You see a cot\n Nobody is sleeping there.";
AddTextMessage(newmsg, MSG_INFO, bedtext2.str().c_str());
}
if(ItemNum == 2471 || ItemNum == 2473){
Position pos(LookPos.x, LookPos.y, LookPos.z);
std::stringstream bedtext2;
bedtext2 << "You see a hammock\n Nobody is sleeping there.";
AddTextMessage(newmsg, MSG_INFO, bedtext2.str().c_str());
}
Został nam ostatni plik otserv.cpp szykamy tam :
// Call to WSA Startup on Windows Systems...
... i zamieniamy na:
// Call to WSA Startup on Windows Systems...
//load beds
std::cout << ":: Loaded Beds ... ";;
if(g_game.loadBeds("data/world/beds.xml")){;
ErrorMessage("Could not load data/world/beds.xml!");
return -1;
}
std::cout << "[done]" << std::endl;

W katalogu world dodajemy plik beds.xml:
<?xml version="1.0"?>
<beds>
<bed x="151" y="29" z="7" id="2455" name="Nobody"/>
</beds>
Gdzie x,y,z to współrzędne, id="2455" to numerek łóżka, a name="Nobody" oznacza czy ktoś w nim śpi Smile

Uff to się napisałęm może komuś się przyda Very Happy


Post został pochwalony 0 razy
Powrót do góry
Zobacz profil autora
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
Karol
Administrator



Dołączył: 24 Lut 2007
Posty: 131
Przeczytał: 0 tematów

Ostrzeżeń: 0/5
Skąd: Koszalin

PostWysłany: Pią 15:34, 02 Mar 2007    Temat postu:

Dobra wytlumacz teraz jak to zrobic Smile ja w servie nie ma tych plikow co dales na poczatku -.-

Post został pochwalony 0 razy
Powrót do góry
Zobacz profil autora
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
Wladca




Dołączył: 25 Lut 2007
Posty: 60
Przeczytał: 0 tematów

Ostrzeżeń: 1/5

PostWysłany: Pią 15:39, 02 Mar 2007    Temat postu:

powinny byc bo u mnie na servie byly

Post został pochwalony 0 razy
Powrót do góry
Zobacz profil autora
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
Wladca




Dołączył: 25 Lut 2007
Posty: 60
Przeczytał: 0 tematów

Ostrzeżeń: 1/5

PostWysłany: Sob 9:45, 03 Mar 2007    Temat postu:

Speedini napisał:
moim zdaniem by sie przydal taki npc ktory by za przeklenstwa i pszezwiska wsadzal do paki i nie tlyko za to gdzies mialem takiego skrypta ale gdzies zgubilem moze ktos ma? by sie przydal taki npc Smile
MAM TAKIEGO CO DAJE KICKA Very Happy za przeklenstwa

Post został pochwalony 0 razy
Powrót do góry
Zobacz profil autora
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
Creghan




Dołączył: 01 Mar 2007
Posty: 9
Przeczytał: 0 tematów

Ostrzeżeń: 0/5

PostWysłany: Sob 10:35, 03 Mar 2007    Temat postu:

juz gm wczoraj pokazal jak mu zalezy na otsie -.- zbanowal z 6 osob za to ze? haha sami nie wiemy za co btw jaki mlvl sobie dpisale s do swojej postaci naabku?Very Happy

Post został pochwalony 0 razy
Powrót do góry
Zobacz profil autora
Wyświetl posty z ostatnich:   
Napisz nowy temat   Odpowiedz do tematu    Forum Forum o faithles OTS Strona Główna -> Forum Glowne Wszystkie czasy w strefie EET (Europa)
Strona 1 z 1

 
Skocz do:  
Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach

fora.pl - załóż własne forum dyskusyjne za darmo
Powered by phpBB © 2001, 2005 phpBB Group
Regulamin