textdraw help
#1

Hi, I've added a new textdraw on my server/script. I builded the textdraw by: ipleomax's textdraw builder. I added it into my server (That I builded ofc) and I got no errors,
Код:
        new Text:backround = TextDrawCreate(640.000061, 272.374176, "backrund");
	TextDrawLetterSize(backround, 0.000000, 1.000000);
	//TextDrawTextSize(backround, 474.999969, 0.000000);
	TextDrawAlignment(backround, 1);
	TextDrawColor(backround, 0);
	TextDrawUseBox(backround, true);
	TextDrawBoxColor(backround, 102);
	TextDrawSetShadow(backround, 0);
	TextDrawSetOutline(backround, 0);
	TextDrawFont(backround, 1);
	TextDrawHideForPlayer(playerid, backround);

	new Text:vehicledraw = TextDrawCreate(479.666748, 271.703704, "Vehicle Information");
	TextDrawLetterSize(vehicledraw, 0.449999, 1.600000);
	TextDrawAlignment(vehicledraw, 1);
	TextDrawColor(vehicledraw, -1);
	TextDrawSetShadow(vehicledraw, 1);
	TextDrawSetOutline(vehicledraw, 0);
	TextDrawBackgroundColor(vehicledraw, 51);
	TextDrawFont(vehicledraw, 3);
	TextDrawSetProportional(vehicledraw, 1);
	TextDrawHideForPlayer(playerid, vehicledraw);
This textdraws will appear when I enter a car and disappear when I leave the car. And a white text with text: Vehicle Information. But when I enter the car the textdraw is getting over the whole screen and I can't see the text, I don't know why and how to fix it. Can you guys might help me?

https://www.youtube.com/watch?v=vg7Fqflg1vs
Reply
#2

You're complaining that the background TD gets stuck on your screen? Show me what you've done in OnPlayerEnterVehicle or OnPlayerStateChange to DRIVER. There should be some timer to hide it or something which you might not have added.
Reply
#3

