Help - Wanted Level System Textdraws
#1

forward Wanted(playerid);
new Text:Wanted;

On Game Mode Init:
SetTimer("Wanted", 1000, true);
Wanted = TextDrawCreate(497.000000, 129.000000, " ");
TextDrawFont(Wanted, 1);
TextDrawLetterSize(Wanted, 0.310000, 1.499999);

Код:
public Wanted(playerid)
{
	if(GetPlayerWantedLevel(playerid) > 0)
	{
		TextDrawSetString(Text:Wanted, "1 star~n~use /fine for ~g~1000");
	    return 1;
	}
	if(GetPlayerWantedLevel(playerid) > 1)
	{
		TextDrawSetString(Text:Wanted, "2 stars~n~use /fine for ~g~2000");
	    return 1;
	}
	if(GetPlayerWantedLevel(playerid) > 2)
	{
		TextDrawSetString(Text:Wanted, "3 stars~n~use /fine for ~g~3000");
	    return 1;
	}
	if(GetPlayerWantedLevel(playerid) > 3)
	{
		TextDrawSetString(Text:Wanted, "4 stars~n~use /fine for ~g~4000");
	    return 1;
	}
	if(GetPlayerWantedLevel(playerid) > 4)
	{
		TextDrawSetString(Text:Wanted, "5 stars~n~use /fine for ~g~5000");
	    return 1;
	}
	if(GetPlayerWantedLevel(playerid) > 5)
	{
		TextDrawSetString(Text:Wanted, "6 stars~n~use /fine for ~g~6000");
	    return 1;
	}
	return 1;
}
All errors are:
Код:
error 076: syntax error in the expression, or invalid function call
What is wrong ?
Reply
#2

Actually you did your codes wrong, if(GetPlayerWantedLevel(playerid) > 1) Means if the player wanted level bigger than 1 , and etc you should use == , try that.
pawn Код:
public Wanted(playerid)
{
    if(GetPlayerWantedLevel(playerid) >= 1)
    {
        new string[60];
        format(string,sizeof(string),"%d star~n~use /fine for ~g~1000",GetPlayerWantedLevel(playerid));
        TextDrawSetString(Wanted, string);
    }
    return 1;
}
Instead of your codes , this is shorter and will check the levels above 1 , and if it's equal too 1.
Reply
#3

Not working.
Errors are of this line:
Код:
TextDrawSetString(Text:Wanted, "1 stars~n~use /fine for ~g~1000");
error 076: syntax error in the expression, or invalid function call
Reply
#4

Change to
pawn Код:
TextDrawSetString(Wanted, "1 stars~n~use /fine for ~g~1000");
btw i have used string above.
Reply
#5

I'm trying this:
Код:
if(GetPlayerWantedLevel(playerid) >= 1)
{
TextDrawSetString(Wanted, "1 star~n~use /fine for ~g~1000"); //Error syntax error in the expression, or invalid function call
Wanted = TextDrawCreate(497.000000, 129.000000, " "); //Error syntax error in the expression, or invalid function call
TextDrawFont(Wanted, 1); //Error syntax error in the expression, or invalid function call
TextDrawLetterSize(Wanted, 0.310000, 1.499999); //Error syntax error in the expression, or invalid function call
}
Reply
#6

pawn Код:
public OnPlayerUpdate(playerid)
{
     if(GetPlayerWantedLevel(playerid) >= 1)
     {
          new string[124];
          format(string, sizeof(string), "%d stars~n~use /fine for ~g~%d000", GetPlayerWantedLevel(playerid), GetPlayerWantedLevel(playerid));
          TextDrawSetString(Wanted, string);
          ShowTextDrawForPlayer(playerid, Wanted);
     }
     else if(GetPlayerWantedLevel(playerid) == 0)
     {
          TextDrawHideForPlayer(playerid, Wanted);
     }
     return 1;
}
Try that.
Reply
#7

Quote:
Originally Posted by J4mmyHD
Посмотреть сообщение
pawn Код:
public OnPlayerUpdate(playerid)
{
     if(GetPlayerWantedLevel(playerid) >= 1)
     {
           new string[124];
           format(string, sizeof(string), "%d stars~n~use /fine for ~g~%d000", GetPlayerWantedLevel(playerid), GetPlayerWantedLevel(playerid));
           TextDrawSrtString(Wanted, string);
      }
}
Try that.
Works +REP
Reply
#8

You used Text:Wanted , that's wrong you have to use Wanted only sorry i posted wrong on first time.
EDIT: Sorry i didn't refresh the page.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)