SpeedoMeter
#1

Hi, I'm doing a speedometer on your server and does not want me to show textdraw why? and when draped Hide and Snow as he entered and did not show up when it is acting as signaling textdraw?: ( help me make it work

Код:
#include <a_samp>
#define MAX_BENZIN 30
#define BENZIN_CENA 10

new Text:BenzinTD[MAX_PLAYERS],Text:BenzinTD2[MAX_PLAYERS],Text:BenzinTD3[MAX_PLAYERS];
new Float:BenzinPos[MAX_BENZIN][3];
new BenzinCount = -1;
new Benzin[MAX_VEHICLES];
forward FuelUpdate(playerid);
forward FuelUp(playerid);

new VehicleNames[212][] = 
{
	{"Landstalker"},{"Bravura"},{"Buffalo"},{"Linerunner"},{"Perrenial"},{"Sentinel"},{"Dumper"},
	{"Firetruck"},{"Trashmaster"},{"Stretch"},{"Manana"},{"Infernus"},{"Voodoo"},{"Pony"},{"Mule"},
	{"Cheetah"},{"Ambulance"},{"Leviathan"},{"Moonbeam"},{"Esperanto"},{"Taxi"},{"Washington"},
	{"Bobcat"},{"Mr Whoopee"},{"BF Injection"},{"Hunter"},{"Premier"},{"Enforcer"},{"Securicar"},
	{"Banshee"},{"Predator"},{"Bus"},{"Rhino"},{"Barracks"},{"Hotknife"},{"Trailer 1"},{"Previon"},
	{"Coach"},{"Cabbie"},{"Stallion"},{"Rumpo"},{"RC Bandit"},{"Romero"},{"Packer"},{"Monster"},
	{"Admiral"},{"Squalo"},{"Seasparrow"},{"Pizzaboy"},{"Tram"},{"Trailer 2"},{"Turismo"},
	{"Speeder"},{"Reefer"},{"Tropic"},{"Flatbed"},{"Yankee"},{"Caddy"},{"Solair"},{"Berkley's Van"},
	{"Skimmer"},{"PCJ-600"},{"Faggio"},{"Freeway"},{"RC Baron"},{"RC Raider"},{"Glendale"},{"Oceanic"},
	{"Sanchez"},{"Sparrow"},{"Patriot"},{"Quad"},{"Coastguard"},{"Dinghy"},{"Hermes"},{"Sabre"},
	{"Rustler"},{"ZR-350"},{"Walton"},{"Regina"},{"Comet"},{"BMX"},{"Burrito"},{"Camper"},{"Marquis"},
	{"Baggage"},{"Dozer"},{"Maverick"},{"News Chopper"},{"Rancher"},{"FBI Rancher"},{"Virgo"},{"Greenwood"},
	{"Jetmax"},{"Hotring"},{"Sandking"},{"Blista Compact"},{"Police Maverick"},{"Boxville"},{"Benson"},
	{"Mesa"},{"RCGoblin"},{"HotRacer A"},{"HotRacer B"},{"Bloodring Banger"},{"Rancher"},
	{"Super GT"},{"Elegant"},{"Journey"},{"Bike"},{"Mountain Bike"},{"Beagle"},{"Cropdust"},{"Stunt"},
	{"Tanker"}, {"Roadtrain"},{"Nebula"},{"Majestic"},{"Buccaneer"},{"Shamal"},{"Hydra"},{"FCR-900"},
	{"NRG-500"},{"HPV1000"},{"Cement Truck"},{"Tow Truck"},{"Fortune"},{"Cadrona"},{"FBI Truck"},
	{"Willard"},{"Forklift"},{"Tractor"},{"Combine"},{"Feltzer"},{"Remington"},{"Slamvan"},
	{"Blade"},{"Freight"},{"Streak"},{"Vortex"},{"Vincent"},{"Bullet"},{"Clover"},{"Sadler"},
	{"Firetruck LA"},{"Hustler"},{"Intruder"},{"Primo"},{"Cargobob"},{"Tampa"},{"Sunrise"},{"Merit"},
	{"Utility"},{"Nevada"},{"Yosemite"},{"Windsor"},{"Monster A"},{"Monster B"},{"Uranus"},{"Jester"},
	{"Sultan"},{"Stratum"},{"Elegy"},{"Raindance"},{"RC Tiger"},{"Flash"},{"Tahoma"},{"Savanna"},
	{"Bandito"},{"Freight Flat"},{"Streak Carriage"},{"Kart"},{"Mower"},{"Duneride"},{"Sweeper"},
	{"Broadway"},{"Tornado"},{"AT-400"},{"DFT-30"},{"Huntley"},{"Stafford"},{"BF-400"},{"Newsvan"},
	{"Tug"},{"Trailer 3"},{"Emperor"},{"Wayfarer"},{"Euros"},{"Hotdog"},{"Club"},{"Freight Carriage"},
	{"Trailer 3"},{"Andromada"},{"Dodo"},{"RC Cam"},{"Launch"},{"Police Car"},{"SFPD"},
	{"LVPD"},{"Police Ranger"},{"Picador"},{"S.W.A.T. Van"},{"Alpha"},{"Phoenix"},{"Glendale"},
	{"Sadler"},{"LuTrailer A"},{"LuTrailer B"},{"Stair Trailer"},{"Boxville"},{"Farm Plow"},
	{"Utility Trailer"}
};


