Textdraw
#1

all my textdraw disappeared any how to fix this?
http://pastebin.com/3vVsAu7j
Reply
#2

You must use playertextdraw seeing as these textdraws instructions accords to the specific player.
Reply
#3

i Stll dont get it.
Reply
#4

Still having the same problem.
Reply
#5

You changed everything to PlayerText ? If not, try this:

PHP код:
#include <a_samp>

#define MAX_FUEL 100 // Change this to the MAX Amount of fuel you want. (Default:100)
#define SpeedCheck(%0,%1,%2,%3,%4) floatround(floatsqroot(%4?(%0*%0+%1*%1+%2*%2):(%0*%0+%1*%1) ) *%3*1.6)

forward SpeedTimer();
forward FuelTimer();

new 
PlayerText:Fuel[MAX_PLAYERS];
new 
PlayerText:Speed[MAX_PLAYERS];
new 
CarFuel[MAX_VEHICLES] = 0;
new 
checkgastimer;
new 
speedtimer;

stock GetPlayerSpeed(playeridget3d)
{
    new 
Float:xFloat:yFloat:z;
    if(
IsPlayerInAnyVehicle(playerid))
    {
        
GetVehicleVelocity(GetPlayerVehicleID(playerid), xyz);
    }
    else
    {
        
GetPlayerVelocity(playeridxyz);
    }
    return 
SpeedCheck(xyz100.0get3d);
}

stock SetGasString(playeridstring[])
{
    if(
IsPlayerConnected(playerid))
    {
        
PlayerTextDrawSetString(playeridFuel[playerid], string);
    }
}

stock SetSpeedString(playeridstring[])
{
    if(
IsPlayerConnected(playerid))
    {
        
PlayerTextDrawSetString(playeridSpeed[playerid], string);
    }
}

public 
OnGameModeInit()
{
    for(new 
0MAX_VEHICLESv++)
    {
        
CarFuel[v] = MAX_FUEL// This sets the fuel
    
}
    
checkgastimer SetTimer("FuelTimer"250001);
    
speedtimer SetTimer("SpeedTimer",1000,1);
    return 
1;
}

public 
OnGameModeExit()
{
    
KillTimer(checkgastimer);
    
KillTimer(speedtimer);
    return 
1;
}

public 
OnPlayerDeath(playerid,killerid,reason)
{
    
PlayerTextDrawHide(playerid,Fuel[playerid]);
    return 
1;
}

public 
OnPlayerConnect(playerid)
{
    
Fuel[playerid] = CreatePlayerTextDraw(playerid330.000000415.000000" ");
    
PlayerTextDrawAlignment(playerid,Fuel[playerid], 2);
    
PlayerTextDrawBackgroundColor(playerid,Fuel[playerid], 255);
    
PlayerTextDrawFont(playerid,Fuel[playerid], 2);
    
PlayerTextDrawLetterSize(playerid,Fuel[playerid], 0.2599991.200000);
    
PlayerTextDrawColor(playerid,Fuel[playerid], -1);
    
PlayerTextDrawSetOutline(playerid,Fuel[playerid], 1);
    
PlayerTextDrawSetProportional(playerid,Fuel[playerid], 1);
    
PlayerTextDrawShow(playerid,Fuel[playerid]);
    
    
Speed[playerid] = CreatePlayerTextDraw(playerid,330.000000430.000000" ");
    
PlayerTextDrawAlignment(playerid,Speed[playerid], 2);
    
PlayerTextDrawBackgroundColor(playerid,Speed[playerid], 255);
    
PlayerTextDrawFont(playerid,Speed[playerid], 2);
    
PlayerTextDrawLetterSize(playerid,Speed[playerid], 0.2599991.200000);
    
PlayerTextDrawColor(playerid,Speed[playerid], -1);
    
PlayerTextDrawSetOutline(playerid,Speed[playerid], 1);
    
PlayerTextDrawSetProportional(playerid,Speed[playerid], 1);
    return 
1;
}

public 
FuelTimer()
{
    new 
string[128];
    for(new 
0GetMaxPlayers(); i++)
    {
        if(
GetPlayerState(i) == PLAYER_STATE_DRIVER)
        {
            new 
vehicle GetPlayerVehicleID(i);
            if(
CarFuel[vehicle] >= && CarFuel[vehicle] <= 100)
            {
                
format(stringsizeof(string), "Current Fuel: %d%",CarFuel[vehicle]);
                  
SetGasString(i,string);
                  
CarFuel[vehicle]--;
               }
               if(
CarFuel[vehicle] == 0)
               {
                  
CarFuel[vehicle] = 0;
                  
TogglePlayerControllable(i0);
                
SetGasString(i,"~r~[WARNING]: ~w~No fuel in vehicle!");
            }
        }
        else
        {
            
SetGasString(i," ");
        }
    }
    return 
1;
}

public 
SpeedTimer()
{
    new 
string[128];
    for(new 
0GetMaxPlayers(); i++)
    {
        if(
GetPlayerState(i) == PLAYER_STATE_DRIVER)
        {
            
format(stringsizeof(string), "SPEED: ~g~%d MPH",GetPlayerSpeed(i,1));
              
SetSpeedString(i,string);
        }
        else
        {
            
SetSpeedString(i," ");
        }
    }
    return 
1;

Reply
#6

Код:
(106) : warning 217: loose indentation
Line: if(CarFuel[vehicle] == 0)
Код:
public FuelTimer()
{
    new string[128];
    for(new i = 0; i < GetMaxPlayers(); i++)
    {
        if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
        {
            new vehicle = GetPlayerVehicleID(i);
            if(CarFuel[vehicle] >= 1 && CarFuel[vehicle] <= 100)
            {
                format(string, sizeof(string), "Current Fuel: %d%",CarFuel[vehicle]);
                SetGasString(i,string);
                CarFuel[vehicle]--;
                }
                if(CarFuel[vehicle] == 0)
                {
                  CarFuel[vehicle] = 0;
                  TogglePlayerControllable(i, 0);
                  SetGasString(i,"~r~[WARNING]: ~w~No fuel in vehicle!");
            }
        }
        else
        {
            SetGasString(i," ");
        }
    }
    return 1;
}
Reply
#7

Removed
Reply
#8

Just an indent warning, nothing serious

PHP код:
public FuelTimer()
{
    new 
string[128];
    for(new 
0GetMaxPlayers(); i++)
    {
        if(
GetPlayerState(i) == PLAYER_STATE_DRIVER)
        {
            new 
vehicle GetPlayerVehicleID(i);
            if(
CarFuel[vehicle] >= && CarFuel[vehicle] <= 100)
            {
                
format(stringsizeof(string), "Current Fuel: %d%",CarFuel[vehicle]);
                
SetGasString(i,string);
                
CarFuel[vehicle]--;
            }
            if(
CarFuel[vehicle] == 0)
            {
                
CarFuel[vehicle] = 0;
                
TogglePlayerControllable(i0);
                
SetGasString(i,"~r~[WARNING]: ~w~No fuel in vehicle!");
            }
        }
        else
        {
            
SetGasString(i," ");
        }
    }
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)