![]() |
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? |
Re: playerscount
Quote:
|
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
|
Can't you just use a distinguishing characteristic (like an id of -1 or whatever they have) to filter out the NPCs?
|
Quote:
|
Quote:
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). |
Quote:
|
Can't read #a(index)
|
Quote:
|
Quote:
if(players[a].id!=-1){ worked for me (and #n wouldnt work if an npc was given a nickname with setcharprop #n) |
filter the npcs using
if (!players[i].hearts=0) { } //not npc |
players[...].id never worked for me. At least not offline.
players[...].hearts is worse than checking the nickname. Many showcharacter NPCs are using hearts. |
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) |
Quote:
|
Quote:
|
Quote:
|
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...^_~ |
Quote:
|
Quote:
|
Quote:
|
Quote:
|
Quote:
|
Quote:
|
?
Um, it's playerid, not npc id - so the question should be when will there ever be more than 32767 players on the server. |
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.