stock AddBenzinka(Float:x,Float:y,Float:z){
BenzinCount++;
if(BenzinCount >= MAX_BENZIN) return print("Bol prekroceny max. pocet benzinek !");
CreatePickup(1686,1,x,y,z);
BenzinPos[BenzinCount][0] = x;
BenzinPos[BenzinCount][1] = y;
BenzinPos[BenzinCount][2] = z;
return true;
}

stock GetVehicleSpeed(vehicleid)
{
    new Float:a,Float:b,Float:c,vel;
    GetVehicleVelocity(vehicleid, a, b, c);
    vel = floatround(floatsqroot(a*a + b*b + c*c)*180);
    return vel;
}

public OnGameModeInit()
{
AddBenzinka(2114.4521, 923.2661, 10.5474);
AddBenzinka(2639.2939, 1103.1833, 10.5479);
AddBenzinka(1597.0775, 2195.7436, 10.5474);
AddBenzinka(2146.8232, 2751.2419, 10.5474);
AddBenzinka(616.4793, 1690.5131, 6.7192);
AddBenzinka(-1328.2037, 2677.6928, 49.7896);
AddBenzinka(-1672.7383, 413.3457, 6.9067);
AddBenzinka(-2413.6634, 973.9432, 45.0239);
AddBenzinka(-1606.1141, -2713.7266, 48.2633);
AddBenzinka(1943.9356, -1772.9733, 13.1176);
AddBenzinka(2206.1804, 2474.2966, 10.8203);
AddBenzinka(1421.9689, 1463.2421, 10.8203);
AddBenzinka(1643.6905, -2593.9163, 13.5468);
AddBenzinka(-1411.5501, -2.4991, 14.875);
AddBenzinka(-1476.7148, 1861.8446, 32.6328);
AddBenzinka(1381.4516, 461.3782, 20.0785);
AddBenzinka(657.0178, -569.1056, 16.3358);
AddBenzinka(-95.6028, -1175.3602, 2.2834);
AddBenzinka(2864.75, 1255.6872, 12.3494);
AddBenzinka(-2264.6834, 526.548, 35.5931);

for(new x; x< MAX_VEHICLES;x++){
Benzin[x] = random(100);
}
return 1;
}

