• 02 Mai 2025, 20:45:55


Auteur Sujet: [RESOLU]Problème textdraw  (Lu 1454 fois)

0 Membres et 1 Invité sur ce sujet

Hors ligne °D@vid°

  • *
  • Tueur
  • Messages: 57
    • Voir le profil
[RESOLU]Problème textdraw
« le: 09 Juillet 2009, 23:20:40 »
Bonjour j'ai un problème avec deux textdraw j'en ai mis un pour le nombre d'euros que le joueur possède et l'autre pour un speedo mais le probleme quand il sont mis tous les deux l'euros et le speedo sont les uns sur les autres et il clignote comment faire pour éviter cela merci d'avance
« Modifié: 10 Juillet 2009, 15:00:55 par °D@vid° »

Hors ligne DeVilZ

  • *
  • Tueur
  • Messages: 53
    • Voir le profil
Re : Problème textdraw
« Réponse #1 le: 09 Juillet 2009, 23:29:51 »
Change de place un des deux TextDrax  :blink



Mes Créations :
[/b]

Hors ligne S!m

  • *
  • Messages: 2341
    • Voir le profil
Re : Problème textdraw
« Réponse #2 le: 10 Juillet 2009, 01:04:19 »
Salut,

le problème de clignotement c'est simplement un problème avec la fonction TextDrawDestroy qui ne supprime pas toujours ce que l'on veut, tente d'éviter son usage en cours de jeu...
si tu ne doit que changer le texte du TextDraw utilise plutôt TextDrawSetString

++Sim++





Hors ligne °D@vid°

  • *
  • Tueur
  • Messages: 57
    • Voir le profil
Re : Problème textdraw
« Réponse #3 le: 10 Juillet 2009, 11:21:05 »
Merci de ton aide mais je ne vois pas comment changer se script en TextdrawSetString pouvez-vous m'aider ?

//-----0000----0----0--------00000---------0-------000000-----------------------
//-----0---0----0--0---------0----0-------0-0------0----------------------------
//-----0000------0-----------00000-------0---0-----00000------------------------
//-----0---0----0------------0-00-------0000000----0----------------------------
//-----0000----0-------------0---00----0-------0---0-----------------by R@f ©---
#include <a_samp>

#define SLOTS 200

enum SavePlayerPosEnum {
Float:LastX,
Float:LastY,
Float:LastZ
}

new SavePlayerPos[SLOTS][SavePlayerPosEnum];
new Text:Speedo[SLOTS];
new UpdateSeconds;

new CarName[][] =
{
    "Landstalker", "Bravura", "Buffalo", "Linerunner", "Perrenial", "Sentinel",
"Dumper", "Firetruck", "Trashmaster", "Stretch", "Manana", "Infernus",
"Voodoo", "Pony", "Mule", "Cheetah", "Ambulance", "Leviathan", "Moonbeam",
    "Esperanto", "Taxi", "Washington", "Bobcat", "Whoopee", "BF Injection",
"Hunter", "Premier", "Enforcer", "Securicar", "Banshee", "Predator", "Bus",
"Rhino", "Barracks", "Hotknife", "Trailer", "Previon", "Coach", "Cabbie",
"Stallion", "Rumpo", "RC Bandit", "Romero", "Packer", "Monster", "Admiral",
"Squalo", "Seasparrow", "Pizzaboy", "Tram", "Trailer", "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", "Boxvillde", "Benson", "Mesa", "RC Goblin",
"Hotring Racer A", "Hotring Racer B", "Bloodring Banger", "Rancher", "Super GT",
"Elegant", "Journey", "Bike", "Mountain Bike", "Beagle", "Cropduster", "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", "Hustler", "Intruder", "Primo",
"Cargobob", "Tampa", "Sunrise", "Merit", "Utility", "Nevada", "Yosemite",
"Windsor", "Monster", "Monster", "Uranus", "Jester", "Sultan", "Stratium",
"Elegy", "Raindance", "RC Tiger", "Flash", "Tahoma", "Savanna", "Bandito",
    "Freight Flat", "Streak Carriage", "Kart", "Mower", "Dune", "Sweeper",
"Broadway", "Tornado", "AT-400", "DFT-30", "Huntley", "Stafford", "BF-400",
"News Van", "Tug", "Trailer", "Emperor", "Wayfarer", "Euros", "Hotdog", "Club",
"Freight Box", "Trailer", "Andromada", "Dodo", "RC Cam", "Launch", "Police Car",
  "Police Car", "Police Car", "Police Ranger", "Picador", "S.W.A.T", "Alpha",
  "Phoenix", "Glendale", "Sadler", "Luggage", "Luggage", "Stairs", "Boxville",
  "Tiller", "Utility Trailer"
};

