#1

(1259 : warning 213: tag mismatch
(1259 : error 028: invalid subscript (not an array or too many subscripts): "vSpeedBox"
(1259 : warning 215: expression has no effect
(1259 : error 001: expected token: ";", but found "]"
(1259 : error 029: invalid expression, assumed zero
(1259 : fatal error 107: too many error messages on one line

Код:
forward speedinfotd(playerid);
public speedinfotd(playerid)
{
		new String [ 30 ];
        new Float:X;
        new Float:Y;
        new Float:Z;
        GetVehicleVelocity(GetPlayerVehicleID(playerid),X,Y,Z);
        format(String,150,"~W~~Y~%d",floatround(floatsqroot(X * X + Y * Y + Z * Z) * 200.0000));
(Line: 12598)	TextDrawSetString(playerid, vSpeedBox[playerid], String);
        return 1;
}
Reply
#2

Could you show what vSpeedBox is? Where you define it?
Reply
#3

Код:
new	Text:vSpeedBox;
Public OnGameModeInit()
Код:
	vSpeedBox = TextDrawCreate(540.666259, 418.637756, "0");
	TextDrawLetterSize(vSpeedBox, 0.000000, -3.155556);
	TextDrawTextSize(vSpeedBox, 649.999572, 0.000000);
	TextDrawAlignment(vSpeedBox, 1);
	TextDrawColor(vSpeedBox, 0);
	TextDrawUseBox(vSpeedBox, true);
	TextDrawBoxColor(vSpeedBox, 102);
	TextDrawSetShadow(vSpeedBox, 0);
	TextDrawSetOutline(vSpeedBox, 0);
	TextDrawFont(vSpeedBox, 2);
Reply
#4

You can't do that. You are creating a Global textdraw and trying to show it to a player. Use PlayerTextdraws instead

https://sampwiki.blast.hk/wiki/CreatePlayerTextDraw
Reply
#5

You have to change it to
Код:
new PlayerText:vSpeedBox;
Put this under OnPlayerConnect:
Код:
vSpeedBox = CreatePlayerTextDraw(540.666259, 418.637756, "0");
	PlayerTextDrawLetterSize(vSpeedBox, 0.000000, -3.155556);
	PlayerTextDrawTextSize(vSpeedBox, 649.999572, 0.000000);
	PlayerTextDrawAlignment(vSpeedBox, 1);
	PlayerTextDrawColor(vSpeedBox, 0);
	PlayerTextDrawUseBox(vSpeedBox, true);
	PlayerTextDrawBoxColor(vSpeedBox, 102);
	PlayerTextDrawSetShadow(vSpeedBox, 0);
	PlayerTextDrawSetOutline(vSpeedBox, 0);
	PlayerTextDrawFont(vSpeedBox, 2);
Код:
forward speedinfotd(playerid);
	public speedinfotd(playerid)
	{
			new String [ 30 ];
	        new Float:X;
	        new Float:Y;
	        new Float:Z;
	        GetVehicleVelocity(GetPlayerVehicleID(playerid),X,Y,Z);
	        format(String,150,"~W~~Y~%d",floatround(floatsqroot(X * X + Y * Y + Z * Z) * 200.0000));
			PlayerTextDrawSetString(playerid, vSpeedBox, String);
	        return 1;
	}
And use the code below to show or hide it.
Код:
PlayerTextDrawShow(playerid, vSpeedBox);
PlayerTextDrawHide(playerid, vSpeedBox);
To destroy it use:
Код:
PlayerTextDrawDestroy(playerid, vSpeedBox);
Reply
#6

Quote:
Originally Posted by Aly
Посмотреть сообщение
You have to change it to
Код:
new PlayerText:vSpeedBox;
Put this under OnPlayerConnect:
Код:
vSpeedBox = CreatePlayerTextDraw(540.666259, 418.637756, "0");
	PlayerTextDrawLetterSize(vSpeedBox, 0.000000, -3.155556);
	PlayerTextDrawTextSize(vSpeedBox, 649.999572, 0.000000);
	PlayerTextDrawAlignment(vSpeedBox, 1);
	PlayerTextDrawColor(vSpeedBox, 0);
	PlayerTextDrawUseBox(vSpeedBox, true);
	PlayerTextDrawBoxColor(vSpeedBox, 102);
	PlayerTextDrawSetShadow(vSpeedBox, 0);
	PlayerTextDrawSetOutline(vSpeedBox, 0);
	PlayerTextDrawFont(vSpeedBox, 2);
Код:
forward speedinfotd(playerid);
	public speedinfotd(playerid)
	{
			new String [ 30 ];
	        new Float:X;
	        new Float:Y;
	        new Float:Z;
	        GetVehicleVelocity(GetPlayerVehicleID(playerid),X,Y,Z);
	        format(String,150,"~W~~Y~%d",floatround(floatsqroot(X * X + Y * Y + Z * Z) * 200.0000));
			PlayerTextDrawSetString(playerid, vSpeedBox, String);
	        return 1;
	}
And use the code below to show or hide it.
Код:
PlayerTextDrawShow(playerid, vSpeedBox);
PlayerTextDrawHide(playerid, vSpeedBox);
To destroy it use:
Код:
PlayerTextDrawDestroy(playerid, vSpeedBox);
Why did you even bother? That code doesn't even work! Just changing the Text -> PlayerText and changing the function appropriately won't fix the problem. To display it, He should loop thorough all the players and use a timer to update. Besides, If you tell him everything, He will just copy paste and won't learn anything. Again, The code You've provided is WRONG!
Reply
#7

Errors are fixed, but the textdraw is not showing..
Код:
new PlayerText:vSpeedBox[MAX_PLAYERS]
Under public OnPlayerConnect(playerid)
Код:
	vSpeedBox[playerid] = CreatePlayerTextDraw(playerid,540.666259, 418.637756, "0");
	PlayerTextDrawLetterSize(playerid, vSpeedBox[playerid], 0.000000, -3.155556);
	PlayerTextDrawTextSize(playerid, vSpeedBox[playerid], 649.999572, 0.000000);
	PlayerTextDrawAlignment(playerid, vSpeedBox[playerid], 1);
	PlayerTextDrawColor(playerid, vSpeedBox[playerid], 0);
	PlayerTextDrawUseBox(playerid, vSpeedBox[playerid], true);
	PlayerTextDrawBoxColor(playerid, vSpeedBox[playerid], 102);
	PlayerTextDrawSetShadow(playerid, vSpeedBox[playerid], 0);
	PlayerTextDrawSetOutline(playerid, vSpeedBox[playerid], 0);
	PlayerTextDrawFont(playerid, vSpeedBox[playerid], 2);
Under public OnPlayerStateChange(playerid, newstate, oldstate)
Код:
	if(newstate == PLAYER_STATE_DRIVER)
	{
	        new str [ 30 ];
			vID = GetPlayerVehicleID(playerid);
			vv = GetVehicleModel(vID);
			LinkVehicleToInterior(vID, GetPlayerInterior(playerid));
			format(str, sizeof(str), "%s", vehName[vv - 400]);
			PlayerTextDrawSetString(playerid, vTD[playerid], str);
			PlayerTextDrawShow(playerid, vTD[playerid]);
   			SetTimerEx("hidevTD", 3200, false, "i", playerid);
			// Hide Box
			if(Speedo[playerid] == 1)
			{
			    SetTimerEx("speedinfotd",1000,1,"d",playerid);
				PlayerTextDrawShow(playerid, vSpeed[playerid]);
    			PlayerTextDrawShow(playerid, vSpeedBox[playerid]);
			}
		}
Код:
forward speedinfotd(playerid);
	public speedinfotd(playerid)
	{
		new String [ 30 ];
	        new Float:X;
	        new Float:Y;
	        new Float:Z;
	        GetVehicleVelocity(GetPlayerVehicleID(playerid),X,Y,Z);
	        format(String,150,"~W~~Y~%d",floatround(floatsqroot(X * X + Y * Y + Z * Z) * 200.0000));
		PlayerTextDrawSetString(playerid, vSpeedBox[playerid], String);
	        return 1;
	}
Reply
#8

Nvm, Fixed ~
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)