How to Edit Damage of weapon
#1

How to Edit Damage of weapon

Thank You
gamemode : South Central Roleplay 0.20
Reply
#2

use these
https://sampwiki.blast.hk/wiki/OnPlayerGiveDamage
https://sampwiki.blast.hk/wiki/OnPlayerTakeDamage
Reply
#3

Quote:

public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid)
{
if (damagedid != INVALID_PLAYER_ID)
{
PlayerData[damagedid][pLastShot] = playerid;
PlayerData[damagedid][pShotTime] = gettime();

if (IsBleedableWeapon(weaponid) && !PlayerData[damagedid][pBleeding] && ReturnArmour(damagedid) < 1 && PlayerData[playerid][pRangeBooth] == -1 && PlayerData[damagedid][pHospital] == -1)
{
if (!PlayerHasTazer(playerid) && !PlayerHasBeanBag(playerid))
{
PlayerData[damagedid][pBleeding] = 1;
PlayerData[damagedid][pBleedTime] = 10;

CreateBlood(damagedid);
SetTimerEx("HidePlayerBox", 500, false, "dd", damagedid, _:ShowPlayerBox(damagedid, 0xFF000066));
}
}
if (PlayerData[playerid][pDrugUsed] == 4 && (weaponid >= 0 && weaponid <= 15))
{
SetPlayerHealth(damagedid, ReturnHealth(damagedid) - 6);
}
if (GetFactionType(playerid) == FACTION_POLICE && PlayerData[playerid][pTazer] && PlayerData[damagedid][pStunned] < 1 && weaponid == 23)
{
if (GetPlayerState(damagedid) != PLAYER_STATE_ONFOOT)
return SendErrorMessage(playerid, "The player must be onfoot to be stunned.");

if (GetPlayerDistanceFromPlayer(playerid, damagedid) > 10.0)
return SendErrorMessage(playerid, "You must be closer to stun the player.");

new
string[64];

format(string, sizeof(string), "You've been ~r~stunned~w~ by %s.", ReturnName(playerid, 0));

PlayerData[damagedid][pStunned] = 10;
TogglePlayerControllable(damagedid, 0);

ApplyAnimation(damagedid, "CRACK", "crckdeth4", 4.0, 0, 0, 0, 1, 0, 1);
ShowPlayerFooter(damagedid, string);

SendNearbyMessage(playerid, 30.0, COLOR_PURPLE, "** %s вґ№ЄкНµ %s ґйЗВ»Ч№ЄкНµдїїйТ", ReturnName(playerid, 0), ReturnName(damagedid, 0));
}
if (GetFactionType(playerid) == FACTION_POLICE && PlayerData[playerid][pBeanBag] && PlayerData[damagedid][pStunned] < 1 && weaponid == 25)
{
if (GetPlayerState(damagedid) != PLAYER_STATE_ONFOOT)
return SendErrorMessage(playerid, "The player must be onfoot to be stunned.");

if (GetPlayerDistanceFromPlayer(playerid, damagedid) > 10.0)
return SendErrorMessage(playerid, "¤ШіЁРµйН§НВЩигЎЕйжјЩйаЕи№.");

new
string[64];

format(string, sizeof(string), "You've been ~r~stunned~w~ by %s.", ReturnName(playerid, 0));

PlayerData[damagedid][pStunned] = 10;
TogglePlayerControllable(damagedid, 0);

ApplyAnimation(damagedid, "CRACK", "crckdeth4", 4.0, 0, 0, 0, 1, 0, 1);
ShowPlayerFooter(damagedid, string);

SendNearbyMessage(playerid, 30.0, COLOR_PURPLE, "** %s has stunned %s with their beanbag shotgun.", ReturnName(playerid, 0), ReturnName(damagedid, 0));
}
}
return 1;

I do not understand
Reply
#4

Neither do we if you don't put them in [PHP][./PHP]

I doubt you know how to do it, but it's simply setting player health to GetPlayerHealth(playerid)-GetCustomWeapDmg(weaponid)
and then creating a GetCustomWeapDmg function to return that weaps dmg ( not most optimized way, but really everyone used to do it like this till they learned better, some other ways would be a, CustomDmg[] Variable, and extracting it from that. )
Reply
#5

https://sampwiki.blast.hk/wiki/OnPlayerTakeDamage ->That has everything you're looking for, an example as well. Set your 'amount' parameters to how much ever damage you want people to take from a certain weapon!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)