SA-MP Forums Archive
only one textdraw shows in game - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: only one textdraw shows in game (/showthread.php?tid=279289)



only one textdraw shows in game - BigAl - 26.08.2011

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!


Re: only one textdraw shows in game - =WoR=Varth - 27.08.2011

I don't see you create the fuel TextDraw in anywhere.