27.08.2014, 16:55
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;
}