29.12.2018, 05:38
Quote:
What's your define of COLOR_YELLOW? What alpha are you using? E.G. 0xFFFF00FF . Also add KillTimer(LoginLabelDespawnTimer[playerid]); at the end of the timer.
|
Anyways, my current issue is that it only works for the first player that gets the label. The other players, all have the label above their head until they logout instead of after 20 seconds.
The code right now:
Код:
new Text3D:PlayerSpawnLabel[MAX_PLAYERS] = { Text3D:INVALID_3DTEXT_ID, ... }, // So each player has it's own 3DTextLabel. SpawnLabelDespawnTimer[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(PlayerSpawnLabel[playerid])) { PlayerSpawnLabel[playerid] = Create3DTextLabel("I just spawned.", COLOR_YELLOW, 0, 0, 0, 20, 0); Attach3DTextLabelToPlayer(PlayerSpawnLabel[playerid], playerid, 0.0, 0.0, 0.27); SpawnLabelDespawnTimer[playerid] = SetTimerEx("SpawnLabelTimer", 20000, false, "i", playerid); } return 1; } forward SpawnLabelTimer(playerid); public SpawnLabelTimer(playerid) { if(IsValid3DTextLabel(PlayerSpawnLabel[playerid])) { Delete3DTextLabel(PlayerSpawnLabel[playerid]); PlayerSpawnLabel[playerid] = Text3D:INVALID_3DTEXT_ID; KillTimer(SpawnLabelDespawnTimer[playerid]); } }