Seek Help

All Helbreath Server Source Discussion here.
arcasok
noob
Posts: 11
Joined: Wed Apr 20, 2005 3:54 pm

Post by arcasok »

wat is the code or which function i can get it?
to get the total number of elvines and aresdens
(Note! not the total number of player in server)

thks very much
Slayer
<3 bd long time
Posts: 947
Joined: Thu Mar 17, 2005 9:08 pm

Post by Slayer »

Uhm die?

Or just see how many files you got in your folder with right click, properties
<img src='http://i9.tinypic.com/2vs292h.jpg' border='0' alt='user posted image' />
Aryes
Member
Posts: 114
Joined: Tue Aug 31, 2004 10:14 pm
Location: Brazil

Post by Aryes »

NeukenInDeKeuken wrote: Or just see how many files you got in your folder with right click, properties
Microsoft included the feature to read the ammount of aresden and elvine on folder properties? :huh:
====<span style='color:red'><br>Aryes</span><br>====<br><br>HB United: www.hbuonline.net:<br><br><img src="http://hbtop50.com/button.php?u=hbkhispano" alt="Helbreath Top 50 - Helbreath Silver" border="0" /><br><img src="http://hbtop50.com/button.php?u=dcom" alt="Helbreath Top 50 - Helbreath Silver" border="0" /><br><img src="http://hbtop50.com/button.php?u=tinchocba" alt="Helbreath Top 50 - Helbreath Silver" border="0" /><br><img src="http://hbtop50.com/button.php?u=rafha_bernn" alt="Helbreath Top 50 - Helbreath Silver" border="0" /><br><img src="http://hbtop50.com/button.php?u=HB-Tere" alt="Helbreath Top 50 - Helbreath Silver" border="0" /><br><img src="http://hbtop50.com/button.php?u=Kiruku" alt="Helbreath Top 50 - Helbreath Silver" border="0" />
Jaap
Loyal fan
Posts: 390
Joined: Thu Apr 22, 2004 8:21 am

Post by Jaap »

arcasok wrote: wat is the code or which function i can get it?
to get the total number of elvines and aresdens
(Note! not the total number of player in server)

thks very much
One algorithm to achieve this could be like this,

- Set Aresdens counter to 0.
- Set Elvines counter to 0.
- Loop from 1 to 255 (I)
- Open ascii folder "AscII" + I
- Count number of files in the folder ©
- Loop from 1 to C
- open next file
- parse it (perhaps like the gameserver does, or whatever way you prefer)
- get "character-location" from the chr data file.
- if it is aresden/arehunter: Aresdens++
- if it is elvine/elvhunter: Elvines++
- close file
-----
- close folder
-----

done!
Slayer
&lt;3 bd long time
Posts: 947
Joined: Thu Mar 17, 2005 9:08 pm

Post by Slayer »

Aryes wrote:
NeukenInDeKeuken wrote: Or just see how many files you got in your folder with right click, properties
Microsoft included the feature to read the ammount of aresden and elvine on folder properties? :huh:
Lol, Im tired..didn't really read the question..thought he ment elv+ares
><
<img src='http://i9.tinypic.com/2vs292h.jpg' border='0' alt='user posted image' />
arcasok
noob
Posts: 11
Joined: Wed Apr 20, 2005 3:54 pm

Post by arcasok »

thks Jaap,

But izzit the algorithm u gave me is for the number of elvine n aresden tat have registed to the server.....
And wat i need is ....to create a command like /who ,the only different thing is the command show u how many elvines n aresdens is in the game.(active player)
Jaap
Loyal fan
Posts: 390
Joined: Thu Apr 22, 2004 8:21 am

Post by Jaap »

Oh I see. That's even easier.


