28.12.2018, 17:02
I feel like you're over complicating things for no reason. It looks like you're manually trying to keep track of 3D Text IDS when Create3DText already returns it's corresponding ID.
Something like this should work:
Something like this should work:
PHP код:
new
Text3D:PlayerLoginLabel[MAX_PLAYERS] = { Text3D:INVALID_3DTEXT_ID, ... }, // So each player has it's own 3DTextLabel.
LoginLabelDespawnTimer[MAX_PLAYERS]; // A timer for each label to despawn. (Although technically, unless you specifically need to use the timer ids somewhere else in your code; you don't even need a variable to store all the timer ids.)
public OnPlayerSpawn(playerid)
{
if(!IsValid3DTextLabel(PlayerLoginLabel[playerid])) // In case someone spawns multiple times while the 3D Text is valid/created.
{
PlayerLoginLabel[playerid] = Create3DTextLabel(. . . ); // Put your Create3DTextLabel here.
LoginLabelDespawnTimer[playerid] = SetTimerEx("SpawnLabelTimer", 20000, false, "i", playerid);
}
return 1;
}
forward SpawnLabelTimer(playerid);
public SpawnLabelTimer(playerid)
{
if(IsValid3DTextLabel(PlayerLoginLabel[playerid]))
{
Delete3DTextLabel(PlayerLoginLabel[playerid]);
PlayerLoginLabel[playerid] = Text3D:INVALID_3DTEXT_ID;
}
}