Advertisement
frog163

3d_Damage v1.1

Nov 22nd, 2012
131
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //GameWASD.ru © 2012
  2. //v1.0: happines
  3. //v1.1: frog163
  4. //Скрипт показывает урон в виде 3d текста над головой игрока
  5. //Видео: http://rutube.ru/video/2b73615e525b62d0114cd5d36be98e84/
  6. #include a_samp
  7.  
  8. #define max_steps_damage_txt                8//Кол-во "прыжков" HP
  9. #define start_Z_damage_txt              0.1//Стартовая Z координата
  10. #define factor_Z_damage_txt             0.05//Множитель координаты Z (увеличение Z с каждым "прыжком")
  11. #define factor_A_damage_txt             0x16//Alpha множетель
  12. #define color__damage_txt               0xFF450000//Цвет текста
  13.  
  14. new Text3D:txt_damage_id[MAX_PLAYERS][5];
  15. new bool: txt_damage_use[MAX_PLAYERS][5];
  16.  
  17. public OnPlayerConnect(playerid){
  18.     for(new f; f<5; ++f){
  19.         txt_damage_id[playerid][f] = Create3DTextLabel(" ", -1, 0.0, 0.0, 0.0, 20.0, -1, 1);
  20.         txt_damage_use[playerid][f] = false;
  21.     }
  22.     return true;
  23. }
  24. public OnPlayerDisconnect(playerid, reason){
  25.     for(new f; f<5; ++f)
  26.         Delete3DTextLabel(txt_damage_id[playerid][f]);
  27.     return true;
  28. }
  29. public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid){
  30.     Scroll3DPlayerLabel(playerid, amount, GetFreeDamageTxtID(playerid));
  31.     return true;
  32. }
  33.  
  34. GetFreeDamageTxtID(playerid){
  35.     for(new f; f<5; ++f)
  36.         if(!txt_damage_use[playerid][f]){
  37.             txt_damage_use[playerid][f] = true;
  38.             return f;
  39.         }
  40.     txt_damage_use[playerid][0] = true;
  41.     return false;
  42. }
  43. Scroll3DPlayerLabel(playerid, Float:dmg_point, slot_id)return _Scroll3DPlayerLabel(playerid, dmg_point, max_steps_damage_txt, slot_id);
  44. forward _Scroll3DPlayerLabel(playerid, Float:dmg_point, step_id, slot_id);
  45. public _Scroll3DPlayerLabel(playerid, Float:dmg_point, step_id, slot_id){
  46.     new str[16];
  47.     Attach3DTextLabelToPlayer(txt_damage_id[playerid][slot_id], playerid, 0.0, 0.0, factor_Z_damage_txt*(max_steps_damage_txt-step_id)+start_Z_damage_txt);
  48.     format(str, sizeof(str), "-%.0f HP", dmg_point);
  49.     Update3DTextLabelText(txt_damage_id[playerid][slot_id], 0xFF450000 | 0xff-(max_steps_damage_txt-step_id)*factor_A_damage_txt, str);
  50.     if(!step_id){
  51.         Update3DTextLabelText(txt_damage_id[playerid][slot_id], -1, " ");
  52.         txt_damage_use[playerid][slot_id] = false;
  53.     }else SetTimerEx("_Scroll3DPlayerLabel", 100, false, "ifii", playerid, dmg_point, --step_id, slot_id);
  54.     return true;
  55. }
Advertisement
RAW Paste Data Copied
Advertisement