Код:
vehOnPlayerStateChange(playerid, newstate, oldstate) {
	if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER) {
		if(GetPVarType(playerid, "LastCar") != PLAYER_VARTYPE_NONE) {
			new carid = GetPVarInt(playerid, "LastCar");
			if(carid != 0) {
				if(VehicleInfo[carid][EVRadioStation] != -1) {
					StopAudioStreamForPlayer(playerid);
				}
			}
		}
		if(GetPVarInt(playerid, "FuelShown") == 1) {
			new Bar:bar = Bar:GetPVarInt(playerid, "FuelBar");
			if(bar != INVALID_BAR_ID) {
				HideProgressBarForPlayer(playerid, bar);	
			}
			DeletePVar(playerid, "FuelShown");
		}
	}
	new carid = GetPlayerVehicleID(playerid);
	if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER) {
		if(carid != 0) {
			if(VehicleInfo[carid][EVRadioStation] != -1) {
				new url[128];
				getRadioURL(VehicleInfo[carid][EVRadioStation], url, sizeof(url));
				PlayAudioStreamForPlayer(playerid, url);
			}
			if(!IsACar(GetVehicleModel(carid))) {
				new engine, lights, alarm, doors, bonnet, boot, objective;
				GetVehicleParamsEx(carid, engine, lights, alarm, doors, bonnet, boot, objective);
				VehicleInfo[carid][EVEngine] = 1;
				SetVehicleParamsEx(carid, VehicleInfo[carid][EVEngine], lights, alarm, doors, bonnet, boot, objective);
			}
		}
		if(carid != 0 && (EAdminFlags:GetPVarInt(playerid, "AdminFlags") != EAdminFlags_None && !acdisabled)) {
			/*
			if(VehicleInfo[carid][EVLocked] == 1) {
				if(VehicleInfo[carid][EVType] == EVehicleType_Owned && VehicleInfo[carid][EVOwner] != playerid) {
					new msg[64];
					format(msg, sizeof(msg), "Hacking into locked vehicle %d",carid);
					hackKick(playerid, msg, "Car Hacking");
				}
			}
			*/
		}
		if(newstate == PLAYER_STATE_DRIVER) {
			if(GetPVarType(playerid, "AllowDriveBy") == PLAYER_VARTYPE_NONE) {
				SetPlayerArmedWeapon(playerid,0);
			}
		} else {
			if(GetPVarType(playerid, "AllowDriveBy") == PLAYER_VARTYPE_NONE) {
				for(new i=0;i<sizeof(BadDrivebyWeapons);i++) {
					if(GetPlayerWeaponEx(playerid) == BadDrivebyWeapons[i]) {
						SetPlayerArmedWeapon(playerid,0);
					}
				}
			}
		}
	}
	if(newstate == PLAYER_STATE_DRIVER) { /* Pizza Job */
		new vehicleid = GetPlayerVehicleID(playerid);
		if(VehicleInfo[vehicleid][EVType] == EVehicleType_JobCar) {
			if(VehicleInfo[vehicleid][EVOwner] == EJobType_PizzaMan) {
				initiatePizzaDelivery(playerid);
			}
		}
	}
	if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER) { //Wipers - get on
		//weatherInVehicleDecide(playerid);
		//if(vehicleWipersOn(carid)) {
			//SendClientMessage(playerid, X11_WHITE, "[INFO]: Wipers On");
		//}
		if(isPlayerDying(playerid)) { //anim bug abuse "fix"
			putPlayerInHospital(playerid);
		}
	}
	if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER) { //Wipers - get off
		if(newstate == PLAYER_STATE_ONFOOT) {
			//weatherInVehicleDecide(playerid);
		}
	}
	if(newstate == PLAYER_STATE_DRIVER) {
		if(IsACar(GetVehicleModel(carid))) {
			HintMessage(playerid, COLOR_LIGHTGREEN, "To start the engine press~r~ ~k~~TOGGLE_SUBMISSIONS~");
		}
		new msg[128];
		new newcar = GetPlayerVehicleID(playerid);
		new newmodel = GetVehicleModel(newcar);
		if(VehicleInfo[newcar][EVType] == EVehicleType_JobCar) {
			if(~EAdminFlags:GetPVarInt(playerid, "AdminFlags") & EAdminFlags_Scripter) {
				if(VehicleInfo[newcar][EVOwner] != GetPVarInt(playerid, "Job")) {
					format(msg,sizeof(msg), "You must be a %s to drive this!",GetJobName(VehicleInfo[newcar][EVOwner]));
					SendClientMessage(playerid, X11_RED3, msg);
					RemovePlayerFromVehicle(playerid);
				}
			}
			OnEnterJobCar(playerid, newcar, VehicleInfo[newcar][EVOwner]);
		}
		if(VehicleInfo[newcar][EVType] == EVehicleType_Faction) {
			if(~EAdminFlags:GetPVarInt(playerid, "AdminFlags") & EAdminFlags_Scripter) {
				new faction = GetPVarInt(playerid, "Faction");
				if(VehicleInfo[newcar][EVOwner] != faction) {
					if(getPlayerFactionType(playerid) != getFactionType(VehicleInfo[newcar][EVOwner]))
					{
						format(msg,sizeof(msg), "You don't have the keys to this vehicle!");
						SendClientMessage(playerid, X11_RED3, msg);
						RemovePlayerFromVehicle(playerid);
					}
				}
			}
		}
		if(IsACar(newmodel))
		{			
	        if(!IsABicycle(newmodel))
			{
				new Bar:fuelbar = Bar:GetPVarInt(playerid, "FuelBar");
				if(fuelbar != INVALID_BAR_ID) {
					SetProgressBarValue(fuelbar, VehicleInfo[newcar][EVFuel]);
					SetPVarInt(playerid, "FuelShown", 1);
					ShowProgressBarForPlayer(playerid, fuelbar);
				}
				TextDrawShowForPlayer(playerid, Text:GetPVarInt(playerid, "SpeedDraw"));
				new vehname[50];
				format(vehname,sizeof(vehname),"~y~%s",VehiclesName[newmodel-400]);
				TextDrawSetString(Text:GetPVarInt(playerid, "VehDraw"), vehname);
				TextDrawShowForPlayer(playerid, Text:GetPVarInt(playerid, "Backround"));
				TextDrawShowForPlayer(playerid, Text:GetPVarInt(playerid, "VehInfo"));
				TextDrawShowForPlayer(playerid, Text:GetPVarInt(playerid, "VehDraw"));
				//Miles
				if(VehicleInfo[carid][EVType] == EVehicleType_Owned) {
					new vehmiles[64];
					format(vehmiles,sizeof(vehmiles),"~w~ %.1f", getVehicleMileAge(carid));
					TextDrawSetString(Text:GetPVarInt(playerid, "VehMileDraw"), vehmiles);
					TextDrawShowForPlayer(playerid, Text:GetPVarInt(playerid, "VehMileDraw"));
				}
			}
		}
	} else if(oldstate == PLAYER_STATE_DRIVER) {
		TextDrawHideForPlayer(playerid, Text:GetPVarInt(playerid, "SpeedDraw"));
		TextDrawHideForPlayer(playerid, Text:GetPVarInt(playerid, "VehDraw"));
		TextDrawHideForPlayer(playerid, Text:GetPVarInt(playerid, "VehMileDraw"));
		TextDrawHideForPlayer(playerid, Text:GetPVarInt(playerid, "VehInfo"));
		TextDrawHideForPlayer(playerid, Text:GetPVarInt(playerid, "Backround"));
		new jobcar = GetPVarInt(playerid, "JobCar");
		
		if(jobcar != 0 || GetPVarType(playerid, "TaxiPassenger") != PLAYER_VARTYPE_NONE || GetPVarType(playerid, "TrashRoute") != PLAYER_VARTYPE_NONE 
		|| GetPVarType(playerid, "CurrentSmugglerRoute") != PLAYER_VARTYPE_NONE || GetPVarType(playerid, "IsOnPizzaRoute") != PLAYER_VARTYPE_NONE) {
			onJobAbort(playerid);
			onTaxiPassengerAbort(playerid);
			DestroyVehicle(jobcar);
			DeletePVar(playerid, "JobCar");
		}
	} else if(oldstate == PLAYER_STATE_PASSENGER) {
		if(GetPVarType(playerid, "TaxiDriver") != PLAYER_VARTYPE_NONE) {
			onJobAbort(GetPVarInt(playerid, "TaxiDriver"));
		}
	} else if(newstate == PLAYER_STATE_PASSENGER) {
		if(carid == INVALID_VEHICLE_ID) {
			return 0;
		}
		new driver = GetVehicleDriver(carid);
		if(driver != INVALID_PLAYER_ID) {
			if(GetPVarType(driver, "TaxiFare") != PLAYER_VARTYPE_NONE) {
				OnPlayerEnterTaxi(playerid, driver);
			}
		}
	}
	return 1;
}
Код:
vehOnPlayerDisconnect(playerid, reason) {
	#pragma unused reason
	DestroyProgressBar(Bar:GetPVarInt(playerid,"FuelBar"));
	TextDrawDestroy(Text:GetPVarInt(playerid, "SpeedDraw"));
	TextDrawDestroy(Text:GetPVarInt(playerid, "VehDraw"));
	TextDrawDestroy(Text:GetPVarInt(playerid, "VehMileDraw"));
	TextDrawDestroy(Text:GetPVarInt(playerid, "VehInfo"));
	TextDrawDestroy(Text:GetPVarInt(playerid, "Backround"));
	
}
This should look like this:

(Just the backround box with the text, nothing else on this picture!)
Reply
#4

*Bump*
Anyone who might know what I've done wrong?
Reply
#5

*bump*
Reply
#6

*Bump*
Reply
#7

*bump*
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)