public OnPlayerDeath(playerid, killerid, reason)
{
#if defined USE_STATS
PlayerInfo[playerid][Deaths]++;
#endif
InDuel[playerid] = 0;
if(IsPlayerConnected(killerid) && killerid != INVALID_PLAYER_ID)
{
#if defined USE_STATS
PlayerInfo[killerid][Kills]++;
#endif
if(InDuel[playerid] == 1 && InDuel[killerid] == 1)
{
GameTextForPlayer(playerid,"Loser !",3000,3);
GameTextForPlayer(killerid,"Winner !",3000,3);
InDuel[killerid] = 0;
SetPlayerPos(killerid, 0.0, 0.0, 0.0);
SpawnPlayer(killerid);
}
else if(InDuel[playerid] == 1 && InDuel[killerid] == 0)
{
GameTextForPlayer(playerid,"Loser !",3000,3);
}
if(PlayerInfo[playerid][Level] >= 1)
SendDeathMessage(killerid, playerid, reason);
}
#if defined ENABLE_SPEC
for(new x=0; x<MAX_PLAYERS; x++)
if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && PlayerInfo[x][SpecID] == playerid)
AdvanceSpectate(x);
#endif
if(PlayerInfo[playerid][Level] >= 1)////////////////////////////////////////////////////////////////////////// code here
SendDeathMessage(killerid, playerid, reason);/////////////////////////////////////////////////////////////////// code here
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
new string[128];
#if defined USE_STATS
PlayerInfo[playerid][Deaths]++;
#endif
InDuel[playerid] = 0;
if(IsPlayerConnected(killerid) && killerid != INVALID_PLAYER_ID)
{
#if defined USE_STATS
PlayerInfo[killerid][Kills]++;
#endif
if(InDuel[playerid] == 1 && InDuel[killerid] == 1)
{
GameTextForPlayer(playerid,"Loser !",3000,3);
GameTextForPlayer(killerid,"Winner !",3000,3);
InDuel[killerid] = 0;
SetPlayerPos(killerid, 0.0, 0.0, 0.0);
SpawnPlayer(killerid);
}
else if(InDuel[playerid] == 1 && InDuel[killerid] == 0)
{
GameTextForPlayer(playerid,"Loser !",3000,3);
}
if(PlayerInfo[playerid][Level] >= 1)
format(string, sizeof(string), "%s has killed %s.", othername,name);
SendClientMessage(playerid,YOURCOLOR, string);
}
#if defined ENABLE_SPEC
for(new x=0; x<MAX_PLAYERS; x++)
if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && PlayerInfo[x][SpecID] == playerid)
AdvanceSpectate(x);
#endif
if(PlayerInfo[x][Level] >= 1)////////////////////////////////////////////////////////////////////////// code here
format(string, sizeof(string), "%s has killed %s.", othername,name);
SendClientMessage(x,YOURCOLOR, string);
return 1;
}
|
SendDeathMessage is global so it will show on the whole server, i fixed some things
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
new string[128];
#if defined USE_STATS
PlayerInfo[playerid][Deaths]++;
#endif
InDuel[playerid] = 0;
if(IsPlayerConnected(killerid) && killerid != INVALID_PLAYER_ID)
{
#if defined USE_STATS
PlayerInfo[killerid][Kills]++;
#endif
if(InDuel[playerid] == 1 && InDuel[killerid] == 1)
{
GameTextForPlayer(playerid,"Loser !",3000,3);
GameTextForPlayer(killerid,"Winner !",3000,3);
InDuel[killerid] = 0;
SetPlayerPos(killerid, 0.0, 0.0, 0.0);
SpawnPlayer(killerid);
}
else if(InDuel[playerid] == 1 && InDuel[killerid] == 0)
{
GameTextForPlayer(playerid,"Loser !",3000,3);
}
if(PlayerInfo[playerid][Level] >= 1)
format(string, sizeof(string), "%s has killed %s.", othername,name);
SendClientMessage(playerid,YOURCOLOR, string);
}
#if defined ENABLE_SPEC
for(new x=0; x<MAX_PLAYERS; x++)
if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && PlayerInfo[x][SpecID] == playerid)
AdvanceSpectate(x);
#endif
if(PlayerInfo[x][Level] >= 1)////////////////////////////////////////////////////////////////////////// code here
format(string, sizeof(string), "%s has killed %s.", othername,name);
SendClientMessage(x,YOURCOLOR, string);
return 1;
}
![]() |