void CGame::CountSides(int* aresdens, int* elvines) {
register int i;

for (i = 1; i < DEF_MAXCLIENTS; i++) {

if (m_pClientList != NULL) {

if (memcmp(m_pClientList->m_cLocation, "are", 3) == 0) {
*aresdens++;
} else if (memcmp(m_pClientList->m_cLocation, "elv", 3) == 0) {
*elvines++;
}

}

}



Only thing you need to do is add a command and call the method above like this:

int aresdenCount = 0;
int elvineCount = 0;
CountSides(&aresdenCount, &elvineCount);
wsprintf(G_cTxt, "Aresdens: %d Elvines: %d");

Then just print G_cTxt to whereever you want.
arcasok
noob
Posts: 11
Joined: Wed Apr 20, 2005 3:54 pm

Post by arcasok »

THKs you THKs you THKs you very much Jaap
thks for the code...nice code ......ohyea
arcasok
noob
Posts: 11
Joined: Wed Apr 20, 2005 3:54 pm

Post by arcasok »

sry ...jaap i facing problem again on the code...i edited the code...n the result i get is 0 for both side..and i have 1 aresden player login in the game
the result should be aresden 1 elvine 0

where went wrg?

Jaap
Loyal fan
Posts: 390
Joined: Thu Apr 22, 2004 8:21 am

Post by Jaap »

that depends on what you edited. what did you edit?
arcasok
noob
Posts: 11
Joined: Wed Apr 20, 2005 3:54 pm

Post by arcasok »

i edited the code u gave me


void CGame::CountSides(int* aresdens, int* elvines) {
register int i;

for (i = 0; i < DEF_MAXCLIENTS; i++) {

if (m_pClientList != NULL) {

if (memcmp(m_pClientList->m_cLocation, "are", 3) == 0) {
*aresdens++;
} else if (memcmp(m_pClientList->m_cLocation, "elv", 3) == 0) {
*elvines++;
}

}

}


then in the game.h i add void CountSides(int* aresdens, int* elvines);



my command function is

if (memcmp(cp, "/who", 4) == 0) {
int aresdenCount = 0;
int elvineCount = 0;
CountSides(&aresdenCount, &elvineCount);
char who[100];
wsprintf(who,"Total players connected: %d. Aresden: %d. Elvine: %d.",WORD)m_iTotalGameServerClients,aresdenCount,elvineCount);
}



is there anything wrg?
Jaap
Loyal fan
Posts: 390
Joined: Thu Apr 22, 2004 8:21 am

Post by Jaap »

arcasok wrote: i edited the code u gave me

(...)

is there anything wrg?

Code: Select all

if (memcmp(cp, "/who", 4) == 0) {
    int aresdenCount = 0;
    int elvineCount = 0;
    CountSides(&aresdenCount, &elvineCount);
    char who[100];
    wsprintf(who,"Total players connected: %d. Aresden: %d. Elvine: %d.",WORD)             m_iTotalGameServerClients,aresdenCount,elvineCount);
}
It should be "(WORD)" rather than "WORD)". Probably a spelling error.

Also, that character array containing the "Total players connected: %d. Aresden: %d. Elvine: %d" is not printed to anything yet (perhaps you might want to send it to the client? Or print it to a log file?
arcasok
noob
Posts: 11
Joined: Wed Apr 20, 2005 3:54 pm

Post by arcasok »

the "WORD)" actually is copied error....in my code is"(WORD)"

And one thing mind i ask....izzit this command line should print it to the client?
wsprintf(who,"Total players connected: %d. Aresden: %d. Elvine: %d.",(WORD)m_iTotalGameServerClients,aresdenCount,elvineCount)

let assuming there is only 1 player..
Becoz in game i execute the command it gave me the following result

"Total players connected: 1 ,Aresden: 0. Elvine: 0."


like u mentioned i should print the array on a log file or client?
can u show me how to print it to the client?

thks
arcasok
noob
Posts: 11
Joined: Wed Apr 20, 2005 3:54 pm

Post by arcasok »

oh...i have another function before the "/who" command function end

ShowNotice(iClientH,who);
void CGame::ShowNotice(int iClientH,char *pMsg)
{
SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_NOTICEMSG, NULL, NULL, NULL, pMsg);
}


and i think this is the function tat print the array on the client.

So i think is something wrg in the code u gave me....NEED ur HELP =)
Jaap
Loyal fan
Posts: 390
Joined: Thu Apr 22, 2004 8:21 am

Post by Jaap »

arcasok wrote: the "WORD)" actually is copied error....in my code is"(WORD)"

And one thing mind i ask....izzit this command line should print it to the client?
wsprintf(who,"Total players connected: %d. Aresden: %d. Elvine: %d.",(WORD)m_iTotalGameServerClients,aresdenCount,elvineCount)

let assuming there is only 1 player..
Becoz in game i execute the command it gave me the following result

"Total players connected: 1 ,Aresden: 0. Elvine: 0."


like u mentioned i should print the array on a log file or client?
can u show me how to print it to the client?

thks
Use your ShowNotice to print it to the client.

Also, 1 player but no aresden/elvine would mean that it was a traveller?
Post Reply