need help with textdraw
#1

i have a textdraw which show the score of each team , its works fine but if i wrote /gmx , it just show when a player spawn then dissappears in 2 seconds , anyway to fix this :


Note : Tell me if u need to see anything in my script
Reply
#2

Edit : Not When /gmx , when the gamemode restarts with anyways (gmx , score reach , etc..)
Reply
#3

Post your code.
Reply
#4

Those are the parts including the textdraw :

OnplayerConnect :

Код:
public OnPlayerConnect(playerid)
{
 	gPlayerUsingLoopingAnim[playerid] = 0;
	gPlayerAnimLibsPreloaded[playerid] = 0;
 	dini_Create("entered.txt");
  TextDrawShowForPlayer(playerid,Textdraw2);
	reply[playerid] = 0;
  SendClientMessage(playerid,0xFF0000AA,"Air Combat By Etch");
	SendClientMessage(playerid,0xFF0000AA,"[W E L C O M E]");
	GameTextForPlayer(playerid,"~w~~y~SA-MP: ~r~Air ~g~Combat",5000,5);
	SendPlayerFormattedText(playerid, "Welcome To Air Combat, If Your Are New type /help.", 0);
	//SendClientMessageToAll(COLOR_GREY,string);
	gActivePlayers[playerid]++;
	gLastGaveCash[playerid] = GetTickCount();
	TextDrawShowForPlayer(playerid,Textdraw2);
	return 1;
 	
}
OnPlayerSpawn:
Код:
public OnPlayerSpawn(playerid)
{
  if(!gPlayerAnimLibsPreloaded[playerid]) {
  		PreloadAnimLib(playerid,"BOMBER");
  		PreloadAnimLib(playerid,"RAPPING");
  	PreloadAnimLib(playerid,"SHOP");
  		PreloadAnimLib(playerid,"BEACH");
  		PreloadAnimLib(playerid,"SMOKING");
  	PreloadAnimLib(playerid,"FOOD");
  	PreloadAnimLib(playerid,"ON_LOOKERS");
  	PreloadAnimLib(playerid,"DEALER");
		PreloadAnimLib(playerid,"CRACK");
		PreloadAnimLib(playerid,"CARRY");
		PreloadAnimLib(playerid,"COP_AMBIENT");
		PreloadAnimLib(playerid,"PARK");
		PreloadAnimLib(playerid,"INT_HOUSE");
		PreloadAnimLib(playerid,"FOOD");
		PreloadAnimLib(playerid,"PED");
		gPlayerAnimLibsPreloaded[playerid] = 1;
	}
	TextDrawShowForPlayer(playerid,Textdraw2);
	if(gTeam[playerid] == TEAM_LS)
  	{
  		SetPlayerColor(playerid,COLOR_GREEN);
  	}
  	else
  	{
  	if(gTeam[playerid] == TEAM_LV)
  	{
  		SetPlayerColor(playerid,COLOR_YELLOW);
  	}
  }
  return 1;
}
OnGameModeInit:
Код:
public OnGameModeInit()
{

  Textdraw2 = TextDrawCreate(11.000000,273.000000,"Los Santos: 0 ~n~~n~~y~Las Venturas: 0");
	TextDrawAlignment(Textdraw2,0);
	TextDrawBackgroundColor(Textdraw2,0x000000ff);
	TextDrawFont(Textdraw2,1);
	TextDrawLetterSize(Textdraw2,0.699999,1.600000);
	TextDrawColor(Textdraw2,0x00ff0099);
	TextDrawSetOutline(Textdraw2,1);
	TextDrawSetProportional(Textdraw2,1);
	TextDrawSetShadow(Textdraw2,1);
return 1;
}
OnPlayerDeath:
Код:
public OnPlayerDeath(playerid,killerid,reason)
{

  if(gTeam[playerid]==TEAM_LS)
  {
  lvscore++;
  }else{
  lsscore++;
  }
  new tmpstr[50];
  format(tmpstr,sizeof(tmpstr),"Los Santos: %d  ~n~~n~~y~Las Venturas: %d",lsscore,lvscore);
  TextDrawSetString(Textdraw2,tmpstr);


	if(lsscore == 10) {
  SendRconCommand("gmx");
  GameTextForAll("~g~Los Santos Won The Round!!", 2500,5);
  }
  
  else if(lvscore == 10) {
  SendRconCommand("gmx");
  GameTextForAll("~y~Las Venturas Won The Round!!", 2500,5);
 	}

  return 1;

}
Reply
#5

So it works when you first run your gamemode, but not when you restart the game mode.
Possibly because you didn't destroy it on exit
public OnGameModeExit()
{
TextDrawDestroy(Textdraw2);
}
Reply
#6

didnt work
Reply
#7

So it works when you first run your gamemode, but not when you restart the game mode?
Reply
#8

yes .it was working yesterday fine , dunno what happend
Reply
#9

It was working yesterday.
But does it work when you run your game mode now?
Then fails when you reload the gamemode with the rcon command?
Reply
#10

example i opened samp-server.exe , and join the server , it works , but when a team reach score limit (which should "gmx")
or i write /gmx , gamemode reload but textdraw doesnt show exept when i restart samp-server.exe
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)