TextDraws problem
#1

I'm kinda newbie to PAWNO and i have following problem:
Код:
//This is just part of code.
new Text:SPAWN_Text[MAX_PLAYERS];
public SPAWN_MainInit()
{
  for (new i=0;i<MAX_PLAYERS;i++) {
	SPAWN_Text[i]=TextDrawCreate(240.0,580.0,"Respawn in 15 sec.");
	TextDrawAlignment(SPAWN_Text[i],2);
	TextDrawFont(SPAWN_Text[i],2);
	TextDrawColor(SPAWN_Text[i],COLOR_LIGHTRED);
	TextDrawHideForAll(SPAWN_Text[i]);
	}
}
public SPAWN_Timer()
{
  for(new i=0;i<MAX_PLAYERS;i++)
    {
    if ((SPAWN_Stat[i]==1)&&(IsPlayerConnected(i))) {
	TextDrawHideForPlayer(i,SPAWN_Text[i]);
	SPAWN_TimeLeft[i]=SPAWN_TimeLeft[i]-1;
        if (SPAWN_TimeLeft[i]<=0) {SPAWN_Respawn(i);return;}
	new a[64];
	format(a,sizeof(a),"Respawn in %d sec.",SPAWN_TimeLeft[i]);
	TextDrawSetString(SPAWN_Text[i],a);
	TextDrawShowForPlayer(i,SPAWN_Text[i]);
	}
    }
}
It spawns players right after right time but doesn't show text draw =[ . Anyone know what might be problem?
Reply
#2

Sad bump. Help anyone?
Reply
#3

What is SPAWN_Stat and where does it get set?
Reply
#4

Quote:

What is SPAWN_Stat and where does it get set?

It's status of spawn:
0-player is choosing class/dead
1-player is waiting for spawn
2-player is spawned

OnPlayerDeath: setting 0
OnPlayerConnect: setting 0
OnPlayerSpawn: setting 1 (and SPAWN_TimeLeft).

Here is (almost) whole code:
Код:
new SPAWN_Stat[MAX_PLAYERS];
new SPAWN_TimeLeft[MAX_PLAYERS];
new Text:SPAWN_Text[MAX_PLAYERS];

public SPAWN_WaitSpawn(playerid)
{
  if (gTeam[playerid]==TEAM_SWAT) {
    SetPlayerPos(playerid,-1131,1058,1347);
    SetPlayerInterior(playerid,10);
    } else {
    SetPlayerPos(playerid,-973,1062,1348);
    SetPlayerInterior(playerid,10);
    }
  SetPlayerWorldBounds(playerid,-1137,-967,1101,1019);
  SPAWN_TimeLeft[playerid]=15;
  SPAWN_Stat[playerid]=1;
}

public SPAWN_NormSpawn(playerid)
{
  MIS_Spawn(playerid);
  SPAWN_Stat[playerid]=2;
}

public SPAWN_Call(playerid)//Used at OnPlayerSpawn
{
  if (SPAWN_Stat[playerid]==0) {
    SPAWN_WaitSpawn(playerid);
    SPAWN_TimeLeft[playerid]=15;
    SPAWN_Stat[playerid]=1;
    }
}

public SPAWN_Timer()
{
  for(new i=0;i<MAX_PLAYERS;i++)
    {
    if ((SPAWN_Stat[i]==1)&&(IsPlayerConnected(i))) {
	TextDrawHideForPlayer(i,SPAWN_Text[i]);
	SPAWN_TimeLeft[i]=SPAWN_TimeLeft[i]-1;
        if (SPAWN_TimeLeft[i]<=0) {SPAWN_Respawn(i,0);return;}
	new a[64];
	format(a,sizeof(a),"Respawn in %d sec.",SPAWN_TimeLeft[i]);
	TextDrawSetString(SPAWN_Text[i],a);
	TextDrawShowForPlayer(i,SPAWN_Text[i]);
	}
    }
}

public SPAWN_Death(playerid)
{
  SPAWN_Stat[playerid]=0;
}

public SPAWN_Init(playerid)
{
  SPAWN_Stat[playerid]=0;
}

public SPAWN_MainInit()
{
  for (new i=0;i<MAX_PLAYERS;i++) {
	SPAWN_Text[i]=TextDrawCreate(240.0,580.0,"Respawn in 15 sec.");
	//TextDrawAlignment(SPAWN_Text[i],2);
	//TextDrawFont(SPAWN_Text[i],2);
	//TextDrawColor(SPAWN_Text[i],COLOR_LIGHTRED);
	TextDrawHideForAll(SPAWN_Text[i]);
	}
}

public SPAWN_Respawn(playerid,type)//0-Normal, 1-InWaitRoom
{
  if (!IsPlayerConnected(playerid)) {return;}

  if (type==0) {SPAWN_NormSpawn(playerid);}else{SPAWN_WaitSpawn(playerid);}
}
And as i said above: Spawn works ok, only problem is textdraw.
Everything is connected to right callbacks - checked it.
Reply
#5

bump for help.
Reply
#6

Quote:
Originally Posted by payl
Посмотреть сообщение
I'm kinda newbie to PAWNO and i have following problem:
Код:
//This is just part of code.
new Text:SPAWN_Text[MAX_PLAYERS];
public SPAWN_MainInit()
{
  for (new i=0;i<MAX_PLAYERS;i++) {
	SPAWN_Text[i]=TextDrawCreate(240.0,580.0,"Respawn in 15 sec.");
	TextDrawAlignment(SPAWN_Text[i],2);
	TextDrawFont(SPAWN_Text[i],2);
	TextDrawColor(SPAWN_Text[i],COLOR_LIGHTRED);
	TextDrawHideForAll(SPAWN_Text[i]);
	}
}
public SPAWN_Timer()
{
  for(new i=0;i<MAX_PLAYERS;i++)
    {
    if ((SPAWN_Stat[i]==1)&&(IsPlayerConnected(i))) {
	TextDrawHideForPlayer(i,SPAWN_Text[i]);
	SPAWN_TimeLeft[i]=SPAWN_TimeLeft[i]-1;
        if (SPAWN_TimeLeft[i]<=0) {SPAWN_Respawn(i);return;}
	new a[64];
	format(a,sizeof(a),"Respawn in %d sec.",SPAWN_TimeLeft[i]);
	TextDrawSetString(SPAWN_Text[i],a);
	TextDrawShowForPlayer(i,SPAWN_Text[i]);
	}
    }
}
It spawns players right after right time but doesn't show text draw =[ . Anyone know what might be problem?
Код:
public SPAWN_MainInit()
{
  for (new i=0;i<MAX_PLAYERS;i++) {
	TextDrawHideForAll(SPAWN_Text[i]);
	}
}
Код:
public OnGameModeInit()
{
  for (new i=0;i<MAX_PLAYERS;i++) {
	SPAWN_Text[i]=TextDrawCreate(240.0,580.0,"Respawn in 15 sec.");
	TextDrawAlignment(SPAWN_Text[i],2);
	TextDrawFont(SPAWN_Text[i],2);
	TextDrawColor(SPAWN_Text[i],COLOR_LIGHTRED);

	}
}
?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)