Send the message when he shot another diff. player - 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: Send the message when he shot another diff. player (
/showthread.php?tid=662990)
Send the message when he shot another diff. player -
DarkMythHunter - 18.01.2019
So I have this code:
PHP код:
if(playerid != INVALID_PLAYER_ID)
{
new string[129], victim[MAX_PLAYER_NAME], attacker[MAX_PLAYER_NAME];
new weaponname[24];
new adminstring[144];
GetPlayerName(playerid, attacker, sizeof (attacker));
GetPlayerName(damagedid, victim, sizeof (victim));
GetWeaponName(weaponid, weaponname, sizeof (weaponname));
format(string, sizeof(string), "You have shot %s with a weapon: %s", victim, weaponname);
SendClientMessage(playerid, -1, string);
format(adminstring, sizeof(adminstring), "* "COL_LIGHTGREEN"[DamageInfo] %s has shot %s with a weapon: %s", attacker, victim, weaponname);
SendMessageToAllAdmins(adminstring, -1);
format(adminstring, sizeof(adminstring), "\x0206[DamageInfo]\x02 \x1D%s has shot %s with a weapon: %s\x1D", attacker, victim, weaponname);
IRC_GroupSay(gGroupID, IRC_ADMINCHANNEL, adminstring);
}
So basically this will send the player who shot someone a message who he shot, while admins get a message Who shot who and with that gun. However, everytime a bullet hit it just spams the message, if you shot like 10 combat shotgun shots it'll send 10 messages which would spam. I wanted to make it when he shot this "player2" he'll get a message that he shot "player2" but it won't give another message if he shot the "player2" again with the same weapon, he'll get another message when he shot that "player2" with a different weapon. How do I do that?
Re: Send the message when he shot another diff. player -
Exhibit - 18.01.2019
Save the weapon id in a variable and check if it's the same weapon or not. What's so hard ?
Re: Send the message when he shot another diff. player -
DarkMythHunter - 18.01.2019
It might be so easy for you since you're experienced.
Thanks.
Re: Send the message when he shot another diff. player -
RoboN1X - 18.01.2019
Quote:
Originally Posted by DarkMythHunter
It might be so easy for you since you're experienced.
Thanks.
|
I think you should try...
Quote:
Originally Posted by Exhibit
Save the weapon id in a variable and check if it's the same weapon or not. What's so hard ?
|
Код:
new LastShotWeapon[MAX_PLAYERS][MAX_PLAYERS];
if (LastShotWeapon[attacker][victim] != weaponid)
{
// Display message
LastShotWeapon[attacker][victim] = weaponid;
}
Also you might want to exclude "flame/fire" weapons from this, it'll still spam if someone burning is being shot with another gun. You can search functions like IsPlayerBurning & OnPlayerBurning in this forums.