- Joined
- Aug 16, 2012
- Messages
- 55
- Reaction score
- 2
This is my command post create by me
I try to make a command to block command aforementioned changed in database in collum "BanPost 1 to 0 for a specific player
And define command in void ChatDataSend(DWORD gObjId,LPBYTE Protocol)
I try this but i get a error "error C2065: 'Index' : undeclared identifier"
Code:
void postt(int aIndex,char* msg)
{
OBJECTSTRUCT * gObj = (OBJECTSTRUCT*)OBJECT_POINTER(aIndex);
int PostPrice = GetPrivateProfileInt("Post","PostPrice",5000000,".\\ZYGHY.ini");
int PostCount = GetPrivateProfileInt("Post","Active",1,".\\ZYGHY.ini");
int PostLevel = GetPrivateProfileInt("Post","Level",50,".\\ZYGHY.ini");
if(aIndex <= OBJECT_MIN && aIndex >= OBJECT_MAX)
return;
if(aIndex > OBJECT_MAX)
return;
char Query[512] = {0};
wsprintf(Query,"SELECT BanPost FROM Character WHERE Name = '%s'", gObj->Name);
char *Result = SQL.ReturnString("BanPost",Query);
if(*Result == 1)
{
if(gObj->Level > PostLevel)
{
if(gObj->Money < PostPrice)
{
MsgNormal(aIndex,"[OnlygMU] :Hey,you don`t have zen for /post!");
}
else
{
if(PostCount == 1)
{
Messages.outYellow(aIndex,"%s:[post]: %s",gObj->Name,msg);
(gObj->Money -= PostPrice);
GCMoneySend(gObj->m_Index, gObj->Money);
}
else
{
MsgNormal(aIndex,"[OnlygMU] :Hey,/post command disabled!");
}
}
}
else
{
MsgNormal(aIndex,"[OnlygMU] : You short level to use /post!");
}
}
else
{
MsgNormal(aIndex,"[OnlygMU] : Are you banned on /post !");
}
}
I try to make a command to block command aforementioned changed in database in collum "BanPost 1 to 0 for a specific player
Code:
void banpost(DWORD gObjId, char *Msg,char Index)
{
OBJECTSTRUCT * gObj = (OBJECTSTRUCT*)OBJECT_POINTER(gObjId);
OBJECTSTRUCT * tObj = (OBJECTSTRUCT*)OBJECT_POINTER(Index);
char Query[512];
if(gObj->Authority != 32)
{
MsgNormal(gObjId,"[OnlygMU] : Command only for GM's");
return;
}
wsprintf(Query,"UPDATE Character SET BanPost = 0 WHERE Name = '%s'", tObj->Name);
SQLExecute(Query);
SQL.DoQuery(Query);
Messages.outYellow(gObjId, "[BanPost] %s post banned.", Msg);
Messages.outYellow(gObjId, "[BanPost] Was banned by %s.", gObj->Name);
}
And define command in void ChatDataSend(DWORD gObjId,LPBYTE Protocol)
Code:
if(!memcmp(&Protocol[13],"/banpost",strlen("/banpost")))
{
banpost(gObjId,(char*)Protocol+13+strlen("/banpost"),(char)Protocol+13+strlen("/banpost"));
}
I try this but i get a error "error C2065: 'Index' : undeclared identifier"
Code:
if(!memcmp(&Protocol[13],"/banpost",strlen("/banpost")))
{
banpost(gObjId,(char*)Protocol+13+strlen("/banpost"),Index);
}

