21.07.2013, 08:56
Код:
// Please keep credits.. PLEASE.. /* *\ | | * admantis * \ / */ #include <a_samp> #include <a_players> #define CYAN 0x00D2E1FF #define WHITE 0xFFFFFFAA #define PURPLE 0xC2A2DAAA #define AFTERLIFE_SECONDS 30 #define AUTODEATH_SECONDS 2400 // 40 Minutes #define SCM SendClientMessage #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 new Float:DeathPosX [MAX_PLAYERS]; new Float:DeathPosY [MAX_PLAYERS]; new Float:DeathPosZ [MAX_PLAYERS]; new IsDead [MAX_PLAYERS]; new SecsToGo [MAX_PLAYERS]; new IsAfterLifing [MAX_PLAYERS]; new AfterLifeTimer; forward AfterLife(playerid); forward AutoDeath(playerid); forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5); public OnPlayerSpawn(playerid) { IsAfterLifing[playerid] = 0; if (IsDead[playerid] == 1) { SetPlayerPos(playerid,DeathPosX[playerid],DeathPosY[playerid],DeathPosZ[playerid]); SetPlayerCameraPos(playerid,DeathPosX[playerid],DeathPosY[playerid],DeathPosZ[playerid]+5); SetPlayerCameraLookAt(playerid,DeathPosX[playerid],DeathPosY[playerid],DeathPosZ[playerid]); TogglePlayerControllable(playerid,false); ApplyAnimation(playerid,"PARACHUTE","FALL_skyDive_DIE", DeathPosX[playerid],DeathPosY[playerid],DeathPosZ[playerid]); SetTimerEx("AutoDeath",AUTODEATH_SECONDS * 1000,false,"i",playerid); SCM(playerid,CYAN,"------------------ Health Advise -----------------"); SCM(playerid,WHITE,"You are now laying death. You are bleeding to death."); SCM(playerid,WHITE,"Remember that the medics can revive you."); SCM(playerid,WHITE,"You can type /acceptdeath, if no medics are available."); SCM(playerid,CYAN,"--------------------------------------------------------"); return 1; } return 1; } public OnPlayerDeath(playerid, killerid, reason) { SetPlayerPos(playerid, 1177.4561,-1322.8708,14.0716,270.7953,0,0,0,0,0,0); // GivePlayerMoney(playerid,-600); new Float:pX, Float:pY, Float:pZ; GetPlayerPos(playerid, pX, pY, pZ); DeathPosX[playerid] = pX; DeathPosY[playerid] = pY; DeathPosZ[playerid] = pZ; IsDead[playerid] = 1; return 1; } public OnPlayerCommandText(playerid, cmdtext[]) { dcmd(acceptdeath, 11, cmdtext); return 0; } dcmd_acceptdeath(playerid, params[]) { #pragma unused params if (IsDead[playerid] == 0) { return 0; } else { IsDead[playerid] = 0; SecsToGo[playerid] = AFTERLIFE_SECONDS; CleanPlayerChat(playerid); SCM(playerid,CYAN,"------------------ -----------------"); SCM(playerid,WHITE,"You have been transfered to the hospital."); SCM(playerid,WHITE,"When you recover, you will lost memory of last 30 minutes."); SCM(playerid,WHITE,"((If you were non-RPly killed, report the player at the forums[e-rp.topicboard.net]))."); SCM(playerid,CYAN,"--------------------------------------------------------"); SetPlayerPos(playerid,0, 0, 0); SetPlayerCameraPos(playerid,DeathPosX[playerid],DeathPosY[playerid],DeathPosZ[playerid]); SetPlayerCameraLookAt(playerid,DeathPosX[playerid],DeathPosY[playerid],DeathPosZ[playerid]+100); AfterLifeTimer = SetTimerEx("AfterLife",1000,true,"i",playerid); return 1; } } public OnPlayerText(playerid, text[]) { if (IsAfterLifing[playerid] == 1) { return 0; } return 1; } public AfterLife(playerid) { IsAfterLifing[playerid] = 1; SecsToGo[playerid]--; new string[128]; format(string,sizeof(string),"~b~ ~h~ ~h~you have been transfered to the hospital~n~ ~b~ ~h~ ~h~ %d ",SecsToGo[playerid]); GameTextForPlayer(playerid,string,1100,3); if (SecsToGo[playerid] <= 0) { CleanPlayerChat(playerid); KillTimer(AfterLifeTimer); SCM(playerid,CYAN,"------------------ Health Advise -----------------"); SCM(playerid,WHITE,"You have been saved in the hospital.Tax fee: 600$"); SCM(playerid,WHITE,"The medics have threated you and now you are healthy."); SCM(playerid,WHITE,"((Remember, you have lost memory of recent 30 minutes.))"); SCM(playerid,CYAN,"--------------------------------------------------------"); SpawnPlayer(playerid); SetPlayerPos(playerid, 1174.2178,-1323.9169,14.9922,266.7001,0,0,0,0,0,0); GivePlayerMoney(playerid,-600); return 1; } return 1; } public AutoDeath(playerid) { if (IsDead[playerid] == 0) { return 0; } else if (IsDead[playerid] == 1) { new saystring[128], deathstring[128], name[28]; GetPlayerName(playerid,name,sizeof(name)); switch (random(2)) { case 0: { format(saystring,sizeof(saystring),"%s mumbles: I can't hold more..", name); format(deathstring,sizeof(deathstring),"* %s closes his eyes, falling into death.", name); } case 1: { format(saystring,sizeof(saystring),"%s mumbles: Aghh.. It's cold.. I feel something.. A light-..",name); format(deathstring,sizeof(deathstring),"* %s is now inmobilized, and dead.",name); } } ProxDetector(30, playerid, deathstring, PURPLE,PURPLE,PURPLE,PURPLE,PURPLE); ProxDetector(10, playerid, saystring, WHITE,WHITE,WHITE,WHITE,WHITE); IsDead[playerid] = 0; SecsToGo[playerid] = AFTERLIFE_SECONDS; SCM(playerid,CYAN,"------------------ Health Advise -----------------"); SCM(playerid,WHITE,"You are now in the hospital."); SCM(playerid,WHITE,"You will lose memory of last 30 minutes."); SCM(playerid,WHITE,"If you were non-RPly killed, report the player at the forums."); SCM(playerid,CYAN,"--------------------------------------------------------"); SetPlayerPos(playerid,0, 0, 0); SetPlayerCameraPos(playerid,DeathPosX[playerid],DeathPosY[playerid],DeathPosZ[playerid]); SetPlayerCameraLookAt(playerid,DeathPosX[playerid],DeathPosY[playerid],DeathPosZ[playerid]+100); AfterLifeTimer = SetTimerEx("AfterLife",1000,true,"i",playerid); return 1; } return 1; } public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5) { if(IsPlayerConnected(playerid)) { new Float:posx, Float:posy, Float:posz; new Float:oldposx, Float:oldposy, Float:oldposz; new Float:tempposx, Float:tempposy, Float:tempposz; GetPlayerPos(playerid, oldposx, oldposy, oldposz); for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i))) { GetPlayerPos(i, posx, posy, posz); tempposx = (oldposx -posx); tempposy = (oldposy -posy); tempposz = (oldposz -posz); if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16))) { SendClientMessage(i, col1, string); } else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8))) { SendClientMessage(i, col2, string); } else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4))) { SendClientMessage(i, col3, string); } else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2))) { SendClientMessage(i, col4, string); } else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi))) { SendClientMessage(i, col5, string); } } } } return 1; } stock CleanPlayerChat(playerid) { SCM(playerid,WHITE," "); SCM(playerid,WHITE," "); SCM(playerid,WHITE," "); SCM(playerid,WHITE," "); SCM(playerid,WHITE," "); SCM(playerid,WHITE," "); SCM(playerid,WHITE," "); SCM(playerid,WHITE," "); SCM(playerid,WHITE," "); SCM(playerid,WHITE," "); SCM(playerid,WHITE," "); SCM(playerid,WHITE," "); SCM(playerid,WHITE," "); SCM(playerid,WHITE," "); SCM(playerid,WHITE," "); SCM(playerid,WHITE," "); SCM(playerid,WHITE," "); }