SA-MP Forums Archive
Problem with Textdraw showing - 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: Problem with Textdraw showing (/showthread.php?tid=404395)



Problem with Textdraw showing - FL3GM4 - 02.01.2013

i want that this tzextdraw show on command /recon
textdraw
Код:
BRZINA[playerid] = TextDrawCreate(540.000000, 415.000000," ");
    TextDrawBackgroundColor(BRZINA[playerid], 255);
    TextDrawFont(BRZINA[playerid], 0);
    TextDrawLetterSize(BRZINA[playerid], 0.350000, 1.400000);
    TextDrawColor(BRZINA[playerid], 10944511);
    TextDrawSetOutline(BRZINA[playerid], 1);
    TextDrawSetProportional(BRZINA[playerid], 1);
    TextDrawSetShadow(BRZINA[playerid], 1);
    TextDrawShowForPlayer(playerid,BRZINA[playerid]);

    ZDRAVLJE[playerid] = TextDrawCreate(540.000000, 430.000000," ");
    TextDrawBackgroundColor(ZDRAVLJE[playerid], 255);
    TextDrawFont(ZDRAVLJE[playerid], 0);
    TextDrawLetterSize(ZDRAVLJE[playerid], 0.350000, 1.400000);
    TextDrawColor(ZDRAVLJE[playerid], 10944511);
    TextDrawSetOutline(ZDRAVLJE[playerid], 1);
    TextDrawSetProportional(ZDRAVLJE[playerid], 1);
    TextDrawSetShadow(ZDRAVLJE[playerid], 1);
    TextDrawShowForPlayer(playerid,ZDRAVLJE[playerid]);
under command:

Код:
    TextDrawShowForPlayer(playerid,BRZINA[playerid]);
	TextDrawShowForPlayer(playerid,ZDRAVLJE[playerid]);
Код:
public Speedometer()
{
    for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
    {
    new vehicleid,Float:speed_x,Float:speed_y,Float:speed_z,Float:final_speed,speed_string[256],final_speed_int;
    vehicleid = GetPlayerVehicleID(playerid);
    new Float:vehicle_health,final_vehicle_health,health_string[256];
    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))*230.666667;
        final_speed_int = floatround(final_speed,floatround_round);
        format(speed_string,256,"~y~Brzina: ~w~%i km/h",final_speed_int);
        TextDrawSetString(BRZINA[playerid], speed_string);
        GetVehicleHealth(vehicleid,vehicle_health);
        final_vehicle_health = floatround(floatround(vehicle_health - 250)/ 7.5);
        format(health_string,256,"~y~Zdravlje: ~w~%i%", final_vehicle_health);
        TextDrawSetString(ZDRAVLJE[playerid], health_string);
    }
    else
    {
        TextDrawSetString(BRZINA[playerid], " ");
        TextDrawSetString(ZDRAVLJE[playerid], " ");
    }
    }
    return 1;
}



Re: Problem with Textdraw showing - [DOG]irinel1996 - 02.01.2013

pawn Код:
public Speedometer()
{
    for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
    {
    new vehicleid,Float:speed_x,Float:speed_y,Float:speed_z,Float:final_speed,speed_string[256],final_speed_int;
    vehicleid = GetPlayerVehicleID(playerid);
    new Float:vehicle_health,final_vehicle_health,health_string[256];
    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))*230.666667;
        final_speed_int = floatround(final_speed,floatround_round);
        format(speed_string,256,"~y~Brzina: ~w~%i km/h",final_speed_int);
        TextDrawSetString(BRZINA[playerid], speed_string);
        GetVehicleHealth(vehicleid,vehicle_health);
        final_vehicle_health = floatround(floatround(vehicle_health - 250)/ 7.5);
        format(health_string,256,"~y~Zdravlje: ~w~%i%", final_vehicle_health);
        TextDrawSetString(ZDRAVLJE[playerid], health_string);
        TextDrawShowForPlayer(playerid, BRZINA[playerid]);
        TextDrawShowForPlayer(playerid, ZDRAVLJE[playerid]);
    }
    else
    {
        TextDrawSetString(BRZINA[playerid], " ");
        TextDrawSetString(ZDRAVLJE[playerid], " ");
        TextDrawHideForPlayer(playerid, BRZINA[playerid]);
        TextDrawHideForPlayer(playerid, ZDRAVLJE[playerid]);
    }
    }
    return 1;
}
You must show them after setting their string, to update.


Re: Problem with Textdraw showing - FL3GM4 - 03.01.2013

i put that but it still doesn't working ...

when i spectate somebody, it doesn't show speedometer ... why...

spec command

Код:
CMD:recon(playerid, params[])
{
    new id, string[128];
    if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_WHITE, ""#COL_RED"| "COL_LIGHTBLUE"WS:DM "#COL_RED"| "#COL_WHITE"Niste ovlasteni za ovu komandu");
    if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_WHITE, "/recon [playerid]");
    if(id == INVALID_PLAYER_ID || !IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_WHITE, ""#COL_RED"| "COL_LIGHTBLUE"WS:DM "#COL_RED"| "#COL_WHITE"Pogresan ID");
    TogglePlayerSpectating(playerid, 1);
    AC_BS_SetPlayerInterior(playerid, GetPlayerInterior(id));
    if(IsPlayerInAnyVehicle(id))
    {
        new specvehicleid = GetPlayerVehicleID(id);
        PlayerSpectateVehicle(playerid, specvehicleid);
        TextDrawShowForPlayer(playerid,BRZINA[playerid]);
		TextDrawShowForPlayer(playerid,ZDRAVLJE[playerid]);
    }
    else
    {
        PlayerSpectatePlayer(playerid, id);
    }
    format(string, sizeof(string), "Sada reconas %s, da ga prestanes reconat koristi: /uncon", PlayerName(id));
    SendClientMessage(playerid, Grey, string);
    return 1;
}