Health Detection/Injury System
#7

Код:
//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;
}
This is the current code that I have, and I get these errors.
Quote:

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

If anybody can make this EXACTLY how I wanted it to be, with all the little systems, you will be repped.
The "OnPlayerTakeDamage" part works fine, ignore that, I'm concentrating on the Health Detection/Injury System.

Quote:

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))
Maybe add it to a strcmp command. The script that I use uses strcmp although I'd much prefer it ZCMD, anyways.

Reply


Messages In This Thread
Health Detection/Injury System - by xLucy - 10.04.2017, 10:22
Re: Health Detection/Injury System - by khRamin78 - 10.04.2017, 10:27
Re: Health Detection/Injury System - by Kane - 10.04.2017, 10:33
Re: Health Detection/Injury System - by xLucy - 10.04.2017, 10:35
Re: Health Detection/Injury System - by khRamin78 - 10.04.2017, 10:35
Re: Health Detection/Injury System - by xLucy - 10.04.2017, 10:37
Re: Health Detection/Injury System - by xLucy - 10.04.2017, 10:44
Re: Health Detection/Injury System - by Kane - 10.04.2017, 10:46
Re: Health Detection/Injury System - by Kane - 10.04.2017, 10:49
Re: Health Detection/Injury System - by xLucy - 10.04.2017, 10:51

Forum Jump:


Users browsing this thread: 1 Guest(s)