Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Unique Deathscript by Saint */
- #define FILTERSCRIPT
- #include <a_samp>
- #if defined FILTERSCRIPT
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Cool Death Script by Saint - Loaded");
- print("--------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- #endif
- //DeathScript
- new PlayerIsDead[MAX_PLAYERS];
- new World[MAX_PLAYERS];
- new Interior[MAX_PLAYERS];
- new Float:deadpos[3];
- new DeadSkin[MAX_PLAYERS];
- new Fell[MAX_PLAYERS];
- new Text3D:injuredlabel[MAX_PLAYERS];
- new IsFinishedTimer[MAX_PLAYERS];
- new DeathTimerTimer[MAX_PLAYERS];
- PreloadAnimLib(playerid, animlib[])
- {
- ApplyAnimation(playerid,animlib,"null",0.0,0,0,0,0,0);
- }
- bool:HasAnimationApplied(playerid, animlib[], animname[])
- {
- new l_animlib[32];
- new l_animname[32];
- GetAnimationName(GetPlayerAnimationIndex(playerid),l_animlib,32,l_animname,32);
- if (strcmp(animlib, l_animlib, true) == 0 && strcmp(animname, l_animname, true) == 0)
- return true;
- return false;
- }
- public OnPlayerConnect(playerid)
- {
- Delete3DTextLabel(injuredlabel[playerid]);
- Fell[playerid] = 0;
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- Delete3DTextLabel(injuredlabel[playerid]);
- Fell[playerid] = 0;
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- Fell[playerid] = 0;
- PreloadAnimLib(playerid,"WUZI" );
- if(PlayerIsDead[playerid] == 1)
- {
- SetPlayerPos(playerid, deadpos[0], deadpos[1], deadpos[2]);
- SetPlayerVirtualWorld(playerid, World[playerid]);
- SetPlayerInterior(playerid, Interior[playerid]);
- SetPlayerSkin(playerid, DeadSkin[playerid]);
- ClearAnimations(playerid);
- SetTimerEx("DeathTimer", 1000, 0, "i", playerid);
- }
- return 1;
- }
- public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
- {
- new Float:hp;
- GetPlayerHealth(playerid, hp);
- if(hp - amount < 35 && Fell[playerid] == 0)
- {
- DeathScript(playerid);
- }
- if(hp - amount < 36 && PlayerIsDead[playerid] == 1)
- {
- ClearAnimations(playerid);
- Delete3DTextLabel(injuredlabel[playerid]);
- DeathScript(playerid);
- }
- if(hp - amount < 69 && Fell[playerid] == 1 && HasAnimationApplied(playerid, "WUZI", "CS_Dead_Guy"))
- {
- SetPlayerHealth(playerid, 99);
- Fell[playerid] = 1;
- TogglePlayerControllable(playerid, 0);
- SendClientMessage(playerid, 0xFF6347FF, "SERVER: You are now dead.");
- Update3DTextLabelText(injuredlabel[playerid], 0xFF6347FF, "(( DEAD PLAYER ))");
- }
- if(hp - amount < 95 && Fell[playerid] == 1)
- {
- SetPlayerHealth(playerid, 99);
- ClearAnimations(playerid);
- ApplyAnimation(playerid, "WUZI", "CS_Dead_Guy", 4.1, 0, 0, 0, 300000, 0);
- ApplyAnimation(playerid, "WUZI", "CS_Dead_Guy", 4.1, 0, 0, 0, 300000, 0);
- }
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- GetPlayerPos(playerid, deadpos[0], deadpos[1], deadpos[2]);
- World[playerid] = GetPlayerVirtualWorld(playerid);
- Interior[playerid] = GetPlayerInterior(playerid);
- DeadSkin[playerid] = GetPlayerSkin(playerid);
- PlayerIsDead[playerid] = 1;
- Fell[playerid] = 0;
- Delete3DTextLabel(injuredlabel[playerid]);
- return 1;
- }
- forward DeathScript(playerid);
- public DeathScript(playerid)
- {
- ClearAnimations(playerid);
- new string[128];
- SetTimerEx("IsFinished", 250, false, "i", playerid);
- for( new i = 0; i <= 100; i ++ ) SendClientMessage(playerid, 0xFFFFFFFF, "");
- SetPlayerHealth(playerid, 70);
- ResetPlayerWeapons(playerid);
- format(string, sizeof(string), "(( INJURED PLAYER ))", playerid);
- injuredlabel[playerid] = Create3DTextLabel(string, 0xFF6347FF, 0.0, 0.0, 0.0, 15.0, 0);
- Attach3DTextLabelToPlayer(injuredlabel[playerid], playerid, 0.0, 0.0, 0.7);
- ApplyAnimation(playerid, "WUZI", "CS_Dead_Guy", 4.1, 0, 0, 0, 300000, 0);
- ApplyAnimation(playerid, "WUZI", "CS_Dead_Guy", 4.1, 0, 0, 0, 300000, 0);
- SendClientMessage(playerid, 0xFF6347FF, "SERVER: You are currently injured.");
- }
- forward DeathTimer(playerid);
- public DeathTimer(playerid)
- {
- DeathScript(playerid);
- KillTimer(DeathTimerTimer[playerid]);
- }
- forward IsFinished(playerid);
- public IsFinished(playerid)
- {
- Fell[playerid] = 1;
- KillTimer(IsFinishedTimer[playerid]);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement