SA-MP Forums Archive
TextdrawSetString problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: TextdrawSetString problem (/showthread.php?tid=144208)



TextdrawSetString problem - Typical_Cat - 26.04.2010

I am trying to make a score system so when you kill the other team, ur teams score goes up by 1, And ur teams score is held at the bottom of the screen in a text draw here my code.

Код:
	new float: score1, score2;

  if (gteam[killerid] == gteam[soldier])
  {
  format, "Soldiers: %s",score1+1);
  TextDrawSetString(Textdraw0);
  TextDrawShowForPlayer(playerid);
  return 1;
  }

  if (gteam[killerid] == gteam[terrorist])
  {
  format, "Terrorists: %s",score2+1);
  TextDrawSetString(Textdraw1);
  TextDrawShowForPlayer(playerid);
  return 1;
  }
	return 1;
	}
but it has these errors, i majorly messed up.
Код:
C:\Users\Typical_Cats\Desktop\GTA San andreas\gamemodes\ModernWarfare.pwn(386) : error 076: syntax error in the expression, or invalid function call
C:\Users\Typical_Cats\Desktop\GTA San andreas\gamemodes\ModernWarfare.pwn(386) : error 029: invalid expression, assumed zero
C:\Users\Typical_Cats\Desktop\GTA San andreas\gamemodes\ModernWarfare.pwn(386) : warning 215: expression has no effect
C:\Users\Typical_Cats\Desktop\GTA San andreas\gamemodes\ModernWarfare.pwn(387) : warning 202: number of arguments does not match definition
C:\Users\Typical_Cats\Desktop\GTA San andreas\gamemodes\ModernWarfare.pwn(388) : warning 202: number of arguments does not match definition
C:\Users\Typical_Cats\Desktop\GTA San andreas\gamemodes\ModernWarfare.pwn(394) : error 076: syntax error in the expression, or invalid function call
C:\Users\Typical_Cats\Desktop\GTA San andreas\gamemodes\ModernWarfare.pwn(394) : error 029: invalid expression, assumed zero
C:\Users\Typical_Cats\Desktop\GTA San andreas\gamemodes\ModernWarfare.pwn(394) : warning 215: expression has no effect
C:\Users\Typical_Cats\Desktop\GTA San andreas\gamemodes\ModernWarfare.pwn(395) : warning 202: number of arguments does not match definition
C:\Users\Typical_Cats\Desktop\GTA San andreas\gamemodes\ModernWarfare.pwn(396) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.



Re: TextdrawSetString problem - Rac3r - 26.04.2010

Код:
  format, "Soldiers: %s",score1+1);
  TextDrawSetString(Textdraw0);
Код:
  new string[40];
  format(string, 40, "Soldiers: %s",score1+1);
  TextDrawSetString(Textdraw0, string);
Код:
TextDrawShowForPlayer(Textdraw0, playerid);



Re: TextdrawSetString problem - Typical_Cat - 26.04.2010

I got this error


Код:
C:\Users\Typical_Cats\Desktop\GTA San andreas\gamemodes\ModernWarfare.pwn(389) : warning 213: tag mismatch
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
That line is the first one that says - format(string, 40, "Soldiers: %s",score1+1);


Re: TextdrawSetString problem - Correlli - 26.04.2010

Change:
Quote:
Originally Posted by Rac3r
Код:
TextDrawShowForPlayer(Textdraw0, playerid);
to:
pawn Код:
TextDrawShowForPlayer(playerid, Textdraw0);
And use %f for format the score1 and score2 if you're using them as float variables.


Re: TextdrawSetString problem - Typical_Cat - 26.04.2010

It still just says tag mismatch


Re: TextdrawSetString problem - Rac3r - 26.04.2010

Ooops, got my params the wrong way round, thanks Don.

Код:
new Float:score1, Float:score2;