public OnPlayerConnect(playerid){
BenzinTD[playerid] = TextDrawCreate(6.000000, 286.000000, "-n-");
TextDrawBackgroundColor(BenzinTD[playerid], 255);
TextDrawFont(BenzinTD[playerid], 1);
TextDrawLetterSize(BenzinTD[playerid], 0.439996, 1.500000);
TextDrawColor(BenzinTD[playerid], 16711935);
TextDrawSetOutline(BenzinTD[playerid], 1);
TextDrawSetProportional(BenzinTD[playerid], 1);

BenzinTD2[playerid] = TextDrawCreate(6.000000, 304.000000, "-n-");
TextDrawBackgroundColor(BenzinTD2[playerid], 255);
TextDrawFont(BenzinTD2[playerid], 1);
TextDrawLetterSize(BenzinTD2[playerid], 0.429995, 1.399999);
TextDrawColor(BenzinTD2[playerid], 16711935);
TextDrawSetOutline(BenzinTD2[playerid], 1);
TextDrawSetProportional(BenzinTD2[playerid], 1);

BenzinTD3[playerid] = TextDrawCreate(6.000000, 321.000000, "-n-");
TextDrawBackgroundColor(BenzinTD3[playerid], 255);
TextDrawFont(BenzinTD3[playerid], 1);
TextDrawLetterSize(BenzinTD3[playerid], 0.449995, 1.399999);
TextDrawColor(BenzinTD3[playerid], 16711935);
TextDrawSetOutline(BenzinTD3[playerid], 1);
TextDrawSetProportional(BenzinTD3[playerid], 1);
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/tankovat", cmdtext, true, 10) == 0){
new string[128],PlayerName[24];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
Benzin[playerid] = random(100);
format(string,sizeof(string),"Administrбtor %s natankoval vљetky vozidlб na servery !",PlayerName);
SendClientMessageToAll(-1,string);
return 1;
}
return 0;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER){
new car = GetPlayerVehicleID(playerid);
if(Benzin[car] < 1){
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid,-1,"Autu dosiel benzin");
}
return true;
}
if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER){
TextDrawHideForPlayer(playerid,BenzinTD[playerid]);
TextDrawHideForPlayer(playerid,BenzinTD2[playerid]);
TextDrawHideForPlayer(playerid,BenzinTD3[playerid]);
}
return 1;
}

public FuelUp(playerid){
for(new i; i <= BenzinCount;i++){
if(IsPlayerInRangeOfPoint(playerid,4,BenzinPos[i][0],BenzinPos[i][1],BenzinPos[i][2])){
new car = GetPlayerVehicleID(playerid);
if(GetPlayerMoney(playerid) < BENZIN_CENA){
SendClientMessage(playerid,-1,"Nemas dostatok penazi");
}else{
if(Benzin[car] < 100){
Benzin[car]++;
GivePlayerMoney(playerid,-BENZIN_CENA);
}}
break;
}}
return true;
}

public FuelUpdate(playerid){
if(IsPlayerConnected(playerid)){
new car = GetPlayerVehicleID(playerid);
if(car > 0){
SetPVarInt(playerid,"BenzinUpdate",GetPVarInt(playerid,"BenzinUpdate")+1);
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER){
FuelUp(playerid);
}
if(GetPVarInt(playerid,"BenzinUpdate") == 50) {
SetPVarInt(playerid,"BenzinUpdate",0);
Benzin[car] -= random(2)+1;
}
new str[100],vehicleid = GetPlayerVehicleID(playerid);
format(str,100,"~g~Vehicle:~r~ %d",VehicleNames[GetVehicleModel(vehicleid)-400]);
TextDrawSetString(BenzinTD[playerid],str);
TextDrawHideForPlayer(playerid,BenzinTD[playerid]);

format(str,100,"~g~KM/H:~r~ %d",GetVehicleSpeed(vehicleid));
TextDrawSetString(BenzinTD2[playerid],str);
TextDrawHideForPlayer(playerid,BenzinTD2[playerid]);

format(str,100,"~g~FUEL:~r~ %d",Benzin[car]);
TextDrawSetString(BenzinTD3[playerid],str);
TextDrawHideForPlayer(playerid,BenzinTD3[playerid]);

if(Benzin[car] < 1){
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid,2,"Autu dosiel benzin");
}}}
return 1;
}
Reply
#2

Bro - Use translate.******.com we don't understand you.
Reply
#3

I've done all my speedometer and Text Draw shows we try to fix it and it still does not work
Reply
#4

