Szerző Téma: TextDraw áthelyezése  (Megtekintve 860 alkalommal)

Nem elérhető BoSS

  • 816
    • Profil megtekintése
TextDraw áthelyezése
« Dátum: 2012. május 12. - 15:50:58 »
0 Show voters
Hy,ismét azt szeretném,hogy töltöttem egy Speedometer scriptet angol forumról és a térképfölé szeretném átrakni
Ezt valaki meg tudná nekem csinálni mert én nem tudom átrakni oda sajnos
FS
 
#include <a_samp>
#include <YSI\\y_commands>
#define COLOR_KRED                                              0xFF0000FF
#define COLOR_YELLOW                                            0xFFFF00AA
forward RefuelVehicle(playerid);
forward FuelLower();
new Fuel[MAX_VEHICLES], bool: IsRefuelling[MAX_PLAYERS] = false, FuelPrice = 0;
new Text: sName[MAX_PLAYERS], Text: sSpeed[MAX_PLAYERS], Text: sState[MAX_PLAYERS], Text: sHealth[MAX_PLAYERS], Text: sFuel[MAX_PLAYERS];
new Vehicles[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\"},{\"Article Trailer\"},{\"Previon\"},{\"Coach\"},{\"Cabbie\"},{\"Stallion\"},{\"Rumpo\"},{\"RC Bandit\"},{\"Romero\"},{\"Packer\"},{\"Monster\"},
{\"Admiral\"},{\"Squalo\"},{\"Seasparrow\"},{\"Pizzaboy\"},{\"Tram\"},{\"Article Trailer 2\"},{\"Turismo\"},{\"Speeder\"},{\"Reefer\"},{\"Tropic\"},{\"Flatbed\"},{\"Yankee\"},{\"Caddy\"},{\"Solair\"},{\"Berkley\'s RC 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\"},{\"RC Goblin\"},{\"Hotring Racer A\"},{\"Hotring Racer 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\"},{\"Dunerider\"},{\"Sweeper\"},{\"Broadway\"},{\"Tornado\"},{\"AT-400\"},{\"DFT-30\"},{\"Huntley\"},{\"Stafford\"},{\"BF-400\"},{\"Newsvan\"},{\"Tug\"},{\"Article Trailer 3\"},{\"Emperor\"},{\"Wayfarer\"},{\"Euros\"},{\"Mobile Hotdog\"},
{\"Club\"},{\"Freight Carriage\"},{\"Trailer 3\"},{\"Andromada\"},{\"Dodo\"},{\"RC Cam\"},{\"Launch\"},{\"Police Car (LSPD)\"},{\"Police Car (SFPD)\"},{\"Police Car (LVPD)\"},{\"Police Ranger\"},{\"Picador\"},{\"S.W.A.T Van\"},{\"Alpha\"},{\"Phoenix\"},{\"Glendale\"},{\"Sadler\"},{\"Luggage Trailer A\"},{\"Luggage Trailer B\"},{\"Stair Trailer\"},
{\"Boxville\"},{\"Farm Plow\"},{\"Utility Trailer\"}
};
public OnFilterScriptInit()
{
print(\"\\n\");
    print(\"  \\4\\4\\4\\4\\4\\4\\4\\4\\4\\4\\4\\4\\4\\4\");
print(\"  \\4 S32_Speedo \\4\");
print(\"  \\4 by         \\4\");
print(\"  \\4 System32   \\4\");
print(\"  \\4\\4\\4\\4\\4\\4\\4\\4\\4\\4\\4\\4\\4\\4\\n\");
    for(new v = 0; v < MAX_VEHICLES; v++) Fuel[v] = 100;
    SetTimer(\"FuelLower\", 20000, 1);
return 1;
}
public OnPlayerConnect(playerid)
{
    sName[playerid] = TextDrawCreate(561.000000, 266.000000, \"Name\");
TextDrawAlignment(sName[playerid], 2);
TextDrawBackgroundColor(sName[playerid], 255);
TextDrawFont(sName[playerid], 2);
TextDrawLetterSize(sName[playerid], 0.500000, 1.000000);
TextDrawColor(sName[playerid], -1);
TextDrawSetOutline(sName[playerid], 0);
TextDrawSetProportional(sName[playerid], 1);
TextDrawSetShadow(sName[playerid], 1);
sSpeed[playerid] = TextDrawCreate(561.000000, 280.000000, \"0 KM/H\");
TextDrawAlignment(sSpeed[playerid], 2);
TextDrawBackgroundColor(sSpeed[playerid], 255);
TextDrawFont(sSpeed[playerid], 1);
TextDrawLetterSize(sSpeed[playerid], 0.500000, 1.000000);
TextDrawColor(sSpeed[playerid], 16711935);
TextDrawSetOutline(sSpeed[playerid], 0);
TextDrawSetProportional(sSpeed[playerid], 1);
TextDrawSetShadow(sSpeed[playerid], 1);
sState[playerid] = TextDrawCreate(539.000000, 295.000000, \"~r~R N D\");
TextDrawBackgroundColor(sState[playerid], 255);
TextDrawFont(sState[playerid], 1);
TextDrawLetterSize(sState[playerid], 0.500000, 1.000000);
TextDrawColor(sState[playerid], -1);
TextDrawSetOutline(sState[playerid], 0);
TextDrawSetProportional(sState[playerid], 1);
TextDrawSetShadow(sState[playerid], 1);
sHealth[playerid] = TextDrawCreate(537.000000, 309.000000, \"~g~| | |\");
TextDrawBackgroundColor(sHealth[playerid], 255);
TextDrawFont(sHealth[playerid], 1);
TextDrawLetterSize(sHealth[playerid], 0.640000, 1.999999);
TextDrawColor(sHealth[playerid], -1);
TextDrawSetOutline(sHealth[playerid], 1);
TextDrawSetProportional(sHealth[playerid], 1);
sFuel[playerid] = TextDrawCreate(565.000000, 324.000000, \".\");
TextDrawAlignment(sFuel[playerid], 2);
TextDrawBackgroundColor(sFuel[playerid], 255);
TextDrawFont(sFuel[playerid], 1);
TextDrawLetterSize(sFuel[playerid], 0.500000, 1.000000);
TextDrawColor(sFuel[playerid], -1);
TextDrawSetOutline(sFuel[playerid], 0);
TextDrawSetProportional(sFuel[playerid], 1);
TextDrawSetShadow(sFuel[playerid], 1);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new string[128], sname[50];
    if(oldstate-1 && newstate) TextDrawHideForPlayer(playerid, sName[playerid]); else if(newstate-1) TextDrawShowForPlayer(playerid, sName[playerid]), format(sname, sizeof(sname), \"%s\", Vehicles[GetVehicleModel(GetPlayerVehicleID(playerid)) - 400]), TextDrawSetString(sName[playerid], sname);
    if(oldstate-1 && newstate) TextDrawHideForPlayer(playerid, sSpeed[playerid]); else if(newstate-1) TextDrawShowForPlayer(playerid, sSpeed[playerid]);
    if(oldstate-1 && newstate) TextDrawHideForPlayer(playerid, sState[playerid]); else if(newstate-1) TextDrawShowForPlayer(playerid, sState[playerid]);
    if(oldstate-1 && newstate) TextDrawHideForPlayer(playerid, sHealth[playerid]); else if(newstate-1) TextDrawShowForPlayer(playerid, sHealth[playerid]);
    if(oldstate-1 && newstate) TextDrawHideForPlayer(playerid, sFuel[playerid]); else if(newstate-1) TextDrawShowForPlayer(playerid, sFuel[playerid]), format(string, sizeof(string), \"%d\", Fuel[GetPlayerVehicleID(playerid)]), TextDrawSetString(sFuel[playerid], string);
return 1;
}
public OnPlayerUpdate(playerid)
{
if(IsPlayerInAnyVehicle(playerid))
{
    // Vehicle speed
new sspeed[16];
format(sspeed, sizeof(sspeed), \"%d KM/H\", GetSpeed(playerid));
TextDrawSetString(sSpeed[playerid], sspeed);
// Vehicle state
new Float: Pos[4];
GetVehicleVelocity(GetPlayerVehicleID(playerid), Pos[0], Pos[1], Pos[2]);
new keys, ud, lr;
GetPlayerKeys(playerid, keys, ud, lr);
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
   if(keys == KEY_JUMP) TextDrawSetString(sState[playerid], \"~w~R ~r~N D\");
   else if(keys == KEY_SPRINT) TextDrawSetString(sState[playerid], \"~r~R N ~w~D\");
   if(Pos[0] == 0.0 && Pos[1] == 0.0 && Pos[2] == 0.0) TextDrawSetString(sState[playerid], \"~r~R ~w~N ~r~D\");
}
// Vehicle health
new Float: vHealth;
GetVehicleHealth(GetPlayerVehicleID(playerid), vHealth);
        if(vHealth > 700) TextDrawSetString(sHealth[playerid], \"~g~| | |\");
if(vHealth < 700) TextDrawSetString(sHealth[playerid], \"~r~| ~g~| |\");
if(vHealth < 400) TextDrawSetString(sHealth[playerid], \"~r~| | ~g~|\");
if(vHealth < 250) TextDrawSetString(sHealth[playerid], \"~r~| | |\");
}
return 1;
}
YCMD:refuel(playerid, params[], help)
{
#pragma unused help
#pragma unused params
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_KRED, \"You are not in an vehicle!\");
if(IsRefuelling[playerid] == true) return SendClientMessage(playerid, COLOR_KRED, \"You are already refueling!\");
if(Fuel[GetPlayerVehicleID(playerid)] > 90) FuelPrice = 500;
if(Fuel[GetPlayerVehicleID(playerid)] > 80 && Fuel[GetPlayerVehicleID(playerid)] < 90) FuelPrice = 450;
if(Fuel[GetPlayerVehicleID(playerid)] > 70 && Fuel[GetPlayerVehicleID(playerid)] < 80) FuelPrice = 400;
if(Fuel[GetPlayerVehicleID(playerid)] > 60 && Fuel[GetPlayerVehicleID(playerid)] < 70) FuelPrice = 350;
if(Fuel[GetPlayerVehicleID(playerid)] > 50 && Fuel[GetPlayerVehicleID(playerid)] < 60) FuelPrice = 300;
if(Fuel[GetPlayerVehicleID(playerid)] > 40 && Fuel[GetPlayerVehicleID(playerid)] < 50) FuelPrice = 250;
if(Fuel[GetPlayerVehicleID(playerid)] > 30 && Fuel[GetPlayerVehicleID(playerid)] < 40) FuelPrice = 200;
if(Fuel[GetPlayerVehicleID(playerid)] > 20 && Fuel[GetPlayerVehicleID(playerid)] < 30) FuelPrice = 150;
if(Fuel[GetPlayerVehicleID(playerid)] > 10 && Fuel[GetPlayerVehicleID(playerid)] < 20) FuelPrice = 100;
if(Fuel[GetPlayerVehicleID(playerid)] < 10) FuelPrice = 50;
if(GetPlayerMoney(playerid) < FuelPrice) return SendClientMessage(playerid, COLOR_KRED, \"You don\'t have enough money!\");
IsRefuelling[playerid] = true;
SetCameraBehindPlayer(playerid);
TogglePlayerControllable(playerid, 0);
GameTextForPlayer(playerid, \"Refuelling...\", 1000, 5);
SetTimerEx(\"RefuelVehicle\", 5000, 0, \"d\", playerid);
return 1;
}
public RefuelVehicle(playerid)
{
new string[128];
    Fuel[GetPlayerVehicleID(playerid)] = Fuel[GetPlayerVehicleID(playerid)] = 100;
    IsRefuelling[playerid] = false;
    GivePlayerMoney(playerid, -FuelPrice);
TogglePlayerControllable(playerid, 1);
    format(string, sizeof(string), \"Your vehicle is refuel! You paid $%d!\", FuelPrice);
    SendClientMessage(playerid, COLOR_YELLOW, string);
    FuelPrice = 0;
return 1;
}
public FuelLower()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
    if(!IsPlayerConnected(i)) continue;
        if(IsRefuelling) continue;
        if(GetPlayerVehicleSeat(i) == 0)
{
            Fuel[GetPlayerVehicleID(i)] = Fuel[GetPlayerVehicleID(i)] - 1;
            if(Fuel[GetPlayerVehicleID(i)] < 1)
            {
                Fuel[GetPlayerVehicleID(i)] = 0;
                RemovePlayerFromVehicle(i);
                GameTextForPlayer(i, \"~r~Vehicle is out of ~w~fuel~r~!\", 5000, 5);
            }
        }
        new string[128];
format(string, sizeof(string), \"%d\", Fuel[GetPlayerVehicleID(i)]);
        TextDrawSetString(sFuel, string);
}
return 1;
}
stock GetSpeed(playerid)
{
new Float: Pos[4];
    GetVehicleVelocity(GetPlayerVehicleID(playerid), Pos[0], Pos[1], Pos[2]);
    return floatround(1.61 * floatsqroot(floatabs(floatpower(Pos[0] + Pos[1] + Pos[2], 2))) * 100);
}

Nem elérhető instant

  • 2778
  • ZzzzzZ
    • Profil megtekintése
TextDraw áthelyezése
« Válasz #1 Dátum: 2012. május 13. - 11:58:51 »
0 Show voters
textdraw editor..

TextDraw áthelyezése
« Válasz #2 Dátum: 2012. május 13. - 16:42:50 »
0 Show voters

Nem elérhető BoSS

  • 816
    • Profil megtekintése
TextDraw áthelyezése
« Válasz #3 Dátum: 2012. május 12. - 15:50:58 »
0 Show voters
Hy,ismét azt szeretném,hogy töltöttem egy Speedometer scriptet angol forumról és a térképfölé szeretném átrakni
Ezt valaki meg tudná nekem csinálni mert én nem tudom átrakni oda sajnos
FS
 
#include <a_samp>
#include <YSI\\y_commands>
#define COLOR_KRED                                              0xFF0000FF
#define COLOR_YELLOW                                            0xFFFF00AA
forward RefuelVehicle(playerid);
forward FuelLower();
new Fuel[MAX_VEHICLES], bool: IsRefuelling[MAX_PLAYERS] = false, FuelPrice = 0;
new Text: sName[MAX_PLAYERS], Text: sSpeed[MAX_PLAYERS], Text: sState[MAX_PLAYERS], Text: sHealth[MAX_PLAYERS], Text: sFuel[MAX_PLAYERS];
new Vehicles[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\"},{\"Article Trailer\"},{\"Previon\"},{\"Coach\"},{\"Cabbie\"},{\"Stallion\"},{\"Rumpo\"},{\"RC Bandit\"},{\"Romero\"},{\"Packer\"},{\"Monster\"},
{\"Admiral\"},{\"Squalo\"},{\"Seasparrow\"},{\"Pizzaboy\"},{\"Tram\"},{\"Article Trailer 2\"},{\"Turismo\"},{\"Speeder\"},{\"Reefer\"},{\"Tropic\"},{\"Flatbed\"},{\"Yankee\"},{\"Caddy\"},{\"Solair\"},{\"Berkley\'s RC 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\"},{\"RC Goblin\"},{\"Hotring Racer A\"},{\"Hotring Racer 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\"},{\"Dunerider\"},{\"Sweeper\"},{\"Broadway\"},{\"Tornado\"},{\"AT-400\"},{\"DFT-30\"},{\"Huntley\"},{\"Stafford\"},{\"BF-400\"},{\"Newsvan\"},{\"Tug\"},{\"Article Trailer 3\"},{\"Emperor\"},{\"Wayfarer\"},{\"Euros\"},{\"Mobile Hotdog\"},
{\"Club\"},{\"Freight Carriage\"},{\"Trailer 3\"},{\"Andromada\"},{\"Dodo\"},{\"RC Cam\"},{\"Launch\"},{\"Police Car (LSPD)\"},{\"Police Car (SFPD)\"},{\"Police Car (LVPD)\"},{\"Police Ranger\"},{\"Picador\"},{\"S.W.A.T Van\"},{\"Alpha\"},{\"Phoenix\"},{\"Glendale\"},{\"Sadler\"},{\"Luggage Trailer A\"},{\"Luggage Trailer B\"},{\"Stair Trailer\"},
{\"Boxville\"},{\"Farm Plow\"},{\"Utility Trailer\"}
};
public OnFilterScriptInit()
{
print(\"\\n\");
    print(\"  \\4\\4\\4\\4\\4\\4\\4\\4\\4\\4\\4\\4\\4\\4\");
print(\"  \\4 S32_Speedo \\4\");
print(\"  \\4 by         \\4\");
print(\"  \\4 System32   \\4\");
print(\"  \\4\\4\\4\\4\\4\\4\\4\\4\\4\\4\\4\\4\\4\\4\\n\");
    for(new v = 0; v < MAX_VEHICLES; v++) Fuel[v] = 100;
    SetTimer(\"FuelLower\", 20000, 1);
return 1;
}
public OnPlayerConnect(playerid)
{
    sName[playerid] = TextDrawCreate(561.000000, 266.000000, \"Name\");
TextDrawAlignment(sName[playerid], 2);
TextDrawBackgroundColor(sName[playerid], 255);
TextDrawFont(sName[playerid], 2);
TextDrawLetterSize(sName[playerid], 0.500000, 1.000000);
TextDrawColor(sName[playerid], -1);
TextDrawSetOutline(sName[playerid], 0);
TextDrawSetProportional(sName[playerid], 1);
TextDrawSetShadow(sName[playerid], 1);
sSpeed[playerid] = TextDrawCreate(561.000000, 280.000000, \"0 KM/H\");
TextDrawAlignment(sSpeed[playerid], 2);
TextDrawBackgroundColor(sSpeed[playerid], 255);
TextDrawFont(sSpeed[playerid], 1);
TextDrawLetterSize(sSpeed[playerid], 0.500000, 1.000000);
TextDrawColor(sSpeed[playerid], 16711935);
TextDrawSetOutline(sSpeed[playerid], 0);
TextDrawSetProportional(sSpeed[playerid], 1);
TextDrawSetShadow(sSpeed[playerid], 1);
sState[playerid] = TextDrawCreate(539.000000, 295.000000, \"~r~R N D\");
TextDrawBackgroundColor(sState[playerid], 255);
TextDrawFont(sState[playerid], 1);
TextDrawLetterSize(sState[playerid], 0.500000, 1.000000);
TextDrawColor(sState[playerid], -1);
TextDrawSetOutline(sState[playerid], 0);
TextDrawSetProportional(sState[playerid], 1);
TextDrawSetShadow(sState[playerid], 1);
sHealth[playerid] = TextDrawCreate(537.000000, 309.000000, \"~g~| | |\");
TextDrawBackgroundColor(sHealth[playerid], 255);
TextDrawFont(sHealth[playerid], 1);
TextDrawLetterSize(sHealth[playerid], 0.640000, 1.999999);
TextDrawColor(sHealth[playerid], -1);
TextDrawSetOutline(sHealth[playerid], 1);
TextDrawSetProportional(sHealth[playerid], 1);
sFuel[playerid] = TextDrawCreate(565.000000, 324.000000, \".\");
TextDrawAlignment(sFuel[playerid], 2);
TextDrawBackgroundColor(sFuel[playerid], 255);
TextDrawFont(sFuel[playerid], 1);
TextDrawLetterSize(sFuel[playerid], 0.500000, 1.000000);
TextDrawColor(sFuel[playerid], -1);
TextDrawSetOutline(sFuel[playerid], 0);
TextDrawSetProportional(sFuel[playerid], 1);
TextDrawSetShadow(sFuel[playerid], 1);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new string[128], sname[50];
    if(oldstate-1 && newstate) TextDrawHideForPlayer(playerid, sName[playerid]); else if(newstate-1) TextDrawShowForPlayer(playerid, sName[playerid]), format(sname, sizeof(sname), \"%s\", Vehicles[GetVehicleModel(GetPlayerVehicleID(playerid)) - 400]), TextDrawSetString(sName[playerid], sname);
    if(oldstate-1 && newstate) TextDrawHideForPlayer(playerid, sSpeed[playerid]); else if(newstate-1) TextDrawShowForPlayer(playerid, sSpeed[playerid]);
    if(oldstate-1 && newstate) TextDrawHideForPlayer(playerid, sState[playerid]); else if(newstate-1) TextDrawShowForPlayer(playerid, sState[playerid]);
    if(oldstate-1 && newstate) TextDrawHideForPlayer(playerid, sHealth[playerid]); else if(newstate-1) TextDrawShowForPlayer(playerid, sHealth[playerid]);
    if(oldstate-1 && newstate) TextDrawHideForPlayer(playerid, sFuel[playerid]); else if(newstate-1) TextDrawShowForPlayer(playerid, sFuel[playerid]), format(string, sizeof(string), \"%d\", Fuel[GetPlayerVehicleID(playerid)]), TextDrawSetString(sFuel[playerid], string);
return 1;
}
public OnPlayerUpdate(playerid)
{
if(IsPlayerInAnyVehicle(playerid))
{
    // Vehicle speed
new sspeed[16];
format(sspeed, sizeof(sspeed), \"%d KM/H\", GetSpeed(playerid));
TextDrawSetString(sSpeed[playerid], sspeed);
// Vehicle state
new Float: Pos[4];
GetVehicleVelocity(GetPlayerVehicleID(playerid), Pos[0], Pos[1], Pos[2]);
new keys, ud, lr;
GetPlayerKeys(playerid, keys, ud, lr);
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
   if(keys == KEY_JUMP) TextDrawSetString(sState[playerid], \"~w~R ~r~N D\");
   else if(keys == KEY_SPRINT) TextDrawSetString(sState[playerid], \"~r~R N ~w~D\");
   if(Pos[0] == 0.0 && Pos[1] == 0.0 && Pos[2] == 0.0) TextDrawSetString(sState[playerid], \"~r~R ~w~N ~r~D\");
}
// Vehicle health
new Float: vHealth;
GetVehicleHealth(GetPlayerVehicleID(playerid), vHealth);
        if(vHealth > 700) TextDrawSetString(sHealth[playerid], \"~g~| | |\");
if(vHealth < 700) TextDrawSetString(sHealth[playerid], \"~r~| ~g~| |\");
if(vHealth < 400) TextDrawSetString(sHealth[playerid], \"~r~| | ~g~|\");
if(vHealth < 250) TextDrawSetString(sHealth[playerid], \"~r~| | |\");
}
return 1;
}
YCMD:refuel(playerid, params[], help)
{
#pragma unused help
#pragma unused params
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_KRED, \"You are not in an vehicle!\");
if(IsRefuelling[playerid] == true) return SendClientMessage(playerid, COLOR_KRED, \"You are already refueling!\");
if(Fuel[GetPlayerVehicleID(playerid)] > 90) FuelPrice = 500;
if(Fuel[GetPlayerVehicleID(playerid)] > 80 && Fuel[GetPlayerVehicleID(playerid)] < 90) FuelPrice = 450;
if(Fuel[GetPlayerVehicleID(playerid)] > 70 && Fuel[GetPlayerVehicleID(playerid)] < 80) FuelPrice = 400;
if(Fuel[GetPlayerVehicleID(playerid)] > 60 && Fuel[GetPlayerVehicleID(playerid)] < 70) FuelPrice = 350;
if(Fuel[GetPlayerVehicleID(playerid)] > 50 && Fuel[GetPlayerVehicleID(playerid)] < 60) FuelPrice = 300;
if(Fuel[GetPlayerVehicleID(playerid)] > 40 && Fuel[GetPlayerVehicleID(playerid)] < 50) FuelPrice = 250;
if(Fuel[GetPlayerVehicleID(playerid)] > 30 && Fuel[GetPlayerVehicleID(playerid)] < 40) FuelPrice = 200;
if(Fuel[GetPlayerVehicleID(playerid)] > 20 && Fuel[GetPlayerVehicleID(playerid)] < 30) FuelPrice = 150;
if(Fuel[GetPlayerVehicleID(playerid)] > 10 && Fuel[GetPlayerVehicleID(playerid)] < 20) FuelPrice = 100;
if(Fuel[GetPlayerVehicleID(playerid)] < 10) FuelPrice = 50;
if(GetPlayerMoney(playerid) < FuelPrice) return SendClientMessage(playerid, COLOR_KRED, \"You don\'t have enough money!\");
IsRefuelling[playerid] = true;
SetCameraBehindPlayer(playerid);
TogglePlayerControllable(playerid, 0);
GameTextForPlayer(playerid, \"Refuelling...\", 1000, 5);
SetTimerEx(\"RefuelVehicle\", 5000, 0, \"d\", playerid);
return 1;
}
public RefuelVehicle(playerid)
{
new string[128];
    Fuel[GetPlayerVehicleID(playerid)] = Fuel[GetPlayerVehicleID(playerid)] = 100;
    IsRefuelling[playerid] = false;
    GivePlayerMoney(playerid, -FuelPrice);
TogglePlayerControllable(playerid, 1);
    format(string, sizeof(string), \"Your vehicle is refuel! You paid $%d!\", FuelPrice);
    SendClientMessage(playerid, COLOR_YELLOW, string);
    FuelPrice = 0;
return 1;
}
public FuelLower()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
    if(!IsPlayerConnected(i)) continue;
        if(IsRefuelling) continue;
        if(GetPlayerVehicleSeat(i) == 0)
{
            Fuel[GetPlayerVehicleID(i)] = Fuel[GetPlayerVehicleID(i)] - 1;
            if(Fuel[GetPlayerVehicleID(i)] < 1)
            {
                Fuel[GetPlayerVehicleID(i)] = 0;
                RemovePlayerFromVehicle(i);
                GameTextForPlayer(i, \"~r~Vehicle is out of ~w~fuel~r~!\", 5000, 5);
            }
        }
        new string[128];
format(string, sizeof(string), \"%d\", Fuel[GetPlayerVehicleID(i)]);
        TextDrawSetString(sFuel, string);
}
return 1;
}
stock GetSpeed(playerid)
{
new Float: Pos[4];
    GetVehicleVelocity(GetPlayerVehicleID(playerid), Pos[0], Pos[1], Pos[2]);
    return floatround(1.61 * floatsqroot(floatabs(floatpower(Pos[0] + Pos[1] + Pos[2], 2))) * 100);
}

Nem elérhető instant

  • 2778
  • ZzzzzZ
    • Profil megtekintése
TextDraw áthelyezése
« Válasz #4 Dátum: 2012. május 13. - 11:58:51 »
0 Show voters
textdraw editor..

TextDraw áthelyezése
« Válasz #5 Dátum: 2012. május 13. - 16:42:50 »
0 Show voters

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal