new Float: playersHealth; GetPlayerHealth(playerid, playersHealth); if(playersHealth = 10) { SendClientMessage(playerid, -1, "You are critically injured. You may /acceptdeath or wait for a medic to revive you."); LoopingAnim(playerid,"SWEET","Sweet_injuredloop", 4.0, 1, 0, 0, 0, 0); }
if(!(PlayerInfo[playerid][pMember] >= 7 && PlayerInfo[playerid][pMember] <= 8))
new Injured[MAX_PLAYERS];
public OnPlayerUpdate(playerid) { new Float: playersHealth; GetPlayerHealth(playerid, playersHealth); if(playersHealth <= 10) { SendClientMessage(playerid, -1, "You are critically injured. You may /acceptdeath or wait for a medic to revive you."); LoopingAnim(playerid,"SWEET","Sweet_injuredloop", 4.0, 1, 0, 0, 0, 0); Injured[playerid] = 1; } }
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid, bodypart) { if(Injured[damagedid] == 1) { SetPlayerChatBubble(damagedid, (( THIS PLAYER IS DEAD )), RED, 100.0, 4343344); //or just make a 3d text } }
you can use them at OnPlayerUpdate ! it will help you
OnPlayerUpdate and for your Text you can use <<Create3DTextLabel>> and if you loop animation he cant get out of that ! also you will need end loop at some point and you can easly use TogglePlayerControllable or ApplyAnimation which automatcly has a fet to loop animation if you want the exact code tell ill make it for you |
Here's what you could do, I have a similar system in my script.
Код:
new Injured[MAX_PLAYERS]; Код:
public OnPlayerUpdate(playerid) { new Float: playersHealth; GetPlayerHealth(playerid, playersHealth); if(playersHealth <= 10) { SendClientMessage(playerid, -1, "You are critically injured. You may /acceptdeath or wait for a medic to revive you."); LoopingAnim(playerid,"SWEET","Sweet_injuredloop", 4.0, 1, 0, 0, 0, 0); Injured[playerid] = 1; } Код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid, bodypart) { if(Injured[damagedid] == 1) { SetPlayerChatBubble(damagedid, (( THIS PLAYER IS DEAD )), RED, 100.0, 4343344); } } |
Injured[playerid] = 1; |
//Vortex Gaming Realistic Damage Script. //Credits go to: Arthur Kane and khRamin78 from SA-MP Forums. #define FILTERSCRIPT //---Includes---// #include <a_samp> #include <streamer> //--------------// //----Defines----// #define WEAPON_BODY_PART_CHEST 3 #define WEAPON_BODY_PART_CROTCH 4 #define WEAPON_BODY_PART_LEFT_ARM 5 #define WEAPON_BODY_PART_RIGHT_ARM 6 #define WEAPON_BODY_PART_LEFT_LEG 7 #define WEAPON_BODY_PART_RIGHT_LEG 8 #define WEAPON_BODY_PART_HEAD 9 //---------------// new Injured[MAX_PLAYERS]; public OnFilterScriptInit() { print("\n--------------------------------------"); print("VORTEX GAMING REALISTIC DAMAGE SYSTEM LOADED"); print("--------------------------------------\n"); return 1; } public OnFilterScriptExit() { print("\n--------------------------------------"); print("VORTEX GAMING REALISTIC DAMAGE SYSTEM UNLOADED"); print("--------------------------------------\n"); return 1; } public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid) { new Float:HP; new Float:Armour; if(!IsPlayerConnected(playerid)) return 0; if(!IsPlayerConnected(issuerid)) return 0; GetPlayerHealth(playerid, HP); GetPlayerArmour(playerid, Armour); if(weaponid == 24) SetPlayerHealth(playerid, HP-50);//DesertEagle Deducts HP if(weaponid == 24) SetPlayerArmour(playerid, Armour-50);//DesertEagle Deducts Armour/Kevlar if(weaponid == 22) SetPlayerHealth(playerid, HP-50);//Colt45 Deducts HP if(weaponid == 22) SetPlayerArmour(playerid, Armour-50);//Colt45 Deducts Armour/Kevlar if(weaponid == 32) SetPlayerHealth(playerid, HP-10);//Tec9 Dedcuts HP if(weaponid == 32) SetPlayerArmour(playerid, Armour-10);//Tec9 Deducts Armour/Kevlar if(weaponid == 28) SetPlayerHealth(playerid, HP-10);//Uzi Deducts HP if(weaponid == 28) SetPlayerArmour(playerid, Armour-10);//Uzi Deducts Armour/Kevlar if(weaponid == 23) SetPlayerHealth(playerid, HP-50);//Silenced Colt if(weaponid == 23) SetPlayerArmour(playerid, Armour-50);//Silenced Colt if(weaponid == 31) SetPlayerHealth(playerid, HP-35);//M4 if(weaponid == 31) SetPlayerArmour(playerid, Armour-35);//M4 if(weaponid == 30) SetPlayerHealth(playerid, HP-40);//AK if(weaponid == 30) SetPlayerArmour(playerid, Armour-40);//AK if(weaponid == 29) SetPlayerHealth(playerid, HP-18);//MP5 if(weaponid == 29) SetPlayerArmour(playerid, Armour-18);//MP5 if(weaponid == 34) SetPlayerHealth(playerid, HP-300);//SniperRifle if(weaponid == 34) SetPlayerArmour(playerid, Armour-300);//SniperRifle if(weaponid == 33) SetPlayerHealth(playerid, HP-35);//Country Rifle if(weaponid == 33) SetPlayerArmour(playerid, Armour-35);//Country Rifle if(weaponid == 25) SetPlayerArmour(playerid, Armour-100);//12 Guage Pump Action Remington Shotgun if(weaponid == 25) SetPlayerHealth(playerid, HP-100);//12 Guage Pump Action Remington Shotgun if(weaponid == 27) SetPlayerArmour(playerid, Armour-70);//SPAZ-12 if(weaponid == 27) SetPlayerHealth(playerid, HP-70);//SPAZ-12 return 1; } public OnPlayerUpdate(playerid) { new Float: playersHealth; GetPlayerHealth(playerid, playersHealth); if(playersHealth <= 10 && playersHealth= 0) { SendClientMessage(playerid, -1, "You are critically injured. You may /acceptdeath or wait for a medic to ressussatate you."); PlayAnimation(playerid,"SWEET","Sweet_injuredloop", 4.0, 1, 0, 0, 0, 0); Injured[playerid] = 1; } } public OnPlayerGiveDamage(playerid, issuerid, Float: amount, weaponid, bodypart) { if(!IsPlayerConnected(playerid)) return 0; if(!IsPlayerConnected(issuerid)) return 0; if(issuerid != INVALID_PLAYER_ID && bodypart == 9 ) { SetPlayerHealth(playerid, 10.0); SetPlayerArmour(playerid, 0.0); } if(Injured[damagedid] == 1) { SetPlayerChatBubble(damagedid, (( THIS PLAYER IS INJURED )), RED, 100.0, 4343344); //or just make a 3d text } return 1; }
C:\Users\Lex-PC\Desktop\CGRP\filterscripts\DamageInjurySystem.p wn(77) : warning 211: possibly unintended assignment C:\Users\Lex-PC\Desktop\CGRP\filterscripts\DamageInjurySystem.p wn(77) : error 022: must be lvalue (non-constant) C:\Users\Lex-PC\Desktop\CGRP\filterscripts\DamageInjurySystem.p wn(77) : warning 215: expression has no effect C:\Users\Lex-PC\Desktop\CGRP\filterscripts\DamageInjurySystem.p wn(77) : error 001: expected token: ";", but found ")" C:\Users\Lex-PC\Desktop\CGRP\filterscripts\DamageInjurySystem.p wn(77) : error 029: invalid expression, assumed zero C:\Users\Lex-PC\Desktop\CGRP\filterscripts\DamageInjurySystem.p wn(77) : fatal error 107: too many error messages on one line |
Now, I understand the code and all, BUT. I'm not sure whether to insert it into OnPlayerTakeDamage or OnPlayerGiveDamage. I would think that it goes into GiveDamage, but anyway. I still need the text displaying above and the animation. Also, you won't be able to get out of this animation until your health is 0. Talking about a medic reviving you, here's the stock that I have for it. Код:
if(!(PlayerInfo[playerid][pMember] >= 7 && PlayerInfo[playerid][pMember] <= 8)) |
enum PlayerStatistics { IsDead, Dead, }
public OnPlayerDeath(playerid, killerid, reason) { new Float:x, Float:y, Float:z; GetPlayerPos(playerid, x, y, z); Player[playerid][LastWorld] = GetPlayerVirtualWorld(playerid); Player[playerid][LastInterior] = GetPlayerInterior(playerid); Player[playerid][LastX] = x; //saves players position for spawning Player[playerid][LastY] = y; Player[playerid][LastZ] = z; Player[playerid][IsDead] = 1; }
public OnPlayerSpawn(playerid) { if(Player[playerid][IsDead] == 1) { SetPlayerPos(playerid, Player[playerid][LastX], Player[playerid][LastY], Player[playerid][LastZ]); SetPlayerCameraPos(playerid, Player[playerid][LastX], Player[playerid][LastY], Player[playerid][LastZ]); SetPlayerInterior(playerid, Player[playerid][LastInterior]); SetPlayerVirtualWorld(playerid, Player[playerid][LastWorld]); format(string, sizeof(string), "(( Has been brutally wounded, /damages %d for more info. ))", playerid); SetPlayerChatBubble(playerid, string, ADM, 30.0, 600000); // bunch of other shit, anims & etc } }
public OnPlayerUpdate(playerid) { if(Player[playerid][IsDead] == 1) { ApplyAnimation(playerid, // ur anim } }
public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid, bodypart) { if(Player[damagedid][IsDead] == 1) { TogglePlayerControllable(damagedid, false); Player[damagedid][IsDead] = 0; Player[damagedid][Dead] = 1; SetPlayerChatBubble(damagedid, "(( PLAYER IS DEAD ))", ADM, 30.0, 1220001); } }
C:\Users\Lex-PC\Desktop\CGRP\filterscripts\DamageInjurySystem.p wn(77) : warning 211: possibly unintended assignment C:\Users\Lex-PC\Desktop\CGRP\filterscripts\DamageInjurySystem.p wn(77) : error 022: must be lvalue (non-constant) C:\Users\Lex-PC\Desktop\CGRP\filterscripts\DamageInjurySystem.p wn(77) : warning 215: expression has no effect C:\Users\Lex-PC\Desktop\CGRP\filterscripts\DamageInjurySystem.p wn(77) : error 001: expected token: ";", but found ")" C:\Users\Lex-PC\Desktop\CGRP\filterscripts\DamageInjurySystem.p wn(77) : error 029: invalid expression, assumed zero C:\Users\Lex-PC\Desktop\CGRP\filterscripts\DamageInjurySystem.p wn(77) : fatal error 107: too many error messages on one line |