Help me?
Reply
#5

Help me
Reply
#6

And hereby:


pawn Код:
#include <a_samp>
#define MAX_BENZIN 30
#define BENZIN_CENA 10

new Text:BenzinTD,Text:BenzinTD2,Text:BenzinTD3;
new Float:BenzinPos[MAX_BENZIN][3];
new BenzinCount = -1;
new Benzin[MAX_VEHICLES];
forward FuelUpdate(playerid);
forward FuelUp(playerid);

new VehicleNames[212][] =
{
    {"Landstalker"},{"Bravura"},{"Buffalo"},{"Linerunner"},{"Perrenial"},{"Sentinel"},{"Dumper"},
    {"Firetruck"},{"Trashmaster"},{"Stretch"},{"Manana"},{"Infernus"},{"Voodoo"},{"Pony"},{"Mule"},
    {"Cheetah"},{"Ambulance"},{"Leviathan"},{"Moonbeam"},{"Esperanto"},{"Taxi"},{"Washington"},
    {"Bobcat"},{"Mr Whoopee"},{"BF Injection"},{"Hunter"},{"Premier"},{"Enforcer"},{"Securicar"},
    {"Banshee"},{"Predator"},{"Bus"},{"Rhino"},{"Barracks"},{"Hotknife"},{"Trailer 1"},{"Previon"},
    {"Coach"},{"Cabbie"},{"Stallion"},{"Rumpo"},{"RC Bandit"},{"Romero"},{"Packer"},{"Monster"},
    {"Admiral"},{"Squalo"},{"Seasparrow"},{"Pizzaboy"},{"Tram"},{"Trailer 2"},{"Turismo"},
    {"Speeder"},{"Reefer"},{"Tropic"},{"Flatbed"},{"Yankee"},{"Caddy"},{"Solair"},{"Berkley's Van"},
    {"Skimmer"},{"PCJ-600"},{"Faggio"},{"Freeway"},{"RC Baron"},{"RC Raider"},{"Glendale"},{"Oceanic"},
    {"Sanchez"},{"Sparrow"},{"Patriot"},{"Quad"},{"Coastguard"},{"Dinghy"},{"Hermes"},{"Sabre"},
    {"Rustler"},{"ZR-350"},{"Walton"},{"Regina"},{"Comet"},{"BMX"},{"Burrito"},{"Camper"},{"Marquis"},
    {"Baggage"},{"Dozer"},{"Maverick"},{"News Chopper"},{"Rancher"},{"FBI Rancher"},{"Virgo"},{"Greenwood"},
    {"Jetmax"},{"Hotring"},{"Sandking"},{"Blista Compact"},{"Police Maverick"},{"Boxville"},{"Benson"},
    {"Mesa"},{"RCGoblin"},{"HotRacer A"},{"HotRacer B"},{"Bloodring Banger"},{"Rancher"},
    {"Super GT"},{"Elegant"},{"Journey"},{"Bike"},{"Mountain Bike"},{"Beagle"},{"Cropdust"},{"Stunt"},
    {"Tanker"}, {"Roadtrain"},{"Nebula"},{"Majestic"},{"Buccaneer"},{"Shamal"},{"Hydra"},{"FCR-900"},
    {"NRG-500"},{"HPV1000"},{"Cement Truck"},{"Tow Truck"},{"Fortune"},{"Cadrona"},{"FBI Truck"},
    {"Willard"},{"Forklift"},{"Tractor"},{"Combine"},{"Feltzer"},{"Remington"},{"Slamvan"},
    {"Blade"},{"Freight"},{"Streak"},{"Vortex"},{"Vincent"},{"Bullet"},{"Clover"},{"Sadler"},
    {"Firetruck LA"},{"Hustler"},{"Intruder"},{"Primo"},{"Cargobob"},{"Tampa"},{"Sunrise"},{"Merit"},
    {"Utility"},{"Nevada"},{"Yosemite"},{"Windsor"},{"Monster A"},{"Monster B"},{"Uranus"},{"Jester"},
    {"Sultan"},{"Stratum"},{"Elegy"},{"Raindance"},{"RC Tiger"},{"Flash"},{"Tahoma"},{"Savanna"},
    {"Bandito"},{"Freight Flat"},{"Streak Carriage"},{"Kart"},{"Mower"},{"Duneride"},{"Sweeper"},
    {"Broadway"},{"Tornado"},{"AT-400"},{"DFT-30"},{"Huntley"},{"Stafford"},{"BF-400"},{"Newsvan"},
    {"Tug"},{"Trailer 3"},{"Emperor"},{"Wayfarer"},{"Euros"},{"Hotdog"},{"Club"},{"Freight Carriage"},
    {"Trailer 3"},{"Andromada"},{"Dodo"},{"RC Cam"},{"Launch"},{"Police Car"},{"SFPD"},
    {"LVPD"},{"Police Ranger"},{"Picador"},{"S.W.A.T. Van"},{"Alpha"},{"Phoenix"},{"Glendale"},
    {"Sadler"},{"LuTrailer A"},{"LuTrailer B"},{"Stair Trailer"},{"Boxville"},{"Farm Plow"},
    {"Utility Trailer"}
};


