07.08.2018, 13:33
So,i created a system to save chosen player team. The team is saved without problems, but it doesn't set it when i relog.
I have an autospawn after the player logged in using SpawnPlayer(playerid);
This is AssignPlayerData query which loads account stats when player has been logged:
For saving team when player disconnects i use GetPlayerTeam which saves correctly the team id.
But if i relog, i get autospawned yes, but assigned to wrong team.
Example: I have 2 teams: Civilians/Cops, i choose Cops, so team id 1 (based on classid), team id 1 gets saved correctly on disconnect. When i relog and autospawn, i spawn as team 0 (civilian).
What's wrong?
I have an autospawn after the player logged in using SpawnPlayer(playerid);
This is AssignPlayerData query which loads account stats when player has been logged:
pawn Код:
AssignPlayerData(playerid)
{
cache_get_value_int(0, "id", Player[playerid][ID]);
cache_get_value_int(0, "PlayerTeam", Player[playerid][PlayerTeam]);
SetPlayerTeam(playerid,Player[playerid][PlayerTeam]);
return 1;
}
But if i relog, i get autospawned yes, but assigned to wrong team.
Example: I have 2 teams: Civilians/Cops, i choose Cops, so team id 1 (based on classid), team id 1 gets saved correctly on disconnect. When i relog and autospawn, i spawn as team 0 (civilian).
What's wrong?