Send the message when he shot another diff. player
#1

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(playeridattackersizeof (attacker));
           
GetPlayerName(damagedidvictimsizeof (victim));
           
GetWeaponName(weaponidweaponnamesizeof (weaponname));
        
format(stringsizeof(string), "You have shot %s with a weapon: %s"victimweaponname);
        
SendClientMessage(playerid, -1string);
        
format(adminstringsizeof(adminstring), "* "COL_LIGHTGREEN"[DamageInfo] %s has shot %s with a weapon: %s"attackervictimweaponname);
        
SendMessageToAllAdmins(adminstring, -1);
        
format(adminstringsizeof(adminstring), "\x0206[DamageInfo]\x02 \x1D%s has shot %s with a weapon: %s\x1D"attackervictimweaponname);
           
IRC_GroupSay(gGroupIDIRC_ADMINCHANNELadminstring);
    } 
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?
Reply
#2

Save the weapon id in a variable and check if it's the same weapon or not. What's so hard ?
Reply
#3

It might be so easy for you since you're experienced.

Thanks.
Reply
#4

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)