Need Help with Pm command..:-/
#1

I need help with /pm command

I am i suppose to add hmm.. such as if someone PM it should be like this They can either enter their (ID) or (Partoftheirname) or fullname..

Here is the code :
Код:
CMD:pm(playerid, cmdtext[])
{
    new
        idx = strfind(cmdtext, " ", true);
    if((cmdtext[0] == EOS) || ((cmdtext[0] == '\1') && (cmdtext[1] == EOS)) || (idx == -1)) {
        SendClientMessage(playerid,COLOR_LIGHTBLUE,"Usage: /pm [ID] [MESSAGE]");
        return 1;
    }
    if(cmdtext[idx + 1] == EOS) {
        SendClientMessage(playerid,COLOR_LIGHTBLUE,"Usage: /pm [ID] [MESSAGE]");
        return 1;
    }
    cmdtext[idx++] = EOS;
    new
        id = strval(cmdtext);
    if(!IsPlayerConnected(id)) {
        SendClientMessage(playerid,COLOR_LIGHTBLUE,"/pm : Wrong Player ID");
        return 1;
    }
    if(playerid == id) {
        SendClientMessage(playerid,COLOR_YELLOW,"You cannot PM yourself.");
        return 1;
    }
    new
        string[256];
    GetPlayerName(id, string, MAX_PLAYER_NAME);
    format(string, sizeof string, "[PM] Message send to %s(%d): %s", string, id, cmdtext[idx]);
    SendClientMessage(playerid, COLOR_LIGHTBLUE, string);

    GetPlayerName(playerid, string, MAX_PLAYER_NAME);
    format(string, sizeof string, "[OOCPM] Message from %s(%d): %s", string, playerid, cmdtext[idx]);
    SendClientMessage(id, COLOR_LIGHTBLUE, string);
    PlayerPlaySound(id, 1057, 0.0, 0.0, 0.0);

    printf("PM: %s", cmdtext[idx]);
    return 1;
}
Reply


Messages In This Thread
Need Help with Pm command..:-/ - by Desi_Dude - 26.09.2012, 11:39
Re: Need Help with Pm command..:-/ - by Jarnu - 26.09.2012, 12:00
Re: Need Help with Pm command..:-/ - by Glint - 26.09.2012, 12:06
Re: Need Help with Pm command..:-/ - by Desi_Dude - 26.09.2012, 13:03
Re: Need Help with Pm command..:-/ - by Cxnnor - 26.09.2012, 13:07
Re: Need Help with Pm command..:-/ - by Jarnu - 26.09.2012, 13:19
Re: Need Help with Pm command..:-/ - by Desi_Dude - 12.10.2012, 12:41

Forum Jump:


Users browsing this thread: 2 Guest(s)