So how do I translate "real player index" into userid?
I already looked at another plugin that used teamplay_teambalanced_player, and they seemed to just GetEventInt on userid like normal, but I dont know for sure if that worked for them anyway. It was the class limits plugin. Its sure not working for me.
Here is my plugin:
Code:
HookEvent("achievement_earned",LogAchievement);
public LogAchievement(Handle:event,const String:name[],bool:dontBroadcast) {
decl String:pname[64];
// doing "player" instead of userid on the next line didnt help either
new client = GetClientOfUserId(GetEventInt(event, "userid"));
// Get the name of the player from "client"
GetClientName(client, pname, sizeof(pname));
new achievement = GetEventInt(event, "achievement");
LogMessage("\tplayer %s\tachievement %d",pname,achievement);
}
It keeps printing the hostname of the server for pname.
After I get that working, I was going to look up how to match the achievement numbers with the names, I'll post a list on the wiki when I can figure that out.
And here is a snippit from MaxClass.sp:
Code:
HookEvent("teamplay_teambalanced_player", PlayerTeamBalanced);
public Action:PlayerTeamBalanced(Handle:event, const String:name[], bool:dontBroadcast){
if(!isrunning)
return;
if(!GetConVarBool(IsMaxPlayersOn))
return;
new client = GetClientOfUserId(GetEventInt(event, "userid"));
...