Problem with PM script
#1

I have a PM script that includes: /pm /reply /nopm(disables your pms)
When I type a message to someone like: /pm 2 Hey, whats up, I am fine, nice day, blah blah blah blah blah.
The the message is cut in the middle like there is a specific amount of max characters in a pm.How to change that?

pawn Код:
#include <a_samp>
#include <sscanf2>
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
#define COLOUR_SYSTEM   0xB60000FF
#define COLOUR_PM       0xFFFF2AFF
#define COLOUR_INFO     0x00983BFF

enum PM_PlayerData
{
    LastMessage,
    NoPM,
};
new PM_PlayerInfo[MAX_PLAYERS][PM_PlayerData];


public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(pm, 2, cmdtext);
    dcmd(reply, 5, cmdtext);
    dcmd(r, 1, cmdtext);
    dcmd(nopm, 4, cmdtext);
    return 0;
}
public OnFilterScriptInit()
{
    print("*****************************************************");
    print("      PM Successfully Loaded!        ");
    print("******************************************************");
    return 1;
}

public OnPlayerConnect(playerid)
{
    PM_PlayerInfo[playerid][LastMessage] = INVALID_PLAYER_ID;
    PM_PlayerInfo[playerid][NoPM] = 0;
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    PM_PlayerInfo[playerid][LastMessage] = INVALID_PLAYER_ID;
    PM_PlayerInfo[playerid][NoPM] = 0;
    return 1;
}
stock pNick(playerid)
{
    new nick[MAX_PLAYER_NAME];
    GetPlayerName(playerid, nick, MAX_PLAYER_NAME);
    return nick;
}
dcmd_pm(playerid, params[])
{
        new id, msg[75], string[200];
        if(sscanf(params, "us", id, msg)) return SendClientMessage(playerid, COLOUR_SYSTEM, "Usage: /pm (nick/id) (message)");
        if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOUR_SYSTEM, "Invalid Player!");
        if(id == playerid) return SendClientMessage(playerid, COLOUR_SYSTEM, "You Can Not PM Yourself!");
        if(PM_PlayerInfo[id][NoPM] == 1) return SendClientMessage(playerid, COLOUR_PM, "This player has disable pm.");
        format(string,sizeof(string),"PM Sent To %s (%d): %s", pNick(id), id, msg);
        SendClientMessage(playerid, COLOUR_PM, string);
        format(string,sizeof(string),"PM From %s (%d): %s", pNick(playerid), playerid, msg);
        SendClientMessage(id, COLOUR_PM, string);
        SendClientMessage(id, COLOUR_INFO, "Type /reply or /r To Quick Reply And /nopm To Disable Pms.");
        PM_PlayerInfo[id][LastMessage] = playerid;
        return 1;
}
dcmd_reply(playerid, params[])
{
        new msg[75], string[200];
        new id = PM_PlayerInfo[playerid][LastMessage];
        if(sscanf(params, "s", msg)) return SendClientMessage(playerid, COLOUR_SYSTEM, "Usage: /reply (text)");
        if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOUR_SYSTEM, "Invalid Player!");
        if(PM_PlayerInfo[id][NoPM] == 1) return format(string,sizeof(string),"%s (%d) Is Not Accepting His PMs At The Moment.", pNick(id), id); SendClientMessage(playerid, COLOUR_PM, string);
        format(string,sizeof(string),"PM Sent To %s (%d): %s", pNick(id), id, msg);
        SendClientMessage(playerid, COLOUR_PM, string);
        format(string,sizeof(string),"PM From %s (%d): %s", pNick(playerid), playerid, msg);
        SendClientMessage(id, COLOUR_PM, string);
        SendClientMessage(id, COLOUR_INFO, "Type /reply or /r To Quick Reply And /nopm To Disable Pms.");
        PM_PlayerInfo[id][LastMessage] = playerid;
        return 1;
}
dcmd_r(playerid, params[])
{
    return dcmd_reply(playerid, params);
}

dcmd_nopm(playerid,params[])
{
    #pragma unused params
    if (PM_PlayerInfo[playerid][NoPM] == 1)
    {
        PM_PlayerInfo[playerid][NoPM] = 0;
        SendClientMessage(playerid,0xFFFF00FF,"Pm's on!");
    }
    else
    {
        PM_PlayerInfo[playerid][NoPM] = 1;
        SendClientMessage(playerid,0xFFFF00FF,"Pm's off!");
    }
    return 1;
}

/*

dcmd_nopm(playerid, params[])
{


    new amount;
    if(sscanf(params, "d", amount)) return SendClientMessage(playerid, COLOUR_SYSTEM, "Usage: /nopm (Toggle: 0/1)");
    if(amount < 0 || amount > 1) return SendClientMessage(playerid, COLOUR_SYSTEM, "Usage: /nopm (Toggle: 0/1)");
    if(amount == 0)
    {
        PM_PlayerInfo[playerid][NoPM] = 0;
        SendClientMessage(playerid, COLOUR_PM, "You Have Enabled Incomming PMs. Use /nopm To Disable PMs.");
    }
    if(amount == 1)
    {
        PM_PlayerInfo[playerid][NoPM] = 1;
        SendClientMessage(playerid, COLOUR_PM, "You Have Disabled Incomming PMs. Use /nopm To Enable PMs.");
    }
    return 1;
}

*/
Reply


Messages In This Thread
Problem with PM script - by NickTaSpy - 24.05.2012, 14:36
Re: Problem with PM script - by Jstylezzz - 24.05.2012, 14:45
Re: Problem with PM script - by NickTaSpy - 24.05.2012, 14:49
Re: Problem with PM script - by Neil. - 24.05.2012, 14:51
Re: Problem with PM script - by NickTaSpy - 26.05.2012, 11:32
Re: Problem with PM script - by Neil. - 26.05.2012, 11:42
Re: Problem with PM script - by NickTaSpy - 26.05.2012, 20:26
Re: Problem with PM script - by Kirollos - 11.07.2012, 11:39

Forum Jump:


Users browsing this thread: 1 Guest(s)