Please help: /call 112 after death
#1

Hello ! The problem of this script is that if a player types /call 112, the other one recives wanted, but if the other player types /call 112 it says that "No one committed any illegal against you" even someone did.
Код:
if(strcmp("/call 112", cmdtext, true) == 0)
    {
    new pid; if(IsPlayerConnected(pid) && IsPlayerConnected(playerid))
    {
    if(Cell[playerid] == 1 && Cell[pid] == 2)
    {
        Cell[playerid] = 0;
            Cell[pid] = 0;
            SendClientMessage(playerid, COLOR_RED, "PD: Thank you for reporting the illegal.");
            if(GetPlayerWantedLevel(pid) < 6)
            {
            if(pid != INVALID_PLAYER_ID) SetPlayerWantedLevel(pid, GetPlayerWantedLevel(pid) + 1);
        new string[128],name[MAX_PLAYERS];
        GetPlayerName(playerid, name, sizeof(name));
            format(string, sizeof(string), "Current wanted: %d, {FF0000}Reporter: %s {FF0000}Crime: Murder", GetPlayerWantedLevel(pid), name);
            SendClientMessage(pid, COLOR_YELLOW, string);
            return 1;
            }
            if(GetPlayerWantedLevel(pid) == 6)
            {
        new tmp[128],name[MAX_PLAYERS];
        GetPlayerName(playerid, name, sizeof(name));
        format(tmp, sizeof(tmp), "Current wanted: 6, {FF0000}Reporter: %s {FF0000}Crime: Murder", name);
            SendClientMessage(pid, COLOR_YELLOW, tmp);
            SetPlayerWantedLevel(pid, GetPlayerWantedLevel(pid) + 0);
            return 1;
            }
            SetTimerEx("Wanted", 1800000, false, "i", pid);
    }
    else
    {
    SendClientMessage(playerid, COLOR_WHITE, "No one comitted any illegal against you.");
    return 1;
    }}
    return 1;
    }
    ////////////////////////////////
    public OnPlayerDeath(playerid,killerid,reason)
    {
        if(killerid != INVALID_PLAYER_ID && playerid != INVALID_PLAYER_ID)
        {
        Cell[playerid] = 1;
        Cell[killerid] = 2;
            new str[128], playername[MAX_PLAYER_NAME];
            GetPlayerName(killerid, playername, sizeof(playername));
            format(str, sizeof(str), "%s killed you. You have 60 seconds to type /call 112.", playername);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
            SetTimerEx("Killcell",60000,false, "i", playerid);
            return 1;
            }
    return 1;
    }
Please help me with this problem. Thank you !
Reply
#2

I am not sure about this, but do you set anywhere before this line
Quote:

if(Cell[playerid] == 1 && Cell[pid] == 2)

the array "pid" ? if not then you're checking index 0 of the Cell array (playerid 0) if it equals to 2

and in the death callback you set the player who died "Cell" array to 1,

if everything is right then playerid 0 is always holding his Cell array at 2, which makes it constant 2 and when the player who died types the command, his Cell array is set to 1, so he gets the message, but when the killer types the command, he will get the -else- message because he is holding number two. (so 2 && 2 are going through the conditional statement)
Reply
#3

Ok, but how to define "pid" as other player, beside playerid?
Reply
#4

sscanf(cmdtext, "u", pid);
using sscanf by ******
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)