14.08.2011, 09:15
My textdraw in my FS and my textdraw in my gamemode seem to collide, the string in the filterscript uses the textdrawcreate from the main gamemode, what is causing this?
EclipseBlue[ 0 ] = TextDrawCreate(587.000000, 392.000000, "~b~F~b~~h~r~b~e~b~r~b~~h~o~b~a~b~m~n~~b~M~b~~h~a~b~k~b~~h~e~b~~h~r~b~s");
TextDrawAlignment(EclipseBlue[ 0 ], 2);
TextDrawBackgroundColor(EclipseBlue[ 0 ], 255);
TextDrawFont(EclipseBlue[ 0 ], 0);
TextDrawLetterSize(EclipseBlue[ 0 ], 0.819998, 1.899999);
TextDrawColor(EclipseBlue[ 0 ], 255);
TextDrawSetOutline(EclipseBlue[ 0 ], 1);
TextDrawSetProportional(EclipseBlue[ 0 ], 1)
Freroams Maers
But why ? How to code this ?
new
Float: health
;
GetPlayerHealth(playerid, health);
/*
100 hp = 50 px // 50 is the size of the bar
health = x px // x would be the calculated size
x = health * 50 / 100 = health * 0.5 = health / 2
*/
TextDrawTextSize(
textdraw,
150.0 + (health / 2), // 150.0 is start position of the textdraw
3.6
); // TextDrawTextSize doesnt update the textdraw, so we show it again to the player
TextDrawShowForPlayer(playerid, textdraw);
|
new speedo[80]; public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) { new Float:X,Float:Y,Float:Z; new speed=GetVehicleVelocity(GetPlayerVehicleID(player id),X,Y,Z); format(speedo,sizeof(speedo),"Speed : %i %i %i",X,Y,Z); TextDrawUseBox(TextDrawCreate(10.0, 100.0, speedo),1) return 1; } public OnPlayerExitVehicle(playerid, vehicleid) { TextDrawHideForPlayer(playerid, speedo); return 1; } |
|
sry for a noob question again, but why does this code not work?
Code:
public carhealth() {
new Float:tmp;
new tmpp[256];
new tmppp[256];
for(new i = 0; i < MAX_PLAYERS; i ++) {
if(IsPlayerInAnyVehicle(i)) {
GetVehicleHealth(GetPlayerVehicleID(i), tmp);
format(tmpp,255,"%f",tmp / 10);
valstr(tmppp,strval(tmpp));
TextDrawDestroy(carhp[i]);
carhpshown[i] = 0;
format(tmpp,255,"%d km/h~n~%s%",kmph[i], tmppp);
carhp[i] = TextDrawCreate(500, 380, tmpp);
TextDrawUseBox(carhp[i], 1);
TextDrawBoxColor(carhp[i], 0x88888877);
TextDrawShowForPlayer(i, carhp[i]);
carhpshown[i] = 1;
} else {
if(carhpshown[i] == 1) {
TextDrawDestroy(carhp[i]);
carhpshown[i] = 0;
}
}
}
}
I used arrays as said here, but i still cant find the error. |
