SendDeathMessage problem!! - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: SendDeathMessage problem!! (
/showthread.php?tid=250957)
SendDeathMessage problem!! -
nejc001 - 25.04.2011
I dont know why doesnt this work.. its a simple bare FS, and its should show if killer is 1, it should show a SendDeathMessage that he is the killer. this is just an example..
pawn Код:
#include <a_samp>
#include <core>
#include <float>
#pragma tabsize 0
new killer[MAX_PLAYERS];
main()
{
print("\n----------------------------------");
print(" Bare Script\n");
print("----------------------------------\n");
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new idx;
new cmd[256];
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/kill", true) == 0)
{
killer[playerid] = 1;
SetPlayerHealth(playerid,0.0);
return 1;
}
return 0;
}
public OnPlayerDeath(playerid, killerid, reason)
{
if(killer[killerid] == 1)
{
SendDeathMessage(killerid,playerid, reason); // this doesnt show up
}
return 1;
}
// other stuff
Re: SendDeathMessage problem!! -
Lorenc_ - 25.04.2011
idgi what this does.
if(killer[killerid] == 1)
remove it?
Re: SendDeathMessage problem!! -
Tee - 25.04.2011
If you want the death message to show like normal just do what Lorenc_ said.
OR
If you want the player that types the command they will be a killer and when they he kills someone it will show a death message use this:
pawn Код:
#include <a_samp>
#include <core>
#include <float>
#pragma tabsize 0
new killer[MAX_PLAYERS],killeridex;
main()
{
print("\n----------------------------------");
print(" Bare Script\n");
print("----------------------------------\n");
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new idx;
new cmd[256];
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/kill", true) == 0)
{
killer[playerid] = 1;
SetPlayerHealth(playerid,0.0);
playerid = killeridex;
return 1;
}
return 0;
}
public OnPlayerDeath(playerid, killerid, reason)
{
killeridex = killerid;
if(killer[killerid] == 1)
{
SendDeathMessage(killerid,playerid, reason); // this doesnt show up
}
return 1;
}
// other stuff
Re: SendDeathMessage problem!! -
nejc001 - 25.04.2011
Quote:
Originally Posted by Lorenc_
idgi what this does.
if(killer[killerid] == 1)
remove it?
|
This is just an example script, it need to show the SendDeathMessage just for a players who have (killer= 1).
Problem is, how to show SendDeathMessage just for players that have (killer= 1)?
Re: SendDeathMessage problem!! -
Tee - 25.04.2011
Then use this:
pawn Код:
#include <a_samp>
#include <core>
#include <float>
#pragma tabsize 0
new killer[MAX_PLAYERS],killeridex;//New global variable "killeridex"
main()
{
print("\n----------------------------------");
print(" Bare Script\n");
print("----------------------------------\n");
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new idx;
new cmd[256];
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/kill", true) == 0)
{
killer[playerid] = 1;
SetPlayerHealth(playerid,0.0);
playerid = killeridex;//Storing the player's id (The one who typed /kill) into killeridex.
return 1;
}
return 0;
}
public OnPlayerDeath(playerid, killerid, reason)
{
killeridex = killerid;//Extracting (The playerid who typed /kill) into killerid. It should work. :D
if(killer[killerid] == 1)
{
SendDeathMessage(killerid,playerid, reason); // this doesnt show up
}
return 1;
}
// other stuff
Re: SendDeathMessage problem!! -
Clueless - 01.05.2011
How can I make a kill list code to my own server?