forward UpdateSpeed();

public OnFilterScriptInit()
{
print("\n--------------------------------------");
print("----------R@f's speedo script---------");
print("--------------------------------------\n");
SetTimer("UpdateSpeed",1000, 1);
return 1;
}

public OnFilterScriptExit()
{
return 1;
}

main()
{
}

public OnPlayerConnect(playerid)
{
SendClientMessage(playerid,0x00FF00FF,"This server is running whit R@f's Speedo FilterScript");
return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_ONFOOT)
{
    TextDrawHideForPlayer(playerid, Speedo[playerid]);
}
return 1;
}

public UpdateSpeed()
{
new Float:x,Float:y,Float:z;
new Float:distance,value,string[256];
new Float:health;
for(new i=0; i<SLOTS; i++)
{
if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i))
{
TextDrawDestroy(Speedo[i]);
}
}

for(new i=0; i<SLOTS; i++)
{
if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i))
{
GetPlayerPos(i, x, y, z);
GetVehicleHealth(GetPlayerVehicleID(i), health);
distance = floatsqroot(floatpower(floatabs(floatsub(x,SavePlayerPos[i][LastX])),2)+floatpower(floatabs(floatsub(y,SavePlayerPos[i][LastY])),2)+floatpower(floatabs(floatsub(z,SavePlayerPos[i][LastZ])),2));
value = floatround(distance * 5000);
if(UpdateSeconds > 1)
{
value = floatround(value / UpdateSeconds);
}
format(string,sizeof(string),"~g~Vehicle : ~w~%s ~n~~b~MPH : ~w~%d / ~b~KM/H : ~w~%d~n~~y~Altitude:~w~ %.1f ~n~~r~Vehicle Health:~w~ %.2f",CarName[GetVehicleModel(GetPlayerVehicleID(i))-400],floatround(value/1600),floatround(value/1000),z,health);
Speedo[i] = TextDrawCreate(320.00, 380.00, string);
TextDrawSetOutline(Speedo[i], 0);
TextDrawFont(Speedo[i], 3);
TextDrawSetProportional(Speedo[i], 2);
TextDrawAlignment(Speedo[i], 2);
TextDrawShowForPlayer (i, Speedo[i]);
}
SavePlayerPos[i][LastX] = x;
SavePlayerPos[i][LastY] = y;
SavePlayerPos[i][LastZ] = z;
}
}
« Modifié: 10 Juillet 2009, 11:37:41 par °D@vid° »

Hors ligne cristab

  • *
  • Messages: 8379
    • Voir le profil
Re : Problème textdraw
« Réponse #4 le: 10 Juillet 2009, 11:27:00 »
il l'utilise deja
pas d'aide en PM, vous êtes sur un forum est il me semble que vous êtes la pour avoir de l'aide donc pourquoi MP une seul personne qui ne vous répondra pas alors qu'il y a plein de membre ici

Hors ligne °D@vid°

  • *
  • Tueur
  • Messages: 57
    • Voir le profil
Re : Problème textdraw
« Réponse #5 le: 10 Juillet 2009, 11:37:11 »
non

Hors ligne S!m

  • *
  • Messages: 2341
    • Voir le profil
Re : [RESOLU]Problème textdraw
« Réponse #6 le: 11 Juillet 2009, 16:17:21 »
Salut,

alors la façon la plus simple que je connaisse consiste a créer le textdraw speedo du joueur à sa connexion et de le paramétré (TextDrawAlignment, TextDrawColor, TextDrawUseBox....) immédiatemment

ensuite tu l'affiche ou cache au joueur lors de son changement d'un statut concernant PLAYER_STATE_DRIVER et PLAYER_STATE_PASSENGER puis tu ne fais que refaire le texte du speedo dans le timer, c'est ici que tu n'as plus besoin que du TextDrawSetString (+ un format bien sûr)


++Sim++