06.10.2011, 08:24
ok so i am trying to make a a text draw that shows up when you get shot and it tells you how much dmg you took, so far i have this, it compiles and when you get shot it shows you what you lost but the text draws do not go away.
this is my first attempt at using a timer so if someone could point me in the right direction I would appreciate it!
this is my first attempt at using a timer so if someone could point me in the right direction I would appreciate it!
Код:
public OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost) { new msg[128],name1[24],name2[24], msg2[128]; dtxtdraw = TextDrawCreate(400.0,280.0, "~r~ -, health"); dtxtdraz = TextDrawCreate(450.0,280.0, "~b~ -, armour"); format(msg, sizeof(msg), "~r~ -%f, health", HealthLost); format(msg2, sizeof(msg2), "~b~ -%f, armour", ArmourLost); TextDrawSetString(dtxtdraw, msg); TextDrawSetString(dtxtdraz, msg2); TextDrawShowForPlayer(Target, dtxtdraw); TextDrawShowForPlayer(Target, dtxtdraz); timer1 = SetTimer("mytimer", 1000, false); GetPlayerName(Shooter,name1,24); GetPlayerName(Target,name2,24); CreateObject(1240, 0, 0, 0, 0.0, 0.0, 0.0, 0.0); AttachObjectToPlayer(1, Target, 0.0, 0.0, 1.0, 0, 0, 0); return 1; } public mytimer(playerid) { TextDrawHideForPlayer(playerid, dtxtdraw); TextDrawHideForPlayer(playerid, dtxtdraw); KillTimer(timer1); return 1; }