stock AddBenzinka(Float:x,Float:y,Float:z)
{
    BenzinCount ++;
    if(BenzinCount >= MAX_BENZIN) return print("Bol prekroceny max. pocet benzinek !");
    CreatePickup(1686, 1, x, y, z);
    BenzinPos[BenzinCount][0] = x;
    BenzinPos[BenzinCount][1] = y;
    BenzinPos[BenzinCount][2] = z;
    return true;
}

stock GetVehicleSpeed(vehicleid)
{
    new Float:a,Float:b,Float:c,vel;
    GetVehicleVelocity(vehicleid, a, b, c);
    vel = floatround(floatsqroot(a*a + b*b + c*c)*180);
    return vel;
}

public OnFilterScritInit()
{
    BenzinTD = TextDrawCreate(6.000000, 286.000000, "-n-");
    TextDrawBackgroundColor(BenzinTD, 255);
    TextDrawFont(BenzinTD, 1);
    TextDrawLetterSize(BenzinTD, 0.439996, 1.500000);
    TextDrawColor(BenzinTD, 16711935);
    TextDrawSetOutline(BenzinTD, 1);
    TextDrawSetProportional(BenzinTD, 1);

    BenzinTD2 = TextDrawCreate(6.000000, 304.000000, "-n-");
    TextDrawBackgroundColor(BenzinTD2, 255);
    TextDrawFont(BenzinTD2, 1);
    TextDrawLetterSize(BenzinTD2, 0.429995, 1.399999);
    TextDrawColor(BenzinTD2, 16711935);
    TextDrawSetOutline(BenzinTD2, 1);
    TextDrawSetProportional(BenzinTD2, 1);

    BenzinTD3 = TextDrawCreate(6.000000, 321.000000, "-n-");
    TextDrawBackgroundColor(BenzinTD3, 255);
    TextDrawFont(BenzinTD3, 1);
    TextDrawLetterSize(BenzinTD3, 0.449995, 1.399999);
    TextDrawColor(BenzinTD3, 16711935);
    TextDrawSetOutline(BenzinTD3, 1);
    TextDrawSetProportional(BenzinTD3, 1);


    AddBenzinka(2114.4521, 923.2661, 10.5474);
    AddBenzinka(2639.2939, 1103.1833, 10.5479);
    AddBenzinka(1597.0775, 2195.7436, 10.5474);
    AddBenzinka(2146.8232, 2751.2419, 10.5474);
    AddBenzinka(616.4793, 1690.5131, 6.7192);
    AddBenzinka(-1328.2037, 2677.6928, 49.7896);
    AddBenzinka(-1672.7383, 413.3457, 6.9067);
    AddBenzinka(-2413.6634, 973.9432, 45.0239);
    AddBenzinka(-1606.1141, -2713.7266, 48.2633);
    AddBenzinka(1943.9356, -1772.9733, 13.1176);
    AddBenzinka(2206.1804, 2474.2966, 10.8203);
    AddBenzinka(1421.9689, 1463.2421, 10.8203);
    AddBenzinka(1643.6905, -2593.9163, 13.5468);
    AddBenzinka(-1411.5501, -2.4991, 14.875);
    AddBenzinka(-1476.7148, 1861.8446, 32.6328);
    AddBenzinka(1381.4516, 461.3782, 20.0785);
    AddBenzinka(657.0178, -569.1056, 16.3358);
    AddBenzinka(-95.6028, -1175.3602, 2.2834);
    AddBenzinka(2864.75, 1255.6872, 12.3494);
    AddBenzinka(-2264.6834, 526.548, 35.5931);

    for(new x; x< MAX_VEHICLES;x++)
    {
        Benzin[x] = random(100);
    }
    return 1;
}


