Posta o código ai .-.
Vai ficar mais fácil de auxiliar.
Bom galera que entende ai de programação de servidor '-'
to quebrando a cabeça aqui, tirei npc de pkclear e adicionei o comando pois eu utilizo o comando em vez de limpa o pk ele ta resetando e o de resetar msm paro de funcionar '-'
e o de add pontos ta distribuindo tudo errado distribuio em qualquer valor em qualquer status e vai tudo pra energia e quando distribuio em energia vai tudo pra agilidade e o resto nem funfa
e o fix de fixar o 65k de pontos bugou depois que adicionei este comandos
alguem me da uma ajuda aki
Posta o código ai .-.
Vai ficar mais fácil de auxiliar.
mta coisa...............
posta ele em arquivo TXT e manda por MP a ele que fica melhor
a ta ake
Código:else { int ActPoints,PointsToAdd; bool Maxed = false; int MaxPoints = 32000; if(Is65kPoints >= 1)MaxPoints = 65000; if(CMD_STATS_TYPE == 0) { ActPoints = pObj->Strength; PointsToAdd = ActPoints + Points; if(PointsToAdd < 0)PointsToAdd += 65536; if(PointsToAdd > MaxPoints)Maxed = true; if(!Maxed)pObj->Strength = PointsToAdd; } if(CMD_STATS_TYPE == 1) { ActPoints = pObj->Dexterity; PointsToAdd = ActPoints + Points; if(PointsToAdd < 0)PointsToAdd += 65536; if(PointsToAdd > MaxPoints)Maxed = true; if(!Maxed)pObj->Dexterity = PointsToAdd; } if(CMD_STATS_TYPE == 2) { ActPoints = pObj->Vitality; PointsToAdd = ActPoints + Points; if(PointsToAdd < 0)PointsToAdd += 65536; if(PointsToAdd > MaxPoints)Maxed = true; if(!Maxed)pObj->Vitality = PointsToAdd; } if(CMD_STATS_TYPE == 3) { ActPoints = pObj->Energy; PointsToAdd = ActPoints + Points; if(PointsToAdd < 0)PointsToAdd += 65536; if(PointsToAdd > MaxPoints)Maxed = true; if(!Maxed)pObj->Energy = PointsToAdd; } if(CMD_STATS_TYPE == 4) { MaxPoints = 32000; int ActPoints = pObj->Leadership; int PointsToAdd = ActPoints + Points; if(PointsToAdd < 0)PointsToAdd += 65536; if(PointsToAdd > MaxPoints)Maxed = true; if(!Maxed)pObj->Leadership = PointsToAdd; } if(Maxed) { char cShowAddPointError[18]; sprintf(cShowAddPointError, "Max pontos: %d", MaxPoints); GCServerMsgStringSend(cShowAddPointError, aIndex, 1); return; }
O erro que você relatou, não parece estar nesta parte do código, mas de qualquer forma faz +/- assim (adicione mais verificações conforme seja necessário):
Código PHP:
int MaxPoints;
if(Is65kPoints == 0)
{
MaxPoints = 32000;
}
else
{
MaxPoints = 65000;
}
if((pObj->Strength + Points) > pObj->LevelUpPoint)
{
//mensagem de que nao tem pontos suficientes
return;
}
if(CMD_STATS_TYPE == 0)
{
if((pObj->Strength + Points) > MaxPoints)
{
//mensagem de que excedeu o limite
return;
}
pObj->Strength += Points;
}
else if(CMD_STATS_TYPE == 1)
{
if((pObj->Dexterity + Points) > MaxPoints)
{
//mensagem de que excedeu o limite
return;
}
pObj->Dexterity += Points;
}
mil desculpas o codigo que eu enviei foi o que eu tentei alterar desculas desatenção minha é este q to utilizando realmente o de cima tentei alterar e peguei como base
este e o realmente certo
Código PHP:
void t_Class_Commands::ChatAddStats(DWORD aIndex,LPCSTR lpBuffer,DWORD tipo)
{
OBJECTSTRUCT * lpObj = (OBJECTSTRUCT*)OBJECT_POINTER(aIndex);
int points = atoi(lpBuffer);
int MaxPoints;
if(FxsStc.StattusMaxPluss == 0){MaxPoints = 32767;}
else{MaxPoints = 65535;}
if (CmdStruct.IsAddStatCMD == 0)
{
GCServerMsgStringSend(StgStc.EnabledADDMSG, aIndex, 1);
return;
}
if(lpObj->LevelUpPoint < points || points < 0 || points == 0)
{
GCServerMsgStringSend(StgStc.PointErrorADDMSG, aIndex, 1);
return;
}
if(lpObj->Authority != 32 && points > MaxPoints)
{
char MaxPointMsg[200];
sprintf(MaxPointMsg,StgStc.LimitPointADDMSG, MaxPoints);
GCServerMsgStringSend(MaxPointMsg, aIndex,1);
return;
}
switch(tipo){
case 0:
{
if(lpObj->Strength+points > MaxPoints){GCServerMsgStringSend(StgStc.MaxPointADDMSG,aIndex,1);return;}
PMSG_USE_STAT_FRUIT pMsg;
PHeadSetB((LPBYTE)&pMsg,0x2C,sizeof(PMSG_USE_STAT_FRUIT));
pMsg.result = 0;
pMsg.btFruitType = 3;
pMsg.btStatValue = points;
lpObj->Strength += points;
lpObj->LevelUpPoint -= points;
DataSend(lpObj->m_Index,(LPBYTE)&pMsg,pMsg.h.size);
gObjCalCharacter(aIndex);
GCReFillSend(lpObj->m_Index,lpObj->MaxLife + lpObj->AddLife,0xFE,0,lpObj->iMaxShield + lpObj->iAddShield);
gObjSetBP(aIndex);
GCManaSend(lpObj->m_Index,lpObj->MaxMana + lpObj->AddMana,0xFE,0,lpObj->MaxBP+ lpObj->AddBP);
GCLevelUpMsgSend(lpObj->m_Index,0);
}
break;
case 1:
{
if(lpObj->Dexterity+points > MaxPoints){GCServerMsgStringSend(StgStc.MaxPointADDMSG,aIndex,1);return;}
PMSG_USE_STAT_FRUIT pMsg;
PHeadSetB((LPBYTE)&pMsg,0x2C,sizeof(PMSG_USE_STAT_FRUIT));
pMsg.result = 0;
pMsg.btFruitType = 2;
pMsg.btStatValue = points;
lpObj->Dexterity += points;
lpObj->LevelUpPoint -= points;
DataSend(lpObj->m_Index,(LPBYTE)&pMsg,pMsg.h.size);
gObjCalCharacter(aIndex);
GCReFillSend(lpObj->m_Index,lpObj->MaxLife + lpObj->AddLife,0xFE,0,lpObj->iMaxShield + lpObj->iAddShield);
gObjSetBP(aIndex);
GCManaSend(lpObj->m_Index,lpObj->MaxMana + lpObj->AddMana,0xFE,0,lpObj->MaxBP + lpObj->AddBP);
GCLevelUpMsgSend(lpObj->m_Index,0);
}
break;
case 2:
{
if(lpObj->Vitality+points > MaxPoints){GCServerMsgStringSend(StgStc.MaxPointADDMSG,aIndex,1);return;}
PMSG_USE_STAT_FRUIT pMsg;
PHeadSetB((LPBYTE)&pMsg,0x2C,sizeof(PMSG_USE_STAT_FRUIT));
pMsg.result = 0;
pMsg.btFruitType = 1;
pMsg.btStatValue = points;
lpObj->Vitality += points;
lpObj->LevelUpPoint -= points;
lpObj->MaxLife += lpObj->VitalityToLife * points;
DataSend(lpObj->m_Index,(LPBYTE)&pMsg,pMsg.h.size);
gObjCalCharacter(aIndex);
GCReFillSend(lpObj->m_Index,lpObj->MaxLife + lpObj->AddLife,0xFE,0,lpObj->iMaxShield + lpObj->iAddShield);
gObjSetBP(aIndex);
GCManaSend(lpObj->m_Index,lpObj->MaxMana + lpObj->AddMana,0xFE,0,lpObj->MaxBP + lpObj->AddBP);
GCLevelUpMsgSend(lpObj->m_Index,0);
}
break;
case 3:
{
if(lpObj->Energy+points > MaxPoints){GCServerMsgStringSend(StgStc.MaxPointADDMSG,aIndex,1);return;}
PMSG_USE_STAT_FRUIT pMsg;
PHeadSetB((LPBYTE)&pMsg,0x2C,sizeof(PMSG_USE_STAT_FRUIT));
pMsg.result = 0;
pMsg.btFruitType = 0;
pMsg.btStatValue = points;
lpObj->Energy += points;
lpObj->LevelUpPoint -= points;
lpObj->MaxMana += lpObj->EnergyToMana * points;
DataSend(lpObj->m_Index,(LPBYTE)&pMsg,pMsg.h.size);
gObjCalCharacter(aIndex);
GCReFillSend(lpObj->m_Index,lpObj->MaxLife + lpObj->AddLife,0xFE,0,lpObj->iMaxShield + lpObj->iAddShield);
gObjSetBP(aIndex);
GCManaSend(lpObj->m_Index,lpObj->MaxMana + lpObj->AddMana,0xFE,0,lpObj->MaxBP + lpObj->AddBP);
GCLevelUpMsgSend(lpObj->m_Index,0);
}
break;
case 4:
{
if(lpObj->Leadership+points > MaxPoints){GCServerMsgStringSend(StgStc.MaxPointADDMSG,aIndex,1);return;}
if(lpObj->DbClass == 64 || lpObj->DbClass == 65 || lpObj->DbClass == 66)
{
PMSG_USE_STAT_FRUIT pMsg;
PHeadSetB((LPBYTE)&pMsg,0x2C,sizeof(PMSG_USE_STAT_FRUIT));
pMsg.result = 0;
pMsg.btFruitType = 4;
pMsg.btStatValue = points;
lpObj->Leadership += points;
lpObj->LevelUpPoint -= points;
DataSend(lpObj->m_Index,(LPBYTE)&pMsg,pMsg.h.size);
gObjCalCharacter(aIndex);
GCReFillSend(lpObj->m_Index,lpObj->MaxLife + lpObj->AddLife,0xFE,0,lpObj->iMaxShield + lpObj->iAddShield);
gObjSetBP(aIndex);
GCManaSend(lpObj->m_Index,lpObj->MaxMana + lpObj->AddMana,0xFE,0,lpObj->MaxBP + lpObj->AddBP);
GCLevelUpMsgSend(lpObj->m_Index,0);
}
else
{
GCServerMsgStringSend(StgStc.OnlyDLADDCMD,aIndex,1);
return;
}
}
break;
}
}
Organizei melhor o código, ficando assim: [Somente usuários registrados podem vem os links. ]
O seu problema eu acredito que seja no código das fruits que eu não lembro quais são, mas fiz o ENUM pra você entender melhor e poder testar mais facilmente.
enum
{
STAT_FRUIT_STR = 3,
STAT_FRUIT_DEX = 2,
STAT_FRUIT_VIT = 1,
STAT_FRUIT_ENE = 0,
STAT_FRUIT_CMD = 4
};
resolveu nao essa bendita *-*
Há 1 usuários navegando neste tópico. (0 registrados e 1 visitantes)
Marcadores