Author Topic: Drawtext won't draw?  (Read 897 times)

0 Members and 1 Guest are viewing this topic.

Offline Mercury92

  • Camper
  • ***
  • Posts: 284
Drawtext won't draw?
« on: April 13, 2008, 09:15:57 am »
Code: [Select]
var
FirstBlood: string;

procedure OnMapChange(NewMap: string);
begin
FirstBlood := '0';
end;

procedure OnPlayerKill(Killer, Victim: byte; Weapon: string);
begin
if (FirstBlood = '0') then begin
if (Killer <> Victim) then begin
FirstBlood := '1';
WriteConsole(0,'FIRSTBLOOD! '+IDToName(Victim)+' killed by '+IDToName(Killer),$FF3520);
WriteConsole(0,IDToName(Killer)+' gained +4 extra point !!',$FF3520);
SetScore(Killer,GetPlayerStat(Killer,'KILLS')+4);
DrawText(0,'FIRST BLOOD !',250,RGB(255,0,0),0.27,6,370);
end;
end;
end;



And it doesn't draw text DrawText(0,'FIRST BLOOD !',250,RGB(255,0,0),0.27,6,370);
[saw]  on 1.5.1

Offline Boblekonvolutt

  • Soldier
  • **
  • Posts: 222
  • "YOU are a CAR."
Re: Drawtext won't draw?
« Reply #1 on: April 13, 2008, 09:33:29 am »
Well, first of all the color you've picked for the WriteConsole's wont work. As for the DrawText part, wouldn't it get blocked by the "You've killed..." (for the killer)? You should test it by having two bots kill eachother or something. It looks like it should work, so it probably will.

Also, you should use boolean instead of string for the FirstBlood var.

Offline Mercury92

  • Camper
  • ***
  • Posts: 284
Re: Drawtext won't draw?
« Reply #2 on: April 13, 2008, 09:49:29 am »
Yeah thanks. Boolean; helped a lot. But what's with first part: WriteConsole is working for me. Or does this color shows only to me?

WRONG...
It doesn't work.
Code: [Select]
var
FirstBlood: boolean;

procedure OnMapChange(NewMap: string);
begin
FirstBlood := true;
end;

procedure OnPlayerKill(Killer, Victim: byte; Weapon: string);
begin

if FirstBlood then begin
if (Killer <> Victim) then begin
FirstBlood := false;
WriteConsole(0,'FIRSTBLOOD! '+IDToName(Victim)+' killed by '+IDToName(Killer),$FF3520);
WriteConsole(0,IDToName(Killer)+' gained +4 extra point !!',$FF3520);
SetScore(Killer,GetPlayerStat(Killer,'KILLS')+4);
DrawText(0,'FIRST BLOOD !',250,RGB(255,0,0),0.27,6,370);
end;
end;
end;


Doesn't DrawText.
« Last Edit: April 13, 2008, 09:52:20 am by Mercury92 »
[saw]  on 1.5.1

Offline danmer

  • Camper
  • ***
  • Posts: 466
  • crabhead
Re: Drawtext won't draw?
« Reply #3 on: April 13, 2008, 02:22:50 pm »
it is indeed overdrawn by the kill messages. You will need to drawtext in apponidle (after a slight interval), or think about a different way

Offline chutem

  • Veteran
  • *****
  • Posts: 1119
Re: Drawtext won't draw?
« Reply #4 on: April 18, 2008, 10:17:11 pm »
What do you mean by overdrawn, the part not working is after the kill messages...
1NK3FbdNtH6jNH4dc1fzuvd4ruVdMQABvs

Offline UPNPAD

  • Major(1)
  • Posts: 36
Re: Drawtext won't draw?
« Reply #5 on: April 18, 2008, 10:24:38 pm »
There can only be one DrawText message on your screen at any time, the messages include 'You killed ***' 'Killed by ***' 'Predator' and any messages you draw through your script.

Offline danmer

  • Camper
  • ***
  • Posts: 466
  • crabhead
Re: Drawtext won't draw?
« Reply #6 on: April 20, 2008, 11:17:37 am »
What do you mean by overdrawn, the part not working is after the kill messages...
OnPlayerKill is called before the "You kiled *" message is drawn, so no matter what you put in OnPLayerKill , the "You killed *" and "Killed by *" message will always overdraw what you drew (in simpler words, those messages will erase your text <.< )

Any more questions?