Do not show TEXTDRAW when watching a player
#2

Quote:
Originally Posted by EvgeniyHostel1992
Посмотреть сообщение
PHP код:
new PlayerText:HealthTv;
        
HealthTv CreatePlayerTextDraw(playerid,195.000000399.000000"Health:");
    
PlayerTextDrawBackgroundColor(playerid,HealthTv255);
    
PlayerTextDrawFont(playerid,HealthTv1);
    
PlayerTextDrawLetterSize(playerid,HealthTv0.5000002.400000);
    
PlayerTextDrawColor(playerid,HealthTv, -16776961);
    
PlayerTextDrawSetOutline(playerid,HealthTv0);
    
PlayerTextDrawSetProportional(playerid,HealthTv1);
    
PlayerTextDrawSetShadow(playerid,HealthTv1);
    
PlayerTextDrawSetSelectable(playerid,HealthTv0); 
Public update 1 second when watching a player
PHP код:
for(new 0MAX_PLAYERSi++)
 {
  if(
IsPlayerConnected(i))
  {
    new 
targ,stringtv[100];
    new 
Float:health;
    
targ gSpectateID[i]; //Spectate -ID player watched
    
GetPlayerHealth(targhealth);
    if(
GetPlayerState(i) == PLAYER_STATE_SPECTATING)
    {
        
format(stringtvsizeof(stringtv),"Health:%2.f ",health);
        
PlayerTextDrawSetString(i,PlayerText:HealthTv,stringtv);
        
PlayerTextDrawShow(i,PlayerText:HealthTv);
        
    }
    }
  } 
textwind is missing (
PHP код:
new PlayerText:HealthTv[MAX_PLAYERS]; // add textdraw for all players
public OnPlayerConnect(playerid)
{
    
HealthTv[playerid] = CreatePlayerTextDraw(playerid,195.000000399.000000"Health:");
    
PlayerTextDrawBackgroundColor(playerid,HealthTv[playerid], 255);
    
PlayerTextDrawFont(playerid,HealthTv[playerid], 1);
    
PlayerTextDrawLetterSize(playerid,HealthTv[playerid], 0.5000002.400000);
    
PlayerTextDrawColor(playerid,HealthTv[playerid], -16776961);
    
PlayerTextDrawSetOutline(playerid,HealthTv[playerid], 0);
    
PlayerTextDrawSetProportional(playerid,HealthTv[playerid], 1);
    
PlayerTextDrawSetShadow(playerid,HealthTv[playerid], 1);
    
PlayerTextDrawSetSelectable(playerid,HealthTv[playerid], 0);
    return 
true;
}
for(new 
0MAX_PLAYERSi++)
 {
  if(!
IsPlayerConnected(i)) continue;
  if(
GetPlayerState(i) == PLAYER_STATE_SPECTATING)
  {
    new 
stringtv[15],Float:health;
    
GetPlayerHealth(gSpectateID[i], health);
    
format(stringtvsizeof(stringtv),"Health:%2.f",health);
    
PlayerTextDrawSetString(i,HealthTv[i],stringtv);
    
PlayerTextDrawShow(i,HealthTv[i]);
   }
  } 
Reply


Messages In This Thread
Do not show TEXTDRAW when watching a player - by EvgeniyHostel1992 - 08.04.2018, 10:38
Re: Do not show TEXTDRAW when watching a player - by ForCop - 08.04.2018, 10:47
Re: Do not show TEXTDRAW when watching a player - by EvgeniyHostel1992 - 08.04.2018, 11:04

Forum Jump:


Users browsing this thread: 1 Guest(s)