Dam need help with /add cmd ..
I'm using shatter project, and he allow only 200 points in the /add cmd ..
But when I change the 200 point limit. I got dc ..
How can I code it right ?
here the command :
Code:
void AddCommand(int aIndex,LPCSTR Buffer,int Type)
{
if(conf.commands.addenabled == 0)
{
return;
}
if(conf.commands.addonlyforgm == 1 && VerifyGM(aIndex) == false)
{
return;
}
if((int)gObjGetInt(aIndex,gObjLvl) < conf.commands.addlevel)
{
MsgOutput(aIndex,"You haven't fulfilled the required level %d.",conf.commands.addlevel);
return;
}
if(conf.commands.addcost == 1)
{
if((int)gObjGetInt(aIndex,gObjZen) < conf.commands.addprice)
{
if(conf.commands.addprice > 0)
{
GCServerMsgStringSend("You don't have enough zen.",aIndex,1);
return;
}
else
{
GCServerMsgStringSend("Incorrect configurations.",aIndex,1);
return;
}
}
}
if(Type == 4 && gObj[aIndex].DbClass != 64)
{
GCServerMsgStringSend("Only Dark Lord can use this command.",aIndex,1);
return;
}
if(strlen(Buffer) < 1)
{
GCServerMsgStringSend("Error, function needs a number.",aIndex,1);
return;
}
int AddPoints = atoi(Buffer);
if(gObj[aIndex].LevelUpPoint < AddPoints)
{
GCServerMsgStringSend("Sorry, you don't have enough points.",aIndex,1);
return;
}
if(AddPoints == 0)
{
GCServerMsgStringSend("Error, function needs a number.",aIndex,1);
return;
}
if(AddPoints < 10)
{
GCServerMsgStringSend("Error, you must add minimum of 10 points.",aIndex,1);
return;
}
if(AddPoints > 200)
{
MsgOutput(aIndex,"Error, you can add maximum of 200 points.");
return;
}
WORD Class,Strength,Agility,Vitality,Energy,Command;
PBYTE PlayerStatInfo = (PBYTE)(aIndex * OBJECT_SIZE + OBJECT_BASE);
_asm
{
PUSH EAX;
PUSH EBX;
MOV EAX,PlayerStatInfo;
XOR EBX,EBX;
MOV BX,WORD PTR [EAX+gObjClass];
MOV Class,BX;
MOV BX,WORD PTR [EAX+gObjStrength];
MOV Strength,BX;
MOV BX,WORD PTR [EAX+gObjAgility];
MOV Agility,BX;
MOV BX,WORD PTR [EAX+gObjVitality];
MOV Vitality,BX;
MOV BX,WORD PTR [EAX+gObjEnergy];
MOV Energy,BX;
MOV BX,WORD PTR [EAX+gObjCommand];
MOV Command,BX;
POP EBX;
POP EAX;
}
switch(Type)
{
case 0x00:
if(((Strength + AddPoints) >= conf.stats.playermaxstats) || ((Strength + AddPoints) >= MaxStats[Class][0]))
{
MsgOutput(aIndex,"Error, maximum possible strength is %d.",conf.stats.playermaxstats);
return;
}
break;
case 0x01:
if(((Agility + AddPoints) >= conf.stats.playermaxstats) || ((Agility + AddPoints) >= MaxStats[Class][1]))
{
MsgOutput(aIndex,"Error, maximum possible agility is %d.",conf.stats.playermaxstats);
return;
}
break;
case 0x02:
if(((Vitality + AddPoints) >= conf.stats.playermaxstats) || ((Vitality + AddPoints) >= MaxStats[Class][2]))
{
MsgOutput(aIndex,"Error, maximum possible vitality is %d.",conf.stats.playermaxstats);
return;
}
break;
case 0x03:
if(((Energy + AddPoints) >= conf.stats.playermaxstats) || ((Energy + AddPoints) >= MaxStats[Class][3]))
{
MsgOutput(aIndex,"Error, maximum possible energy is %d.",conf.stats.playermaxstats);
return;
}
break;
case 0x04:
if(Class == 4)
{
if(((Command + AddPoints) >= conf.stats.playermaxstats) || ((Command + AddPoints) >= MaxStats[Class][4]))
{
MsgOutput(aIndex,"Error, maximum possible command is 32767.");
return;
}
}
break;
}
BYTE lpMsg[5] = {0xC1,0x05,0xF3,0x06,Type}
for(UINT i = 0; i < AddPoints; i++)
{
CGLevelUpPointAdd(lpMsg,aIndex);
}
MsgOutput(aIndex,"You've added %d spare points.",AddPoints);
if(conf.commands.addloguse == 1)
{
Log.AddTime("Use Command -> [ %s ]\t[ %s ] : %s",gObj[aIndex].AccountID,gObj[aIndex].Name,"Add");
Log.Command("Use Command -> [ %s ] [ %s ] : %s\n",gObj[aIndex].AccountID,gObj[aIndex].Name,"Add");
}
if(conf.commands.addcost == 1)
{
if((int)gObjGetInt(aIndex,gObjZen) >= conf.commands.addprice)
{
if(conf.commands.addprice > 0)
{
gObjWrite(aIndex,gObjZen,gObjGetInt(aIndex,gObjZen) - conf.commands.addprice);
GCMoneySend(aIndex,gObjGetInt(aIndex,gObjZen));
}
}
}
}
Thanks for helping !
Re: Dam need help with /add cmd ..
try to learn c++, this should help right away,
btw have u tried to change maximum points to 255 ?:) this should work
Re: Dam need help with /add cmd ..
I know C++, and I tried also to make loop.
when the 'AddPoints' bigger than 200. Its will add only 200.
and when its not bigger than 200.
Its will go like normal ..
and i won't work :D