pm cmd problem
#7

pawn Код:
if (!strcmp("/nopm", cmdtext, true, 5))
{
    if (GetPVarInt(playerid,"NoPM"))
    {
        SetPVarInt(playerid,"NoPM",0);
        SendClientMessage(playerid,0xFFFF00FF,"Pm's on!");
    }
    else
    {
        SetPVarInt(playerid,"NoPM",1);
        SendClientMessage(playerid,0xFFFF00FF,"Pm's off!");
    }
    return 1;
}
else if (!strcmp("/pm", cmdtext, true, 3))
{
    new id, msg[100];
    if (sscanf(cmdtext[4], "us[100]", id, msg)) return SendClientMessage(playerid, 0xFF0000FF, "Usage: /pm [ID] [MESSAGE]");
    if (id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "Player No Connected");
    if (playerid == id) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: You Cannot PM Yourself!");
    if (GetPVarInt(id,"NoPM")) return SendClientMessage(playerid,0xFF0000FF,"That player isnt recieving pm's");
   
    new Name1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME], str[144];
    GetPlayerName(playerid, Name1, sizeof(Name1));
    GetPlayerName(id, Name2, sizeof(Name2));
    format(str, sizeof(str), "PM To %s: %s", Name2, id, msg);
    SendClientMessage(playerid, 0xFF0000FF, str);
    format(str, sizeof(str), "PM From %s: %s", Name1, playerid, msg);
    SendClientMessage(id, 0xFF0000FF, str);
    return 1;
}
It's recommended to use ZCMD since you have to use only "params" instead of "cmdtext[number]". It seems you don't know how to use it correctly, plus the case is set to true so "/nopm" and "/NOPM" is the same.
Reply


Messages In This Thread
pm cmd problem - by GGW - 13.02.2014, 21:25
Re: pm cmd problem - by TheSnaKe - 13.02.2014, 21:27
Re: pm cmd problem - by GGW - 13.02.2014, 21:30
Re: pm cmd problem - by jakejohnsonusa - 13.02.2014, 21:33
Re: pm cmd problem - by GGW - 13.02.2014, 21:39
Re: pm cmd problem - by Mario' - 13.02.2014, 21:43
Re: pm cmd problem - by Konstantinos - 14.02.2014, 10:18

Forum Jump:


Users browsing this thread: 1 Guest(s)