World Servers
¿Quieres reaccionar a este mensaje? Regístrate en el foro con unos pocos clics o inicia sesión para continuar.

[Aporte] Source Para Agregar a Cualqueir Version /Add /Post /Drop

Ir abajo

Good [Aporte] Source Para Agregar a Cualqueir Version /Add /Post /Drop

Mensaje por CloveR 2011-12-23, 18:19

Hola Comunidad World-Servers Vengo a Dejarles Estas Sources Para Sus Servidores Que No Cuentan Con Ellas.

Primera Source: Comando /Add

void AddStats(int aIndex)
{
if (!IsAddCmd) return;
cObj->Init(aIndex);
if (!strcmpi(Message, "/add"))
{
MessageOutput(aIndex, "Useage: /add ");
MessageOutput(aIndex, "The price for Add is: %d, Maximum stats: %d", AddPrice, AddMax);
return;
}
if (cObj->Money < AddPrice)
{
MessageOutput(aIndex, "You are lacking zen! %d", AddPrice - cObj->Money);
return;
}
char Param1[100];
memset(Param1, 0x00, 100);
GetParam(1, Message, Param1);
int AddType = 0;
if (!strcmpi(Param1, "str")) AddType = 0xB8;
if (!strcmpi(Param1, "agi")) AddType = 0xBA;
if (!strcmpi(Param1, "vit")) AddType = 0xBC;
if (!strcmpi(Param1, "eng")) AddType = 0xBE;
if (!strcmpi(Param1, "cmd")) AddType = 0xD8;
if (!AddType)
{
MessageOutput(aIndex, "You have selected wrong type! The types are: str, agi, vit, eng, cmd");
return;
}
if (cObj->Class != 4 && AddType == 0xD8)
{
MessageOutput(aIndex, "Only Dark Lords can use the add cmd type.");
return;
}
char Param2[100];
memset(Param2, 0x00, 100);
GetParam(2, Message, Param2);
int StatsToAdd = atoi(Param2);
if (cObj->LvlUpPoints < StatsToAdd)
{
MessageOutput(aIndex, "You are lacking level up points! %d", StatsToAdd - cObj->LvlUpPoints);
return;
}
int NowStats = cObj->GetWord(AddType);
if ((StatsToAdd + NowStats) > AddMax)
{
MessageOutput(aIndex, "You are not allowed to add more than %d points!", AddMax);
return;
}
BYTE Packet[5] = {0xC1, 0x05, 0x0F3, 0x06};
Packet[4] = ((AddType % 16) ^ 8) / 2; // Nice algorithm by coNsept to convert from gObj Offsets to the add types :P
if (AddType == 0xD8) Packet[4] = 0x04;
if (StatsToAdd <= 100)
for (int i=0; i CGLevelUpPointAdd(Packet, aIndex);
else
{
int Amount = (cObj->LvlUpPoints - StatsToAdd - 1);
cObj->SetInt(0xA4, Amount);
cObj->AddInt(AddType, StatsToAdd - 1);
CGLevelUpPointAdd(Packet, aIndex);
}
cObj->SetInt(0xB4, cObj->Money - AddPrice);
CGMoneySend(aIndex, cObj->Money - AddPrice);
cObj->Init(aIndex);
MessageOutput(aIndex, "You've added %d points. You have now %d points left.", StatsToAdd, cObj->LvlUpPoints);
if (StatsToAdd > 100)
MessageOutput(aIndex, "Please relog and your stats will be updated.");

Segunda Source: Comando /Post

void DataSendAll(unsigned char* Packet, int Length)
{
for (int i=6400; i<7400; i++)
if(gObjIsConnected(i))
DataSend(i, Packet, Length);
}

void SendPost(int wId, LPCSTR Command, LPCSTR Text)
{
if (!IsPost) return;
if (!gObjIsConnected(wId)) return;
if (!strcmpi(Command, "/Post"))
{
MessageOutput(wId, "[%s] Usando: /Post .", szPrefix);
MessageOutput(wId, "[%s] Preco para usar Post: %d, Level Requerido: %d", szPrefix, PostCost, PostLevel);
return;
}
gObj_SetInfo(wId);
if (gObj.Level < PostLevel)
{
MessageOutput(wId, "[%s] Voce esta level baixo para usar o /post", szPrefix);
return;
}
if (gObj.Money < PostCost)
{
MessageOutput(wId, "[%s] Voce nao tem zen suficiente para usar o /post", szPrefix);
return;
}
BYTE *Packet;
char Message[100];
Packet = (BYTE*) malloc(200);
memset(Packet, 0x00, 200);
*Packet = 0xC1;
*(Packet+2) = 0x00;
memcpy((Packet+3), gObj.Nick, strlen(gObj.Nick));
sprintf(Message, "@@[post] %s", Text);
memcpy((Packet+13), Message, strlen(Message));
int Len = (strlen(Message) + 0x13);
*(Packet+1) = Len;
DataSendAll(Packet, Len);
int Amount = (gObj.Money - PostCost);
gObj_Write(wId, gObj_Money, Amount);
MoneySend(wId, Amount);
free (Packet);
}

Tercera Source: Comando /Drop

{
if(strlen(msg) < 18)
{
return;
}

int spaces = 0;
for(int i=0; i < strlen(msg); i++)
{
if(msg[i] == ' ')
spaces++;
}
if(spaces < 7)
return;

if(IsObjectGM(gObjId) == false)
{
return;
}

char * PosA;
PosA = strchr( msg , ' ' );

char * PosB;
PosB = strchr( PosA+1 , ' ' );

char * PosC;
PosC = strchr( PosB+1 , ' ' );

char * PosD;
PosD = strchr( PosC+1 , ' ' );

int ItemType, ItemNr, ItemLevel;
if(*(PosA+2) != ' ')
{
ItemType = (int)(*(PosA+1) - 48) * 10 + (int)(*(PosA+2) - 48);
}
else
{
ItemType = (*(PosA+1)) - 48;
}

if(*(PosB+2) != ' ')
{
ItemNr = (int)(*(PosB+1) - 48) * 10 + (int)(*(PosB+2) - 48);
}
else
{
ItemNr = (*(PosB+1)) - 48;
}

if(*(PosC+2) != ' ')
{
ItemLevel = (int)(*(PosC+1) - 48) * 10 + (int)(*(PosC+2) - 48);
}
else
{
ItemLevel = (*(PosC+1)) - 48;
}

int ItemSkill = (*(PosD+1)) - 48;
int ItemLuck = (*(PosD+3)) - 48;
int ItemOpt = (*(PosD+5)) - 48;
int ItemExc = (*(PosD+7)) - 48;


DWORD Item = ItemType * 512 + ItemNr;

InvItemCreate ( gObjId , GetObjectMap(gObjId) , GetObjectPosX(gObjId) , GetObjectPosY(gObjId) , Item , ItemLevel , 0 ,ItemSkill , ItemLuck, ItemOpt , -1 , ItemExc , 0 );
GCServerMsgStringSend("[Make]: You have made an item.", gObjId, 1);


Cualquier Problema Que Tengan Porfavor Reportarlo =).

Creditos: CloveR
CloveR
CloveR
Level |
Level |

Usuario Registrado Masculino Chile No tienes ningun Trofeo No tienes ningun Premio No tienes ninguna Advertencia
Dotes De Burro
Mensajes : 99
Cash Point : 23044
Prestigio : 123
Registro : 23/12/2011
Localización : Santiago
Edad : 29

Volver arriba Ir abajo

Volver arriba

- Temas similares

 
Permisos de este foro:
No puedes responder a temas en este foro.