So I'm getting a number of a qboolean, which works fine:
g_Engine.Con_Printf("%d\n", GetPlayerUniqueID); // Print out my number / ID.
Then I get the number of it, now if I get a number shouldn't it be possible to do if ( GetPlayerUniqueID == number ) ? The reason is that it doesn't work.
This is my error: operand types are incompatible ("qboolean (*)(int iPlayer, char *playerID)" and "int")
This is the structure of the qboolean function:
qboolean (*GetPlayerUniqueID)(int iPlayer, char playerID[16]);
I know booleans cannot return more than 0 and 1, but I don't really know what's going on if I can get the number of this function but I cannot check if it has a certain number. This is for/from a game.
in the left side GetPlayerUniqueID is a function that is converted to a pointer to function. You can not compare a pointer to function with an integer. And the compiler says you about such restriction. read the compiler messages. They are displayed specially for you.
I think you should use the following form
GetPlayerUniqueID( SomeInt, SomePointerToChar) == number
provided that return type of the function is an integer type.
So I tried what you said, now I debugged that line and I got a ID of 0:
char * playerID[16] // Global, above all functions
// All under a looping function
if ( g_Engine.GetPlayerUniqueID( 0, playerID[16] ) == 33535 ) // id
{
g_Engine.Con_Printf("Right ID\n");
}
else
{
g_Engine.Con_Printf("Wrong ID\n");
}
g_Engine.Con_Printf("%d\n", g_Engine.GetPlayerUniqueID(0, playerID[16]));
// ID = 0
If I have (1, playerID[16]) as parameters, my game will crash so it seems as 0 is the first right parameter but then something isn't right with playerID[16].
Also this prints my real ID:
g_Engine.Con_Printf("%d\n", g_Engine.GetPlayerUniqueID);
// Gets a unique ID for the specified player. This is the same even if you see the player on a different server.
// iPlayer is an entity index, so client 0 would use iPlayer=1.
// Returns false if there is no player on the server in the specified slot.
There is a description from that structure, so I guess it's playerID that is wrong now, probably it prints 0 because it's not defined somewhere else. So that may mean I would need to hook the whole function into this function where I am?
char *playerID[16]
Error: argument of type "char **" is incompatible with parameter of type
" *char"
Also EDIT: I changed playerID[16] to playerID when I now made (0, playerID), still it prints 0 as ID.
EDIT again, g_Engine gets the function, couldn't find anything usable to playerID[16]. So I've no clue now... == number works but it cannot get the real number. I also tried to put playerID once again instead of playerID[16] in (xxx) parameters, it worked if I changed char * playerID[16]; to char playerID[16]; but still prints 0 as ID.
Well if you are saying that 0-15 indexes is only acceptable then I did this,
g_Engine.GetPlayerUniqueID( 0, playerID[16] )
to
g_Engine.GetPlayerUniqueID( 0, playerID[15] )
still it prints 0 as my ID.