public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/tankovat", cmdtext, true, 10) == 0)
    {
        new string[128],PlayerName[24];
        GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
        Benzin[playerid] = random(100);
        format(string,sizeof(string),"Administrбtor %s natankoval vљetky vozidlб na servery !",PlayerName);
        SendClientMessageToAll(-1,string);
        return 1;
    }
    return 0;
}


public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
        new car = GetPlayerVehicleID(playerid);
        if(Benzin[car] < 1)
        {
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid,-1,"Autu dosiel benzin");
        }
    }
    if(newstate == PLAYER_STATE_PASSENGER || newstate PLAYER_STATE_ONFOOT)
    {
        TextDrawHideForPlayer(playerid,BenzinTD);
        TextDrawHideForPlayer(playerid,BenzinTD2);
        TextDrawHideForPlayer(playerid,BenzinTD3);
    }
    return 1;
}

public FuelUp(playerid)
{
    for(new i; i <= BenzinCount;i++)
    {
        if(IsPlayerInRangeOfPoint(playerid, 4, BenzinPos[i][0], BenzinPos[i][1], BenzinPos[i][2]))
        {
            new car = GetPlayerVehicleID(playerid);
            if(GetPlayerMoney(playerid) < BENZIN_CENA)
            {
                SendClientMessage(playerid,-1,"Nemas dostatok penazi");
            }
            else
            {
                if(Benzin[car] < 100)
                {
                    Benzin[car]++;
                    GivePlayerMoney(playerid,-BENZIN_CENA);
                }
            }
            break;
        }
    }
    return true;
}


public FuelUpdate(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        new car = GetPlayerVehicleID(playerid);
        if(car > 0)
        {
            SetPVarInt(playerid, "BenzinUpdate", GetPVarInt(playerid, "BenzinUpdate") +1);
            if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
            {
                FuelUp(playerid);
            }
            if(GetPVarInt(playerid,"BenzinUpdate") == 50)
            {
                SetPVarInt(playerid,"BenzinUpdate",0);
                Benzin[car] -= random(2)+1;
            }
            new str[100],vehicleid = GetPlayerVehicleID(playerid);
            format(str,100,"~g~Vehicle:~r~ %d",VehicleNames[GetVehicleModel(vehicleid)-400]);
            TextDrawSetString(BenzinTD,str);
            TextDrawHideForPlayer(playerid,BenzinTD);

            format(str,100,"~g~KM/H:~r~ %d",GetVehicleSpeed(vehicleid));
            TextDrawSetString(BenzinTD2,str);
            TextDrawHideForPlayer(playerid,BenzinTD2);

            format(str,100,"~g~FUEL:~r~ %d",Benzin[car]);
            TextDrawSetString(BenzinTD3,str);
            TextDrawHideForPlayer(playerid,BenzinTD3);

            if(Benzin[car] < 1)
            {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid,2,"Autu dosiel benzin");
            }
        }
    }
    return 1;
}
?
Reply
#7

Do not show TextDraw
Reply
#8

Help me??
Reply
#9

You need to put the function TextDrawShowForPlayer into the public OnPlayerStateChange.
Reply
#10

Aj po SVK mфžeš pнsat
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)