and another question: at server side, whats the problem with this:
public int[] playerid;
then in Userjoined:
playerid[player.UserId] = 1; <--------- it saz theres a problem with this but i dont know what..
Unhandled message
fuloprichard zei
een tijd geleden | Bericht #2
Canzecto zei
een tijd geleden | Bericht #3I cannot tell you about the first part. However the second question, do you have a debug info to go with that error? Don't know which IDE you are using or simply going notepad->compiler. Guessing its C# with express edition?
It should tell you whats wrong, that information might be useful in giving you a right response.
Some things you can check so far. My experience is mostly with C++ and Java. Don't know if C# likes the [] (array accessor) to be after the type instead of after the identifier. Maybe try public int playerid[]. This however might be totally wrong and again, error information would be good help.
Other things to check is:
- That you have accessrights/within scope to/of the values you are trying to access.
- The problem might be in the code previous to the assignment, maybe you forgot some symbol in the code just before this segment, like forgetting to close an arguement?
- Out of bounds error? You enter a situation where you try to access data that doesnt exist and you are therefore out of the bounds of the array.
--- Is it a checked or unchecked error, like, does it happen at execution/testing whatever, or on compile-time.
Just alot of ideas for you to test out, just know that problems are easierly solved by providing the context and the effect.
:) Hope it helps, and good luck on your project.
It should tell you whats wrong, that information might be useful in giving you a right response.
Some things you can check so far. My experience is mostly with C++ and Java. Don't know if C# likes the [] (array accessor) to be after the type instead of after the identifier. Maybe try public int playerid[]. This however might be totally wrong and again, error information would be good help.
Other things to check is:
- That you have accessrights/within scope to/of the values you are trying to access.
- The problem might be in the code previous to the assignment, maybe you forgot some symbol in the code just before this segment, like forgetting to close an arguement?
- Out of bounds error? You enter a situation where you try to access data that doesnt exist and you are therefore out of the bounds of the array.
--- Is it a checked or unchecked error, like, does it happen at execution/testing whatever, or on compile-time.
Just alot of ideas for you to test out, just know that problems are easierly solved by providing the context and the effect.
:) Hope it helps, and good luck on your project.
rdz zei
een tijd geleden | Bericht #4In your 2nd question you show the declaration of 'playerid' and the you assign a value to 'UserId'... :-S
Either i simply do not get the question, or you are comparing apples to peres here.
edit: i see now i am a little late with responding here. :-X
Either i simply do not get the question, or you are comparing apples to peres here.
edit: i see now i am a little late with responding here. :-X
Laatst gewijzigd een tijd geleden
Canzecto zei
een tijd geleden | Bericht #5Yeah i noticed too that it looks like his user is no longer active :) Just alittle too late. But to answer your question.
He is using the value of player.UserId in the array accessor. Its actually correct if its what he wants to do.
MyArray [ NUMBER OF ELEMENT ]
So, if I do this:
public int[] playerId = new int[5]; // however you do it :P
then you can access all 5 variables, within the array through the accessor by using another variable (or just constant), like this:
for ( int x = 0; x < 5; x++ )
{
println/cout/printf/trace playerId [ x ] ;
}
Please notice that in most languages the array must be initialized, as apposed to what the first poster did :) just noticed.
You need to have your object reference (in this case int[]) point at some memory for it to work usually. Again its dependent on your programming language.
Also please note that it is different between language whether or not they resets the memory assigned to your variables, meaning a new int my get reset to 0 at initialization, or it might regain the int value of the 4 bytes it has been granted as memory space.
--- Again the problem is that the original poster havent given us any sort of error message to follow, he is simply saying "this is wrong" <-- fix it
He is using the value of player.UserId in the array accessor. Its actually correct if its what he wants to do.
MyArray [ NUMBER OF ELEMENT ]
So, if I do this:
public int[] playerId = new int[5]; // however you do it :P
then you can access all 5 variables, within the array through the accessor by using another variable (or just constant), like this:
for ( int x = 0; x < 5; x++ )
{
println/cout/printf/trace playerId [ x ] ;
}
Please notice that in most languages the array must be initialized, as apposed to what the first poster did :) just noticed.
You need to have your object reference (in this case int[]) point at some memory for it to work usually. Again its dependent on your programming language.
Also please note that it is different between language whether or not they resets the memory assigned to your variables, meaning a new int my get reset to 0 at initialization, or it might regain the int value of the 4 bytes it has been granted as memory space.
--- Again the problem is that the original poster havent given us any sort of error message to follow, he is simply saying "this is wrong" <-- fix it
Antwoord op onderwerp
Schrijf je nu in om te kunnen antwoorden op onderwerpen
fuloprichard zei
een tijd geleden | Bericht #1