BlockPm help REP+
#1

pawn Код:
CMD:pm(playerid, params[])
{
    new str[256], str2[128], id, Name1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME];
    if(sscanf(params, "us[128]", id, str2))
    {
        SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /pm [playerid] [message]");
        return 1;
    }
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFFFF00AA, "ERROR: Player not connected");
    if(playerid == id) return SendClientMessage(playerid, 0xFFFF00AA, "ERROR: You cannot pm yourself!");
    GetPlayerName(playerid, Name1, sizeof(Name1));
    GetPlayerName(id, Name2, sizeof(Name2));
    format(str, sizeof(str), "pm sent To %s(ID %d): %s", Name2, id, str2);
    SendClientMessage(playerid, COLOR_YELLOW, str);
    format(str, sizeof(str), "PM From %s(ID %d): %s", Name1, playerid, str2);
    SendClientMessage(id, COLOR_YELLOW, str);
    new File:log = fopen("/ServerLog.txt", io_append); // Open the file and prepares for writing inside
    format(str, sizeof(str), "pm recived from %s to %s: %s\r\n", Name1, Name2, str2);//makes string that will be printed
    fwrite(log, str); // Write to the file (\r\n is for a new line)printing the string
    fclose(log); // Close the file
    return 1;
}
How can I make a BLOCKPM command for this I am confused help please
Reply
#2

pawn Код:
CMD:pm(playerid, params[])
{
    new str[256], str2[128], id, Name1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME];
    if(sscanf(params, "us[128]", id, str2))
    {
        SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /pm [playerid] [message]");
        return 1;
    }
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFFFF00AA, "ERROR: Player not connected");
    if(playerid == id) return SendClientMessage(playerid, 0xFFFF00AA, "ERROR: You cannot pm yourself!");
    if(GetPVarInt(id, "BlockPM") == 1) return SendClientMessage(playerid, 0xFFFF00AA, "The player don't want anyone PM his/her");
    GetPlayerName(playerid, Name1, sizeof(Name1));
    GetPlayerName(id, Name2, sizeof(Name2));
    format(str, sizeof(str), "pm sent To %s(ID %d): %s", Name2, id, str2);
    SendClientMessage(playerid, COLOR_YELLOW, str);
    format(str, sizeof(str), "PM From %s(ID %d): %s", Name1, playerid, str2);
    SendClientMessage(id, COLOR_YELLOW, str);
    new File:log = fopen("/ServerLog.txt", io_append); // Open the file and prepares for writing inside
    format(str, sizeof(str), "pm received from %s to %s: %s\r\n", Name1, Name2, str2);//makes string that will be printed
    fwrite(log, str); // Write to the file (\r\n is for a new line)printing the string
    fclose(log); // Close the file
    return 1;
}

CMD:blockpm(playerid, params[])
{
    if(GetPVarInt(playerid, "BlockPM") == 1)
    {
        SetPVarInt(playerid, "BlockPM", 0);
        SendClientMessage(playerid, COLOR_YELLOW, "You have unblock yourself to receive PM");
    }
    else
    {
        SetPVarInt(playerid, "BlockPM", 1);
        SendClientMessage(playerid, COLOR_YELLOW, "You have block yourself to receive PM");
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)