only one textdraw shows in game
#1

pawn Код:
public OnPlayerConnect(playerid)
{
    M_OnPlayerConnect(playerid);
    IsPlayerInMission[playerid] = false;
    speedos[playerid] = TextDrawCreate(10.0,200.0," ");
    TextDrawShowForPlayer(playerid, speedos[playerid]);
    return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
    {
        new vid = GetPlayerVehicleID(playerid);
        new string[125];
        format(string, sizeof string, "Fuel: %i", fuel[vid]);
        TextDrawSetString(td_fuel[playerid], string);
        TextDrawShowForPlayer(playerid, td_fuel[playerid]);
    }
    else
    {
        TextDrawHideForPlayer(playerid, td_fuel[playerid]);
    }
    return 1;
}

public OnPlayerUpdate(playerid)
{
    new vehicleid,Float:speed_x,Float:speed_y,Float:speed_z,Float:final_speed,speed_string[256],final_speed_int;
    vehicleid = GetPlayerVehicleID(playerid);
    if(vehicleid != 0)
    {
        GetVehicleVelocity(vehicleid, speed_x, speed_y, speed_z);
        final_speed = floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*136.666667;
        final_speed_int = floatround(final_speed,floatround_round);
        format(speed_string,256,"Speed: %i",final_speed_int);
        TextDrawSetString(speedos[playerid], speed_string);
    }
    else
    {
        TextDrawSetString(speedos[playerid], " ");
    }
    return 1;
}
Can you help me. I want a refuel texdraw and a speedo for my trucking server, except it only shows the fuel, and not the speed :/ Any help please, much appreciated!
Reply


Messages In This Thread
only one textdraw shows in game - by BigAl - 26.08.2011, 09:56
Re: only one textdraw shows in game - by =WoR=Varth - 27.08.2011, 02:31

Forum Jump:


Users browsing this thread: 2 Guest(s)