Advertisement
Guest User

Untitled

a guest
Dec 31st, 2010
5,753
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 8.57 KB | None | 0 0
  1. // Please keep credits.. PLEASE..
  2.  
  3.                             /*                                   *\
  4.                             |                                     |
  5.                             *               admantis              *
  6.                             \                                    /
  7.  
  8.                            
  9. */
  10. #include                            <a_samp>
  11. #include                            <a_players>
  12.  
  13. #define CYAN                        0x00D2E1FF
  14. #define WHITE                       0xFFFFFFAA
  15. #define PURPLE                      0xC2A2DAAA
  16. #define AFTERLIFE_SECONDS           120 // 2 Minutes
  17. #define AUTODEATH_SECONDS           300 // 5 Minutes
  18. #define SCM                         SendClientMessage
  19. #define dcmd(%1,%2,%3)              if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
  20.  
  21. new Float:DeathPosX                 [MAX_PLAYERS];
  22. new Float:DeathPosY                 [MAX_PLAYERS];
  23. new Float:DeathPosZ                 [MAX_PLAYERS];
  24. new IsDead                          [MAX_PLAYERS];
  25. new SecsToGo                        [MAX_PLAYERS];
  26. new IsAfterLifing                   [MAX_PLAYERS];
  27. new AfterLifeTimer;
  28.  
  29. forward AfterLife(playerid);
  30. forward AutoDeath(playerid);
  31. forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
  32.  
  33. public OnPlayerSpawn(playerid)
  34. {
  35.     IsAfterLifing[playerid] = 0;
  36.     if (IsDead[playerid] == 1)
  37.     {
  38.         SetPlayerPos(playerid,DeathPosX[playerid],DeathPosY[playerid],DeathPosZ[playerid]);
  39.         SetPlayerCameraPos(playerid,DeathPosX[playerid],DeathPosY[playerid],DeathPosZ[playerid]+5);
  40.         SetPlayerCameraLookAt(playerid,DeathPosX[playerid],DeathPosY[playerid],DeathPosZ[playerid]);
  41.         TogglePlayerControllable(playerid,false);
  42.         ApplyAnimation(playerid,"PARACHUTE","FALL_skyDive_DIE", 4.0, 0, 0, 0, 1, 0);
  43.         SetTimerEx("AutoDeath",AUTODEATH_SECONDS * 1000,false,"i",playerid);
  44.         SCM(playerid,CYAN,"------------------ Health Advise -----------------");
  45.         SCM(playerid,WHITE,"You are now laying death. You are bleeding to death.");
  46.         SCM(playerid,WHITE,"Remember that the medics can revive you.");
  47.         SCM(playerid,WHITE,"You can type /acceptdeath, if no medics are available.");
  48.         SCM(playerid,CYAN,"--------------------------------------------------------");
  49.         return 1;
  50.     }
  51.     return 1;
  52. }
  53.        
  54. public OnPlayerDeath(playerid, killerid, reason)
  55. {
  56.     new Float:pX, Float:pY, Float:pZ;
  57.     GetPlayerPos(playerid, pX, pY, pZ);
  58.     DeathPosX[playerid] = pX;
  59.     DeathPosY[playerid] = pY;
  60.     DeathPosZ[playerid] = pZ;
  61.     IsDead[playerid] = 1;
  62.     return 1;
  63. }
  64.  
  65. public OnPlayerCommandText(playerid, cmdtext[])
  66. {
  67.     dcmd(acceptdeath, 11, cmdtext);
  68.     return 0;
  69. }
  70.  
  71. dcmd_acceptdeath(playerid, params[])
  72. {
  73.     #pragma unused params
  74.     if (IsDead[playerid] == 0) { return 0; }
  75.     else
  76.     {
  77.         IsDead[playerid] = 0;
  78.         SecsToGo[playerid] = AFTERLIFE_SECONDS;
  79.         CleanPlayerChat(playerid);
  80.         SCM(playerid,CYAN,"------------------ Health Advise -----------------");
  81.         SCM(playerid,WHITE,"You are now in the afterlife. You may rest in peace.");
  82.         SCM(playerid,WHITE,"When you revive, you will lost memory of last 30 minutes.");
  83.         SCM(playerid,WHITE,"If you were non-RPly killed, report the player at the forums.");
  84.         SCM(playerid,CYAN,"--------------------------------------------------------");
  85.         SetPlayerPos(playerid,0, 0, 0);
  86.         SetPlayerCameraPos(playerid,DeathPosX[playerid],DeathPosY[playerid],DeathPosZ[playerid]);
  87.         SetPlayerCameraLookAt(playerid,DeathPosX[playerid],DeathPosY[playerid],DeathPosZ[playerid]+100);
  88.         AfterLifeTimer = SetTimerEx("AfterLife",1000,true,"i",playerid);
  89.         return 1;
  90.      }
  91. }
  92.  
  93. public OnPlayerText(playerid, text[])
  94. {
  95.     if (IsAfterLifing[playerid] == 1) { return 0; }
  96.     return 1;
  97. }
  98.  
  99. public AfterLife(playerid)
  100. {
  101.     IsAfterLifing[playerid] = 1;
  102.     SecsToGo[playerid]--;
  103.     new string[128];
  104.     format(string,sizeof(string),"~b~ ~h~ ~h~you are in afterlife~n~ ~b~ ~h~ ~h~you will revive in %d seconds",SecsToGo[playerid]);
  105.     GameTextForPlayer(playerid,string,1100,3);
  106.     if (SecsToGo[playerid] <= 0)
  107.     {
  108.         CleanPlayerChat(playerid);
  109.         KillTimer(AfterLifeTimer);
  110.         SCM(playerid,CYAN,"------------------ Health Advise -----------------");
  111.         SCM(playerid,WHITE,"You have revived after a long rest.");
  112.         SCM(playerid,WHITE,"The medics have threated you and now you are healthy.");
  113.         SCM(playerid,WHITE,"Remember, you have lost memory of recent 30 minutes.");
  114.         SCM(playerid,CYAN,"--------------------------------------------------------");
  115.         SpawnPlayer(playerid);
  116.         return 1;
  117.     }
  118.     return 1;
  119. }
  120.  
  121. public AutoDeath(playerid)
  122. {
  123.     if (IsDead[playerid] == 0) { return 0; }
  124.     else if (IsDead[playerid] == 1)
  125.     {
  126.         new saystring[128], deathstring[128], name[28];
  127.         GetPlayerName(playerid,name,sizeof(name));
  128.         switch (random(2))
  129.         {
  130.             case 0:
  131.             {
  132.                 format(saystring,sizeof(saystring),"%s mumbles: I can't hold more..", name);
  133.                 format(deathstring,sizeof(deathstring),"* %s closes his eyes, falling into death.", name);
  134.             }
  135.             case 1:
  136.             {
  137.                 format(saystring,sizeof(saystring),"%s mumbles: Aghh.. It's cold.. I feel something.. A light-..",name);
  138.                 format(deathstring,sizeof(deathstring),"* %s is now inmobilized, and dead.",name);
  139.             }
  140.         }
  141.         ProxDetector(30, playerid, deathstring, PURPLE,PURPLE,PURPLE,PURPLE,PURPLE);
  142.         ProxDetector(10, playerid, saystring, WHITE,WHITE,WHITE,WHITE,WHITE);
  143.  
  144.         IsDead[playerid] = 0;
  145.         SecsToGo[playerid] = AFTERLIFE_SECONDS;
  146.         SCM(playerid,CYAN,"------------------ Health Advise -----------------");
  147.         SCM(playerid,WHITE,"You are now in the afterlife. You may rest in peace.");
  148.         SCM(playerid,WHITE,"When you revive, you will lost memory of last 30 minutes.");
  149.         SCM(playerid,WHITE,"If you were non-RPly killed, report the player at the forums.");
  150.         SCM(playerid,CYAN,"--------------------------------------------------------");
  151.         SetPlayerPos(playerid,0, 0, 0);
  152.         SetPlayerCameraPos(playerid,DeathPosX[playerid],DeathPosY[playerid],DeathPosZ[playerid]);
  153.         SetPlayerCameraLookAt(playerid,DeathPosX[playerid],DeathPosY[playerid],DeathPosZ[playerid]+100);
  154.         AfterLifeTimer = SetTimerEx("AfterLife",1000,true,"i",playerid);
  155.         return 1;
  156.     }
  157.     return 1;
  158. }
  159.                
  160.    
  161.    
  162.    
  163. public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
  164. {
  165.     if(IsPlayerConnected(playerid))
  166.     {
  167.         new Float:posx, Float:posy, Float:posz;
  168.         new Float:oldposx, Float:oldposy, Float:oldposz;
  169.         new Float:tempposx, Float:tempposy, Float:tempposz;
  170.         GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  171.         for(new i = 0; i < MAX_PLAYERS; i++)
  172.         {
  173.             if(IsPlayerConnected(i) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
  174.             {
  175.                 GetPlayerPos(i, posx, posy, posz);
  176.                 tempposx = (oldposx -posx);
  177.                 tempposy = (oldposy -posy);
  178.                 tempposz = (oldposz -posz);
  179.                 if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
  180.                 {
  181.                     SendClientMessage(i, col1, string);
  182.                 }
  183.                 else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
  184.                 {
  185.                     SendClientMessage(i, col2, string);
  186.                 }
  187.                 else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
  188.                 {
  189.                     SendClientMessage(i, col3, string);
  190.                 }
  191.                 else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
  192.                 {
  193.                     SendClientMessage(i, col4, string);
  194.                 }
  195.                 else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  196.                 {
  197.                     SendClientMessage(i, col5, string);
  198.                 }
  199.             }
  200.         }
  201.     }
  202.     return 1;
  203. }
  204.  
  205. stock CleanPlayerChat(playerid)
  206. {
  207.     SCM(playerid,WHITE," ");
  208.     SCM(playerid,WHITE," ");
  209.     SCM(playerid,WHITE," ");
  210.     SCM(playerid,WHITE," ");
  211.     SCM(playerid,WHITE," ");
  212.     SCM(playerid,WHITE," ");
  213.     SCM(playerid,WHITE," ");
  214.     SCM(playerid,WHITE," ");
  215.     SCM(playerid,WHITE," ");
  216.     SCM(playerid,WHITE," ");
  217.     SCM(playerid,WHITE," ");
  218.     SCM(playerid,WHITE," ");
  219.     SCM(playerid,WHITE," ");
  220.     SCM(playerid,WHITE," ");
  221.     SCM(playerid,WHITE," ");
  222.     SCM(playerid,WHITE," ");
  223.     SCM(playerid,WHITE," ");
  224. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement