Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Tech Support (https://forums.graalonline.com/forums/forumdisplay.php?f=7)
-   -   playerscount (https://forums.graalonline.com/forums/showthread.php?t=38438)

Graal2001_NAT 09-23-2002 08:27 AM

playerscount
 
is kindof buggy for me, it is giving me two different variables for players...
when used clientsided, it counts me (1) and I think it is also counting two npcs with showcharacter; so that's 3
serverside its giving me 1, which is the correct number
Could something please be done to make playerscount clientsided work right?

gokux33 09-24-2002 08:33 AM

Re: playerscount
 
Quote:

Originally posted by Graal2001_NAT
is kindof buggy for me, it is giving me two different variables for players...
when used clientsided, it counts me (1) and I think it is also counting two npcs with showcharacter; so that's 3
serverside its giving me 1, which is the correct number
Could something please be done to make playerscount clientsided work right?

No, because plaerscount is a serverside variable. Use saves.

Graal2001_NAT 09-24-2002 08:34 AM

playerscount isnt only a serverside var, if you could just do with(players[index]) then there would be no use to use players[index].x which I need to use since constantly accessing serverside from a clientside script using weapons is laggy

Kaimetsu 09-25-2002 01:12 AM

Can't you just use a distinguishing characteristic (like an id of -1 or whatever they have) to filter out the NPCs?

Graal2001_NAT 09-25-2002 03:58 AM

Quote:

Originally posted by Kaimetsu
Can't you just use a distinguishing characteristic (like an id of -1 or whatever they have) to filter out the NPCs?
thank you, I had forgotten about players[index].id

Com013 09-26-2002 12:40 AM

Quote:

Originally posted by Kaimetsu
Can't you just use a distinguishing characteristic (like an id of -1 or whatever they have) to filter out the NPCs?
That doesn't work anymore - even showcharacter NPCs have a positive ID. Unfortunatly.
Use strlen(#n(i))>0 or something like that. I was thinking of players[i]fullhearts>0 but I fear that doesn't work online (client-side).

Kaimetsu 09-26-2002 01:28 AM

Quote:

Originally posted by Com013

That doesn't work anymore - even showcharacter NPCs have a positive ID. Unfortunatly.
Use strlen(#n(i))>0 or something like that. I was thinking of players[i]fullhearts>0 but I fear that doesn't work online (client-side).

Well, there's bound to be some characteristic feature that you can use. Like an #a of "" or whatever.

Tyhm 09-26-2002 01:35 AM

Can't read #a(index)

Kaimetsu 09-26-2002 01:38 AM

Quote:

Originally posted by Tyhm
Can't read #a(index)
Still? I coulda sworn Stefan made it so that we could. Guess I must be thinking of something else.

Graal2001_NAT 09-26-2002 02:40 AM

Quote:

Originally posted by Com013

That doesn't work anymore - even showcharacter NPCs have a positive ID. Unfortunatly.
Use strlen(#n(i))>0 or something like that. I was thinking of players[i]fullhearts>0 but I fear that doesn't work online (client-side).

for(a=0;a<playerscount;a++){
if(players[a].id!=-1){
worked for me (and #n wouldnt work if an npc was given a nickname with setcharprop #n)

BinaryCrash 09-26-2002 11:00 PM

filter the npcs using
if (!players[i].hearts=0) { } //not npc

Com013 09-27-2002 12:03 AM

players[...].id never worked for me. At least not offline.

players[...].hearts is worse than checking the nickname. Many showcharacter NPCs are using hearts.

Admins 09-27-2002 12:14 AM

On client-side the showcharacter npcs can be accessed like players. That's an old feature that has been added because for graphical things npcs and players are like the same. It is still helpful sometimes, on graal2002 we use it for displaying the hp bar for all players and monsters.

On server-side its not possible, only players are in the playerlist because players and npcs are quite different, most scripts that want to access players dont want to do stuff with showcharacter npcs.

I will check the id thing, normally it should be -1 for showcharacter npcs (when accessed as player)

Com013 09-27-2002 12:21 AM

Quote:

Originally posted by Stefan

I will check the id thing, normally it should be -1 for showcharacter npcs (when accessed as player)

I think it is currently using the npcs[..].id for it...

Com013 09-27-2002 03:36 AM

Quote:

Originally posted by Stefan
on graal2002 we use it for displaying the hp bar for all players and monsters.
I'm off-topic now, but how do you hide the default hearts and spar rating display over the players?

Graal2001_NAT 09-27-2002 03:52 AM

Quote:

Originally posted by BinaryCrash
filter the npcs using
if (!players[i].hearts=0) { } //not npc

npcs can have hearts guy

Tyhm 09-27-2002 04:03 AM

Actually, I did some testing, it seems to be taking the NPC id and %ing it by 32767 or so.

Of course, when I said it, nobody listened...^_~

BinaryCrash 09-27-2002 06:11 AM

Quote:

Originally posted by Graal2001_NAT

npcs can have hearts guy

i mean if they don't use hearts on npcs and use another variable for hearts.

Graal2001_NAT 09-30-2002 01:54 AM

Quote:

Originally posted by Tyhm
Actually, I did some testing, it seems to be taking the NPC id and %ing it by 32767 or so.

Of course, when I said it, nobody listened...^_~

o_O what kindof level would have >32767 npcs

Falcor 09-30-2002 02:38 AM

Quote:

Originally posted by Graal2001_NAT

o_O what kindof level would have >32767 npcs

a gmap?

Graal2001_NAT 09-30-2002 04:01 AM

Quote:

Originally posted by Falcor


a gmap?

which (i dont think) are enabled on classic? that would have to be a huge gmap to get that many npcs o.O I wonder if the 2k2 gmaps even have that many...

Com013 09-30-2002 04:16 AM

Quote:

Originally posted by Graal2001_NAT

which (i dont think) are enabled on classic

Why shouldn't they being enabled? I can even use them offline. I never tried to use them on Classic, because the old arrows wouldn't work anymore.

Graal2001_NAT 09-30-2002 04:29 AM

Quote:

Originally posted by Com013

Why shouldn't they being enabled? I can even use them offline. I never tried to use them on Classic, because the old arrows wouldn't work anymore.

different kinds of g-servers (now why does this have to remain cencered =/), only server I have gotten gmaps to work great on is 2k1

Tyhm 10-01-2002 01:13 AM

?
Um, it's playerid, not npc id - so the question should be when will there ever be more than 32767 players on the server.

Com013 10-02-2002 03:40 AM

Now I tested it again (offline), and the players[..].id was -1. So it is working.
But I remember it not working, and I couldn't read it anywhere in the newfeatures that it was fixed... Strange. :confused:


All times are GMT +2. The time now is 11:01 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.