TextdrawSetString problem
#1

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.
Reply
#2

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

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);
Reply
#4

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.
Reply
#5

It still just says tag mismatch
Reply
#6

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)