SendDeathMessage problem!!
#1

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
Reply
#2

idgi what this does.

if(killer[killerid] == 1)

remove it?
Reply
#3

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
Reply
#4

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)?
Reply
#5

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
Reply
#6

How can I make a kill list code to my own server?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)