29.06.2007, 12:53
sry for a noob question again, but why does this code not work?
It should display the speed and health of a car to players, but its the same like before, when more than one player is in a car, it is only visible for the player with the highest id.
I used arrays as said here, but i still cant find the error.
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.

