PM help
#3

pawn Код:
CMD:pm(playerid, params[])
{
    new message[128], str[145], id, Name[MAX_PLAYER_NAME] // There's no need to have 2 names, as you can just use 1
  // You also added to new str, you on'y need 1.
    if(sscanf(params, "us[128]", id, message)) // When using s in sscanf put the length in [] next to it
    {
        SendClientMessage(playerid, 0xFF0000FF, "USAGE:/pm <id/name> <Message>"); // You did not end this with ");
        // You also don't need to put the same color at the start, as you already did that in SendClientMessage
        return 1;
    }
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: This Player Is Not Connected."); // Same thing as above
    if(playerid != id) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: You Cannot Send PM Message To Your Self."); // Same thing as above
    {
        GetPlayerName(id, Name, sizeof(Name));
        format(str, sizeof(str), "PM To %s (ID: %d): %s", Name, id, message);
        SendClientMessage(playerid, 0xFF0000FF, str);
        GetPlayerName(playerid, Name, sizeof (Name));
        format(str, sizeof(str), "PM From %s (ID %d): %s", Name, playerid, message);
        SendCilentMessage(id, 0xFF0000FF, str);
    }
    return 1;
}
Reply


Messages In This Thread
PM help - by YanLanger - 27.08.2014, 16:50
Re: PM help - by Stanford - 27.08.2014, 16:54
Re: PM help - by Stinged - 27.08.2014, 16:55
Re: PM help - by JordanDoughty - 27.08.2014, 16:56
Re: PM help - by YanLanger - 27.08.2014, 16:56
Re: PM help - by JordanDoughty - 27.08.2014, 16:58
Re: PM help - by YanLanger - 27.08.2014, 16:58
Re: PM help - by Stanford - 27.08.2014, 16:59
Re: PM help - by JordanDoughty - 27.08.2014, 17:00
Re: PM help - by YanLanger - 27.08.2014, 17:01

Forum Jump:


Users browsing this thread: 2 Guest(s)