Vehicle Panel TextDraws only showing to ID 0
#1

Hello guys. Well, first of all thanks to Milan for teaching me how to make such cool textdraws, but now i did something bad, and it only shows to ID 0...

I don't see any bad thing in my code, eigher some return that shouldn't be there. Kill me if the problem is some return. :P

pawn Code:
Under on player connect:

    SPEEDOS[playerid] = TextDrawCreate(500.500000, 308.000000, "");
    FUEL[playerid] = TextDrawCreate(500.500000, 320.000000, "");
    HEALTH[playerid] = TextDrawCreate(500.500000, 332.000000, "");
    ID[playerid] = TextDrawCreate(500.500000, 344.000000, "");
    TextDrawFont(SPEEDOS[playerid],1); //font type of textdraw
    TextDrawUseBox(SPEEDOS[playerid] , 1);
    TextDrawBoxColor(SPEEDOS[playerid] ,COLOR_GREY);
    TextDrawLetterSize(SPEEDOS[playerid],0.399999,1.200000); //size...
    TextDrawSetShadow(SPEEDOS[playerid],1);
    TextDrawColor(SPEEDOS[playerid],COLOR_WHITE); //color
    TextDrawShowForPlayer(playerid, SPEEDOS[playerid]);
    TextDrawFont(FUEL[playerid],1); //font type of textdraw
    TextDrawUseBox(FUEL[playerid] , 1);
    TextDrawBoxColor(FUEL[playerid] ,COLOR_GREY);
    TextDrawLetterSize(FUEL[playerid],0.399999,1.200000); //size...
    TextDrawSetShadow(FUEL[playerid],1);
    TextDrawColor(FUEL[playerid],COLOR_WHITE); //color
    TextDrawShowForPlayer(playerid, FUEL[playerid]);
    TextDrawFont(HEALTH[playerid],1); //font type of textdraw
    TextDrawUseBox(HEALTH[playerid] , 1);
    TextDrawBoxColor(HEALTH[playerid] ,COLOR_GREY);
    TextDrawLetterSize(HEALTH[playerid],0.399999,1.200000); //size...
    TextDrawSetShadow(HEALTH[playerid],1);
    TextDrawColor(HEALTH[playerid],COLOR_WHITE); //color
    TextDrawShowForPlayer(playerid, HEALTH[playerid]);
    TextDrawFont(ID[playerid],1); //font type of textdraw
    TextDrawUseBox(ID[playerid] , 1);
    TextDrawBoxColor(ID[playerid] ,COLOR_GREY);
    TextDrawLetterSize(ID[playerid],0.399999,1.200000); //size...
    TextDrawSetShadow(ID[playerid],1);
    TextDrawColor(ID[playerid],COLOR_WHITE); //color
    TextDrawShowForPlayer(playerid, ID[playerid]);

public Speedometer(playerid)
{
    new vehicleid,Float:speed_x,Float:speed_y,Float:speed_z,Float:final_speed,speed_string[256],final_speed_int, fuel_string[256], id_string[256];
    vehicleid = GetPlayerVehicleID(playerid);
    if(vehicleid != 0)
    {
        LoadVehicles();
        GetVehicleVelocity(vehicleid,speed_x,speed_y,speed_z);
        final_speed = floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*250.666667;
        final_speed_int = floatround(final_speed,floatround_round);
        new Float:vehicle_health,final_vehicle_health,health_string[256];
        GetVehicleHealth(vehicleid,vehicle_health);
        final_vehicle_health = floatround(floatround(vehicle_health - 250)/ 7.5);
        format(health_string,256,"Health %i", final_vehicle_health);
        format(speed_string,256,"Speed: %i Km/h", final_speed_int);
        format(fuel_string,256,"Fuel: %i", CarInfo[vehicleid][Fuel]);
        format(health_string,256,"Health: %i", final_vehicle_health);
        format(id_string,256,"Car ID: %i", vehicleid);
        TextDrawSetString(SPEEDOS[playerid], speed_string);
        TextDrawSetString(FUEL[playerid], fuel_string);
        TextDrawSetString(HEALTH[playerid], health_string);
        TextDrawSetString(ID[playerid], id_string);
    }
    else
    {
        TextDrawSetString(SPEEDOS[playerid], "");
        TextDrawSetString(FUEL[playerid], "");
        TextDrawSetString(HEALTH[playerid], "");
        TextDrawSetString(ID[playerid], "");
    }
    return 1;
}
Added one by one, tested all one per one, but as i was the id 0, it worked, now i called my friend, and only shows to him. xD
Reply
#2

Show us the timer for speedometer,

And please please please dont tell me you used SetTimer,

PLEASE tell me you did SetTimerEx
Reply
#3

OK, you have permission to /akill me..

But, how the fuck i use SetTimerEx to this? xD
I don't really know how to set it proply, what are the params i need to put. xD

pawn Code:
SetTimer("Speedometer", 50, true);
Reply
#4

pawn Code:
SetTimerEx("Speedometer", 50,true, "i", playerid);

pawn Code:
CMD:kill(playerid, params[])
{
SetPlayerHealth(Ricardo, 0);
return 1;
}
Reply
#5

As i set it under OnGameModeInit, it's saying un-defined symbol playerid.. would it affect if i add playerid on the params of OnGameModeInit like OnGameModeInit(playerid) ?
Reply
#6

Quote:
Originally Posted by ricardo178
View Post
As i set it under OnGameModeInit, it's saying un-defined symbol playerid.. would it affect if i add playerid on the params of OnGameModeInit like OnGameModeInit(playerid) ?
Don't

Add it onPlayerConnect, or use UnPlayerUpdate instead of a timer.
Reply
#7

Quote:
Originally Posted by milanosie
View Post
Don't

Add it onPlayerConnect, or use UnPlayerUpdate instead of a timer.
make one timer with SetTimer and loop threw all the connected players.

this keeps it down to 1 timer running instead of 32 if you have 32 connected players.
500 if theirs 500 connected....
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)