Textdraw problem - Only shows for me
#1

Textdraw shows only for me on server, why!? i dont know where is problem

Код:
new Text:BRZINA[MAX_PLAYERS];
new Text:ZDRAVLJE[MAX_PLAYERS];
//-------------------------------------------------------
forward Speedometer(playerid);
//-------------------------------------------------------
public OnGameModeInit()
{
	SetTimer("Speedometer", 100, true);
	return 1;
}
//-------------------------------------------------------
public OnPlayerConnect(playerid)
{
	BRZINA[playerid] = TextDrawCreate(503.000000, 415.000000," ");
	TextDrawBackgroundColor(BRZINA[playerid], 255);
 	TextDrawFont(BRZINA[playerid], 2);
  	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(503.000000, 430.000000," ");
	TextDrawBackgroundColor(ZDRAVLJE[playerid], 255);
 	TextDrawFont(ZDRAVLJE[playerid], 2);
 	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]);
	return 1;
}
//-------------------------------------------------------
public Speedometer(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,"~b~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,"~g~Zdravlje: ~w~%i%", final_vehicle_health);
		TextDrawSetString(ZDRAVLJE[playerid], health_string);
	}
	else
	{
		TextDrawSetString(BRZINA[playerid], " ");
		TextDrawSetString(ZDRAVLJE[playerid], " ");
	}
    return 1;
}
i have warning on compile:
Код:
C:\Users\toni\Desktop\Gang War Los Santos 0.3e\gamemodes\mod.pwn(3892) : warning 235: public function lacks forward declaration (symbol "Speedometer")
Reply
#2

pawn Код:
public OnGameModeInit()
{
    SetTimer("Speedometer", 100, true);
    return 1;
}
//-------------------------------------------------------
public OnPlayerConnect(playerid)
{
    BRZINA[playerid] = TextDrawCreate(503.000000, 415.000000," ");
    TextDrawBackgroundColor(BRZINA[playerid], 255);
    TextDrawFont(BRZINA[playerid], 2);
    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(503.000000, 430.000000," ");
    TextDrawBackgroundColor(ZDRAVLJE[playerid], 255);
    TextDrawFont(ZDRAVLJE[playerid], 2);
    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]);
    return 1;
}
//-------------------------------------------------------
forward Speedometer();
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,"~b~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,"~g~Zdravlje: ~w~%i%", final_vehicle_health);
        TextDrawSetString(ZDRAVLJE[playerid], health_string);
    }
    else
    {
        TextDrawSetString(BRZINA[playerid], " ");
        TextDrawSetString(ZDRAVLJE[playerid], " ");
    }
    }
    return 1;
}
Reply
#3

100 milliseconds ? That can't be seen by a plane eye.
For a speedometer that is updating(for multiple players) go for 700/600 if you wan fast but the best would be 1 sec
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)