need help..!

hello all :-)..
i want to make a dll..

but when i put the code on the cpp file
i get some problems... and when i want to build solutuion
i have some erros

the code:

void AddStats(int aIndex)
{
if (!IsAddCmd) return;
cObj->Init(aIndex);
if (!strcmpi(Message, "/add"))
{
MessageOutput(aIndex, "Useage: /add <Type> <Amount>");
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<StatsToAdd; 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.");


good day. :-)
If that's your entire DLL you're in trouble.

I tried to compile and got this:
1>------ Build started: Project: Snippets, Configuration: Release Win32 ------
1>Build started 9/13/2012 8:21:14 PM.
1>InitializeBuildStatus:
1>  Creating "Release\Snippets.unsuccessfulbuild" because "AlwaysCreate" was specified.
1>ClCompile:
1>  Snippets.cpp
1>Snippets.cpp(4): error C2065: 'IsAddCmd' : undeclared identifier
1>Snippets.cpp(5): error C2065: 'cObj' : undeclared identifier
1>Snippets.cpp(5): error C2227: left of '->Init' must point to class/struct/union/generic type
1>          type is ''unknown-type''
1>Snippets.cpp(6): error C2065: 'Message' : undeclared identifier
1>Snippets.cpp(6): error C3861: 'strcmpi': identifier not found
1>Snippets.cpp(8): error C3861: 'MessageOutput': identifier not found
1>Snippets.cpp(9): error C2065: 'AddPrice' : undeclared identifier
1>Snippets.cpp(9): error C2065: 'AddMax' : undeclared identifier
1>Snippets.cpp(9): error C3861: 'MessageOutput': identifier not found
1>Snippets.cpp(12): error C2065: 'cObj' : undeclared identifier
1>Snippets.cpp(12): error C2227: left of '->Money' must point to class/struct/union/generic type
1>          type is ''unknown-type''
1>Snippets.cpp(12): error C2065: 'AddPrice' : undeclared identifier
1>Snippets.cpp(14): error C2065: 'AddPrice' : undeclared identifier
1>Snippets.cpp(14): error C2065: 'cObj' : undeclared identifier
1>Snippets.cpp(14): error C2227: left of '->Money' must point to class/struct/union/generic type
1>          type is ''unknown-type''
1>Snippets.cpp(14): error C3861: 'MessageOutput': identifier not found
1>Snippets.cpp(18): error C3861: 'memset': identifier not found
1>Snippets.cpp(19): error C2065: 'Message' : undeclared identifier
1>Snippets.cpp(19): error C3861: 'GetParam': identifier not found
1>Snippets.cpp(21): error C3861: 'strcmpi': identifier not found
1>Snippets.cpp(22): error C3861: 'strcmpi': identifier not found
1>Snippets.cpp(23): error C3861: 'strcmpi': identifier not found
1>Snippets.cpp(24): error C3861: 'strcmpi': identifier not found
1>Snippets.cpp(25): error C3861: 'strcmpi': identifier not found
1>Snippets.cpp(28): error C3861: 'MessageOutput': identifier not found
1>Snippets.cpp(31): error C2065: 'cObj' : undeclared identifier
1>Snippets.cpp(31): error C2227: left of '->Class' must point to class/struct/union/generic type
1>          type is ''unknown-type''
1>Snippets.cpp(33): error C3861: 'MessageOutput': identifier not found
1>Snippets.cpp(37): error C3861: 'memset': identifier not found
1>Snippets.cpp(38): error C2065: 'Message' : undeclared identifier
1>Snippets.cpp(38): error C3861: 'GetParam': identifier not found
1>Snippets.cpp(39): error C3861: 'atoi': identifier not found
1>Snippets.cpp(40): error C2065: 'cObj' : undeclared identifier
1>Snippets.cpp(40): error C2227: left of '->LvlUpPoints' must point to class/struct/union/generic type
1>          type is ''unknown-type''
1>Snippets.cpp(42): error C2065: 'cObj' : undeclared identifier
1>Snippets.cpp(42): error C2227: left of '->LvlUpPoints' must point to class/struct/union/generic type
1>          type is ''unknown-type''
1>Snippets.cpp(42): error C3861: 'MessageOutput': identifier not found
1>Snippets.cpp(45): error C2065: 'cObj' : undeclared identifier
1>Snippets.cpp(45): error C2227: left of '->GetWord' must point to class/struct/union/generic type
1>          type is ''unknown-type''
1>Snippets.cpp(46): error C2065: 'AddMax' : undeclared identifier
1>Snippets.cpp(48): error C2065: 'AddMax' : undeclared identifier
1>Snippets.cpp(48): error C3861: 'MessageOutput': identifier not found
1>Snippets.cpp(51): error C2065: 'BYTE' : undeclared identifier
1>Snippets.cpp(51): error C2146: syntax error : missing ';' before identifier 'Packet'
1>Snippets.cpp(51): error C2065: 'Packet' : undeclared identifier
1>Snippets.cpp(51): error C2059: syntax error : '{'
1>Snippets.cpp(51): error C2143: syntax error : missing ';' before '{'
1>Snippets.cpp(51): error C2143: syntax error : missing ';' before '}'
1>Snippets.cpp(52): error C2065: 'Packet' : undeclared identifier
1>Snippets.cpp(53): error C2065: 'Packet' : undeclared identifier
1>Snippets.cpp(56): error C2065: 'Packet' : undeclared identifier
1>Snippets.cpp(56): error C3861: 'CGLevelUpPointAdd': identifier not found
1>Snippets.cpp(59): error C2065: 'cObj' : undeclared identifier
1>Snippets.cpp(59): error C2227: left of '->LvlUpPoints' must point to class/struct/union/generic type
1>          type is ''unknown-type''
1>Snippets.cpp(60): error C2065: 'cObj' : undeclared identifier
1>Snippets.cpp(60): error C2227: left of '->SetInt' must point to class/struct/union/generic type
1>          type is ''unknown-type''
1>Snippets.cpp(61): error C2065: 'cObj' : undeclared identifier
1>Snippets.cpp(61): error C2227: left of '->AddInt' must point to class/struct/union/generic type
1>          type is ''unknown-type''
1>Snippets.cpp(62): error C2065: 'Packet' : undeclared identifier
1>Snippets.cpp(62): error C3861: 'CGLevelUpPointAdd': identifier not found
1>Snippets.cpp(64): error C2065: 'cObj' : undeclared identifier
1>Snippets.cpp(64): error C2227: left of '->SetInt' must point to class/struct/union/generic type
1>          type is ''unknown-type''
1>Snippets.cpp(64): error C2065: 'cObj' : undeclared identifier
1>Snippets.cpp(64): error C2227: left of '->Money' must point to class/struct/union/generic type
1>          type is ''unknown-type''
1>Snippets.cpp(64): error C2065: 'AddPrice' : undeclared identifier
1>Snippets.cpp(65): error C2065: 'cObj' : undeclared identifier
1>Snippets.cpp(65): error C2227: left of '->Money' must point to class/struct/union/generic type
1>          type is ''unknown-type''
1>Snippets.cpp(65): error C2065: 'AddPrice' : undeclared identifier
1>Snippets.cpp(65): error C3861: 'CGMoneySend': identifier not found
1>Snippets.cpp(66): error C2065: 'cObj' : undeclared identifier
1>Snippets.cpp(66): error C2227: left of '->Init' must point to class/struct/union/generic type
1>          type is ''unknown-type''
1>Snippets.cpp(67): error C2065: 'cObj' : undeclared identifier
1>Snippets.cpp(67): error C2227: left of '->LvlUpPoints' must point to class/struct/union/generic type
1>          type is ''unknown-type''
1>Snippets.cpp(67): error C3861: 'MessageOutput': identifier not found
1>Snippets.cpp(69): error C3861: 'MessageOutput': identifier not found
1>Snippets.cpp(70): fatal error C1075: end of file found before the left brace '{' at 'Snippets.cpp(3)' was matched
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:01.22
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


Also, please put code tags around that. The output box doesn't work as nicely as the code tags (it looks like <> in the buttons beside the editbox).

You'r main issues:
AddStats() is missing a } at the end.
IsAddCmd is not declared anywhere
cObj is not declared anywhere
strcmpi() is not declared anywhere
AddPrice is not declared anywhere
memset() is not declared anywhere
GetParam() is not declared anywhere
AddMax is not declared anywhere
BYTE is not declared anywhere
CGMoneySend() is not declared anywhere
CGLevelUpPointAdd() is not declared anywhere
MessageOutput() is not declared anywhere

You can get BYTE from
#include <windows.h>
You can get memset from
#include <cstring>
Last edited on
And what is the problem? Are you unable to read error message "'IsAddCmd' : undeclared identifier"?
somebody can help me to fix this code?...
Why can't you fix it? The errors are telling you that you have quite a few undeclared variables and functions.
Last edited on
The code is incomplete, not broken. it doesn't need fixing, it needs finishing.

We can't do that for you as we don't know what it is supposed to do.
There seems to be something wrong with a few of your scopes and such.
Topic archived. No new replies allowed.