Damage - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Damage (
/showthread.php?tid=493928)
Damage -
lsreskjn - 10.02.2014
Hey, i've just found this cool script in wiki and put it my mod, the problem is, its only pooping up the message in chat when I AM SCHOOTING...is there any way to make so it will pop up if someone is shooting me? and make it so its not spamming only one message per 5 second?
Код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid)
{
if(damagedid != INVALID_PLAYER_ID)
{
new string[128], player[MAX_PLAYER_NAME], damaged[MAX_PLAYER_NAME], weapon[24];
GetPlayerName(playerid, player, sizeof(player));
GetPlayerName(damagedid, damaged, sizeof(damaged));
GetWeaponName(weaponid, weapon, sizeof (weapon));
format(string, sizeof(string), "[ DAMAGE ] {FF0000}%s {FFFFFF}dostal {FF0000}%.0f zranenie {FFFFFF}od hraca {228B22}%s{FFFFFF}. Zbran: %s", damaged, amount, player, weapon);
SendClientMessageToAll(0xFFFFFFFF, string);
}
return 1;
}
Re: Damage -
]Rafaellos[ - 10.02.2014
*Edit, that was the 5 seconds part.
You can do it that way:
pawn Код:
new bool:GetMessage;
forward WillGetMessage();
public WillGetMessage()
{
GetMessage = true;
return 1;
}
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid)
{
if(damagedid != INVALID_PLAYER_ID)
{
if(GetMessage)
{
new string[128], player[MAX_PLAYER_NAME], damaged[MAX_PLAYER_NAME], weapon[24];
GetPlayerName(playerid, player, sizeof(player));
GetPlayerName(damagedid, damaged, sizeof(damaged));
GetWeaponName(weaponid, weapon, sizeof (weapon));
GetMessage = false;
SetTimer("WillGetMessage", 5000, 0);
format(string, sizeof(string), "[ DAMAGE ] {FF0000}%s {FFFFFF}dostal {FF0000}%.0f zranenie {FFFFFF}od hraca {228B22}%s{FFFFFF}. Zbran: %s", damaged, amount, player, weapon);
SendClientMessageToAll(0xFFFFFFFF, string);
}
}
return 1;
}
Haven't tested it, I think it will work.
Re: Damage -
lsreskjn - 10.02.2014
No, this one isnt even working, nothing happens when shooting
Re: Damage -
lsreskjn - 10.02.2014
anyone?