need help with onlyplayergivedamage or takedamage -
Nabster - 21.02.2015
this is my code ,i want to give kills to the player and give damage to the players in the range and it should show in kill feed
Код:
forward DelayedNuke(playerid);
public DelayedNuke(playerid)
{
SetWeather(19);
SendClientMessageToAll(COLOR_MAROON,"[NUKE] Balla's base has been nuked");
CreateExplosion(2466.5945,-1660.5227,13.2774,6,100.0);
for(new i = 0; i < MAX_PLAYERS; i ++)
if(IsPlayerInRangeOfPoint(i,50.0,2466.5945, -1660.5227, 13.2774))
{
if(PInfo[i][God] == 1 || PInfo[i][pAdminDuty] == 1)
return 1;
GameTextForPlayer(i, "~r~NUKED!",2000,3);
SetPlayerHealth(i,0.0);
PInfo[i][Nuked] = 1;
}
return 1;
}
Re: need help with onlyplayergivedamage or takedamage -
Extremo - 21.02.2015
What is the problem exactly?
Re: need help with onlyplayergivedamage or takedamage -
Nabster - 21.02.2015
Quote:
Originally Posted by Extremo
What is the problem exactly?
|
There is no problem with the code,i want to know that how can i give kills to the guy who used nuked and show it in kill feed
Re: need help with onlyplayergivedamage or takedamage -
CalvinC - 21.02.2015
https://sampwiki.blast.hk/wiki/SendDeathMessage
For kills, you will need to show how you use it, or if you can do it yourself ofc.
It might look something like this:
pawn Код:
PInfo[playerid][Kills] ++;
Re: need help with onlyplayergivedamage or takedamage -
Nabster - 21.02.2015
eh no not that,i mean like
there are players in area where i launched nuke now they are all dead,i want to send message to the player and it will show in kill list
random1,random2,random3
You killed random1
You killed random2
You killed random3
Re: need help with onlyplayergivedamage or takedamage -
Extremo - 21.02.2015
Add a string on top of the loop, like
and in the loop you do the following:
pawn Код:
new name[MAX_PLAYER_NAME];
GetPlayerName(i, name, sizeof(name));
format(killed, sizeof(killed), "%s\n%s", killed, name);
and at the bottom of the loop
pawn Код:
format(killed, sizeof(killed), "You killed the following players: %s", killed);
SendClientMessage(playerwholaunchednuke, color, killed);
I am sure you get the idea
Re: need help with onlyplayergivedamage or takedamage -
CalvinC - 21.02.2015
Since you're creating an explosion, you can check if they're close to it, and if they died by an explosion.
To check if they died by an explosion, you can use OnPlayerDeath.
Just made a simple code here, where you need 2 global variables:
pawn Код:
new NukeActivated;
new NukeIssuer;
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
if(reason == 51 && NukeActivated == 1 && IsPlayerInRangeOfPoint(playerid, 50.0,2466.5945, -1660.5227, 13.2774)
// 51 = Explosion reason, and using same coordinates as your nuke IsPlayerInRangeOfPoint
{
new string[13 + MAX_PLAYER_NAME];
format(string, sizeof(string), "You killed %s!");
SendClientMessage(NukeIssuer, -1, string);
}
return 1;
}
Then in your nuke code, set "NukeIssuer" to the playerid that launched it, and set "NukeActivated" to 1.
Then create a short timer, like about 1 second, where you set "NukeActivated" to 0.
Re: need help with onlyplayergivedamage or takedamage -
Nabster - 21.02.2015
thank you for all your help