public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart) { new Float:armour; GetPlayerArmour(playerid,armour); new Float:hpplayer; GetPlayerHealth(playerid,hpplayer); if(armour>0) { if(bodypart==9) { new Float:hpamount,Float:amamount,Float:sethp,Float:setam; amamount=(amount/100)*25; hpamount=(amount/100)*75; sethp=hpplayer-hpamount; setam=armour-amamount; SetPlayerArmour(playerid,setam); SetPlayerHealth(playerid,sethp); } if(bodypart==3 || bodypart==4) { new Float:hpamount,Float:amamount,Float:sethp,Float:setam; amamount=(amount/100)*50; hpamount=(amount/100)*50; sethp=hpplayer-hpamount; setam=armour-amamount; SetPlayerArmour(playerid,setam); SetPlayerHealth(playerid,sethp); } if(bodypart==5 || bodypart==6 || bodypart==7 || bodypart==8) { new Float:sethp; sethp=hpplayer-((amount/4)*3); SetPlayerHealth(playerid,sethp); } } else { if(bodypart==9) { new Float:sethp; sethp=hpplayer-(((amount/4)*3)+amount); SetPlayerHealth(playerid,sethp); } if(bodypart==3 || bodypart==4) { new Float:sethp; sethp=hpplayer-((amount/4)+amount); SetPlayerHealth(playerid,sethp); } if(bodypart==5 || bodypart==6 || bodypart==7 || bodypart==8) { new Float:sethp; sethp=hpplayer-((amount/4)*3); SetPlayerHealth(playerid,sethp); } } return 1; }
SetPlayerHealth (playerid, sethp); |
but then both a colt45 and a sniper would hit same damage. thats why game already defines a variable called amount.. i really feel stupid this should have work.
|
SetPlayerHealth(playerid,hpplayer-damagedealth);
{ switch(weaponid) { case 22,23: { switch(bodypart) { case 3,4: damage = 45.0; case 5..8: damage = 20.0; case 9: damage = 200.0; } } case 24: { switch(bodypart) { case 3,4: damage = 70.0; case 5..8: damage = 35.0; case 9: damage = 200.0; } } case 25..27: { switch(bodypart) { case 3,4: damage = 90.0; case 5..8: damage = 50.0; case 9: damage = 200.0; } } case 28,32: { switch(bodypart) { case 3,4: damage = 45.0; case 5..8: damage = 20.0; case 9: damage = 200.0; } } case 29: { switch(bodypart) { case 3,4: damage = 55.0; case 5..8: damage = 30.0; case 9: damage = 200.0; } } case 30: { switch(bodypart) { case 3,4: damage = 65.0; case 5..8: damage = 40.0; case 9: damage = 200.0; } } case 31: { switch(bodypart) { case 3,4: damage = 60.0; case 5..8: damage = 35.0; case 9: damage = 200.0; } } case 33: { switch(bodypart) { case 3,4: damage = 80.0; case 5..8: damage = 40.0; case 9: damage= 200.0; } } case 34: { switch(bodypart) { case 3,4: damage = 100.0; case 5..8: damage = 60.0; case 9: damage = 200.0; } } default: danio = amount; } format(string, sizeof(string), "damage you received per shot: %f", damage); SendClientMessage(-1, playerid, string); format(string, sizeof(string), "Damage you've taken with the shot: %f", damage); SendClientMessage(-1, issuerid, string); FadePlayerScreen(playerid, 0xE20000FF, 25); } }
#include <a_samp>
#include <fader>
#include <foreach>
#include <sscanf2>
#include <zcmd>
new Fuerza[MAX_PLAYERS];
public OnFilterScriptInit()
{
foreach(new i: Player)
{
SetPlayerTeam(i, 1);
}
return 1;
}
public OnFilterScriptExit()
{
foreach(new i: Player)
{
SetPlayerTeam(i, -1);
}
Seifader_OnExit();
return 1;
}
public OnPlayerConnect(playerid)
{
SetPlayerTeam(playerid, 1);
Fuerza[playerid] = 1;
return 1;
}
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
new Float:danio, Float:vida, Float:chaleco, string[256];
new fuerza = Fuerza[issuerid];
if(issuerid != INVALID_PLAYER_ID)
{
if(amount == 2.64)
{
if(GetPlayerWeapon(issuerid) > 21 && GetPlayerWeapon(issuerid) < 34)
{
switch(fuerza)
{
case 0..10: danio = 11.5;
case 11..20: danio = 12.0;
case 21..30: danio = 12.5;
case 31..40: danio = 13.0;
case 41..50: danio = 13.5;
case 51..60: danio = 14.0;
case 61..70: danio = 14.5;
case 71..80: danio = 15.0;
case 81..90: danio = 15.5;
case 91..100: danio = 16.0;
}
}
}
else
{
if(weaponid >= 0 && weaponid < 16)
{
switch(weaponid)
{
case 0:
{
switch(bodypart)
{
case 3:
{
switch(fuerza)
{
case 0..10: danio = 3.0;
case 11..20: danio = 3.5;
case 21..30: danio = 4.0;
case 31..40: danio = 4.5;
case 41..50: danio = 5.0;
case 51..60: danio = 5.5;
case 61..70: danio = 6.0;
case 71..80: danio = 6.5;
case 81..90: danio = 7.0;
case 91..100: danio = 7.5;
}
}
case 4:
{
switch(fuerza)
{
case 0..10: danio = 4.5;
case 11..20: danio = 5.0;
case 21..30: danio = 5.5;
case 31..40: danio = 6.0;
case 41..50: danio = 6.5;
case 51..60: danio = 7.0;
case 61..70: danio = 7.5;
case 71..80: danio = 8.0;
case 81..90: danio = 8.5;
case 91..100: danio = 9.0;
}
}
case 5..8:
{
switch(fuerza)
{
case 0..10: danio = 2.0;
case 11..20: danio = 2.5;
case 21..30: danio = 3.0;
case 31..40: danio = 3.5;
case 41..50: danio = 4.0;
case 51..60: danio = 4.5;
case 61..70: danio = 5.0;
case 71..80: danio = 5.5;
case 81..90: danio = 6.0;
case 91..100: danio = 6.5;
}
}
case 9:
{
switch(fuerza)
{
case 0..10: danio = 4.0;
case 11..20: danio = 4.5;
case 21..30: danio = 5.0;
case 31..40: danio = 5.5;
case 41..50: danio = 6.0;
case 51..60: danio = 6.5;
case 61..70: danio = 7.0;
case 71..80: danio = 7.5;
case 81..90: danio = 8.0;
case 91..100: danio = 8.5;
}
}
}
}
case 1:
{
switch(bodypart)
{
case 3:
{
switch(fuerza)
{
case 0..10: danio = 4.0;
case 11..20: danio = 4.5;
case 21..30: danio = 5.0;
case 31..40: danio = 5.5;
case 41..50: danio = 6.0;
case 51..60: danio = 6.5;
case 61..70: danio = 7.0;
case 71..80: danio = 7.5;
case 81..90: danio = 8.0;
case 91..100: danio = 8.5;
}
}
case 4:
{
switch(fuerza)
{
case 0..10: danio = 5.5;
case 11..20: danio = 6.0;
case 21..30: danio = 6.5;
case 31..40: danio = 7.0;
case 41..50: danio = 7.5;
case 51..60: danio = 8.0;
case 61..70: danio = 8.5;
case 71..80: danio = 9.0;
case 81..90: danio = 9.5;
case 91..100: danio = 10.0;
}
}
case 5..8:
{
switch(fuerza)
{
case 0..10: danio = 3.0;
case 11..20: danio = 3.5;
case 21..30: danio = 4.0;
case 31..40: danio = 4.5;
case 41..50: danio = 5.0;
case 51..60: danio = 5.5;
case 61..70: danio = 6.0;
case 71..80: danio = 6.5;
case 81..90: danio = 7.0;
case 91..100: danio = 7.5;
}
}
case 9:
{
switch(fuerza)
{
case 0..10: danio = 5.0;
case 11..20: danio = 5.5;
case 21..30: danio = 6.0;
case 31..40: danio = 6.5;
case 41..50: danio = 7.0;
case 51..60: danio = 7.5;
case 61..70: danio = 8.0;
case 71..80: danio = 8.5;
case 81..90: danio = 9.0;
case 91..100: danio = 9.5;
}
}
}
}
case 2,3,5,6,7,15:
{
switch(bodypart)
{
case 3:
{
switch(fuerza)
{
case 0..10: danio = 6.0;
case 11..20: danio = 6.5;
case 21..30: danio = 7.0;
case 31..40: danio = 7.5;
case 41..50: danio = 8.0;
case 51..60: danio = 8.5;
case 61..70: danio = 9.0;
case 71..80: danio = 9.5;
case 81..90: danio = 10.0;
case 91..100: danio = 10.5;
}
}
case 4:
{
switch(fuerza)
{
case 0..10: danio = 10.5;
case 11..20: danio = 11.0;
case 21..30: danio = 11.5;
case 31..40: danio = 12.0;
case 41..50: danio = 12.5;
case 51..60: danio = 13.0;
case 61..70: danio = 13.5;
case 71..80: danio = 14.0;
case 81..90: danio = 14.5;
case 91..100: danio = 15.0;
}
}
case 5..8:
{
switch(fuerza)
{
case 0..10: danio = 5.0;
case 11..20: danio = 5.5;
case 21..30: danio = 6.0;
case 31..40: danio = 6.5;
case 41..50: danio = 7.0;
case 51..60: danio = 7.5;
case 61..70: danio = 8.0;
case 71..80: danio = 8.5;
case 81..90: danio = 9.0;
case 91..100: danio = 9.5;
}
}
case 9:
{
switch(fuerza)
{
case 0..10: danio = 10.0;
case 11..20: danio = 10.5;
case 21..30: danio = 11.0;
case 31..40: danio = 11.5;
case 41..50: danio = 12.0;
case 51..60: danio = 12.5;
case 61..70: danio = 13.0;
case 71..80: danio = 13.5;
case 81..90: danio = 14.0;
case 91..100: danio = 14.5;
}
}
}
}
case 4:
{
switch(bodypart)
{
case 3:
{
switch(fuerza)
{
case 0..10: danio = 10.0;
case 11..20: danio = 10.5;
case 21..30: danio = 11.0;
case 31..40: danio = 11.5;
case 41..50: danio = 12.0;
case 51..60: danio = 12.5;
case 61..70: danio = 13.0;
case 71..80: danio = 13.5;
case 81..90: danio = 14.0;
case 91..100: danio = 14.5;
}
}
case 4:
{
switch(fuerza)
{
case 0..10: danio = 12.5;
case 11..20: danio = 13.0;
case 21..30: danio = 13.5;
case 31..40: danio = 14.0;
case 41..50: danio = 14.5;
case 51..60: danio = 15.0;
case 61..70: danio = 15.5;
case 71..80: danio = 16.0;
case 81..90: danio = 16.5;
case 91..100: danio = 17.0;
}
}
case 5..8:
{
switch(fuerza)
{
case 0..10: danio = 6.0;
case 11..20: danio = 6.5;
case 21..30: danio = 7.0;
case 31..40: danio = 7.5;
case 41..50: danio = 8.0;
case 51..60: danio = 8.5;
case 61..70: danio = 9.0;
case 71..80: danio = 9.5;
case 81..90: danio = 10.0;
case 91..100: danio = 10.5;
}
}
case 9:
{
switch(fuerza)
{
case 0..10: danio = 12.0;
case 11..20: danio = 12.5;
case 21..30: danio = 13.0;
case 31..40: danio = 13.5;
case 41..50: danio = 14.0;
case 51..60: danio = 14.5;
case 61..70: danio = 15.0;
case 71..80: danio = 15.5;
case 81..90: danio = 16.0;
case 91..100: danio = 16.5;
}
}
}
}
case 8:
{
switch(bodypart)
{
case 3,4:
{
switch(fuerza)
{
case 0..10: danio = 15.0;
case 11..20: danio = 15.5;
case 21..30: danio = 16.0;
case 31..40: danio = 16.5;
case 41..50: danio = 17.0;
case 51..60: danio = 17.5;
case 61..70: danio = 18.0;
case 71..80: danio = 18.5;
case 81..90: danio = 19.0;
case 91..100: danio = 19.5;
}
}
case 5..8:
{
switch(fuerza)
{
case 0..10: danio = 12.0;
case 11..20: danio = 12.5;
case 21..30: danio = 13.0;
case 31..40: danio = 13.5;
case 41..50: danio = 14.0;
case 51..60: danio = 14.5;
case 61..70: danio = 15.0;
case 71..80: danio = 15.5;
case 81..90: danio = 16.0;
case 91..100: danio = 16.5;
}
}
case 9: danio = 200;
}
}
default: danio = amount;
}
format(string, sizeof(string), "Daсo que has recibido por el golpe/corte: %f | Fuerza del agresor: %d", danio, fuerza);
SendClientMessage(-1, playerid, string);
format(string, sizeof(string), "Daсo que has efectuado con el golpe/corte: %f", danio);
SendClientMessage(-1, issuerid, string);
}
if(weaponid > 21 && weaponid < 52)
{
switch(weaponid)
{
case 22,23:
{
switch(bodypart)
{
case 3,4: danio = 45.0;
case 5..8: danio = 20.0;
case 9: danio = 200.0;
}
}
case 24:
{
switch(bodypart)
{
case 3,4: danio = 70.0;
case 5..8: danio = 35.0;
case 9: danio = 200.0;
}
}
case 25..27:
{
switch(bodypart)
{
case 3,4: danio = 90.0;
case 5..8: danio = 50.0;
case 9: danio = 200.0;
}
}
case 28,32:
{
switch(bodypart)
{
case 3,4: danio = 45.0;
case 5..8: danio = 20.0;
case 9: danio = 200.0;
}
}
case 29:
{
switch(bodypart)
{
case 3,4: danio = 55.0;
case 5..8: danio = 30.0;
case 9: danio = 200.0;
}
}
case 30:
{
switch(bodypart)
{
case 3,4: danio = 65.0;
case 5..8: danio = 40.0;
case 9: danio = 200.0;
}
}
case 31:
{
switch(bodypart)
{
case 3,4: danio = 60.0;
case 5..8: danio = 35.0;
case 9: danio = 200.0;
}
}
case 33:
{
switch(bodypart)
{
case 3,4: danio = 80.0;
case 5..8: danio = 40.0;
case 9: danio = 200.0;
}
}
case 34:
{
switch(bodypart)
{
case 3,4: danio = 100.0;
case 5..8: danio = 60.0;
case 9: danio = 200.0;
}
}
default: danio = amount;
}
format(string, sizeof(string), "Daсo que has recibido por disparo: %f", danio);
SendClientMessage(-1, playerid, string);
format(string, sizeof(string), "Daсo que has efectuado con el disparo: %f", danio);
SendClientMessage(-1, issuerid, string);
FadePlayerScreen(playerid, 0xE20000FF, 25);
}
}
GetPlayerHealth(playerid, vida);
GetPlayerArmour(playerid, chaleco);
if(chaleco)
{
if(chaleco > danio) SetPlayerArmour(playerid, chaleco-danio);
else
{
SetPlayerArmour(playerid, 0.0);
chaleco = danio-chaleco;
if(chaleco >= vida) SetPlayerHealth(playerid, 0.0);
else SetPlayerHealth(playerid, vida-chaleco);
}
}
else
{
if(vida > danio) SetPlayerHealth(playerid, vida-danio);
else SetPlayerHealth(playerid, 0.0);
}
}
return 1;
}
stock Nombre(playerid)
{
new nombre[32];
GetPlayerName(playerid, nombre, 32);
return nombre;
}
COMMAND:darfuerza(playerid, params[])
{
if(!sscanf(params, "ui", params[0], params[1]))
{
if(params[0] != INVALID_PLAYER_ID)
{
if(params[1] < 0 || params[1] > 100) return SendClientMessage(playerid, -1, "[ERROR] Sуlo puedes dar entre 1 y 100 de fuerza.");
Fuerza[params[0]] = params[1];
new string[128];
format(string, sizeof(string), "%s te ha dado %d de fuerza.", Nombre(playerid), params[1]);
SendClientMessage(params[0], -1, string);
}
else SendClientMessage(playerid, -1, "[ERROR] El jugador seleccionado no se encuentra conectado.");
}
else SendClientMessage(playerid, -1, "[USO] '/darfuerza' [ID Jugador] [Fuerza 1-100]");
return 1;
}
COMMAND:fuerza(playerid, params[])
{
new string[128];
format(string, sizeof(string), "Tienes %d de fuerza.", Fuerza[playerid]);
SendClientMessage(playerid, -1, string);
return 1;
}
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart)
{
new Float:armour, Float:hpplayer, Float:hpamount, Float:amamount;
GetPlayerArmour(playerid,armour);
GetPlayerHealth(playerid,hpplayer);
if(armour>0)
{
switch(bodypart)
{
case 3, 4:
{
amamount=(amount/100)*50;
hpamount=(amount/100)*50;
SetPlayerArmour(playerid,floatsub(hpplayer, hpamount));
SetPlayerHealth(playerid,floatsub(armour, amamount));
}
case 5 .. 8:
{
hpamount = (amount/4)*3;
SetPlayerHealth(playerid,floatsub(hpplayer, hpamount));
}
case 9:
{
amamount=(amount/100)*25;
hpamount=(amount/100)*75;
SetPlayerArmour(playerid,floatsub(hpplayer, hpamount));
SetPlayerHealth(playerid,floatsub(armour, amamount));
}
}
}
else
{
switch(bodypart)
{
case 3, 4:
{
hpamount = (amount/4)+amount;
SetPlayerHealth(playerid,floatsub(hpplayer, hpamount));
}
case 5 .. 8:
{
hpamount = (amount/4)*3;
SetPlayerHealth(playerid,floatsub(hpplayer, hpamount));
}
case 9:
{
hpamount = ((amount/4)*3)+amount;
SetPlayerHealth(playerid,floatsub(hpplayer, hpamount));
}
}
}
return 1;
}