/pm 1 hello how are you this is testing private message man.
/pm 1 hello how are yo
thats because the string in which message is storing is too short increase its size of the string in which u are storing pm message
|
CMD:pm(playerid, params[])
{
new str[256], str2[256], id, Name1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME];
if(sscanf(params, "us", id, str2))
{
SendClientMessage(playerid, -1, "USE: {FFFF00}/pm {FFFFFF}<id> <message>");
return 1;
}
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, red,"ERROR: {FFFFFF} Player not connected");
if(playerid == id) return SendClientMessage(playerid, red,"ERROR: {FFFFFF} You cannot pm yourself!");
{
GetPlayerName(playerid, Name1, sizeof(Name1));
GetPlayerName(id, Name2, sizeof(Name2));
format(str, sizeof(str), "PM To %s [ID %d]: %s", Name2, id, str2);
SendClientMessage(playerid, yellow, str);
format(str, sizeof(str), "PM From %s [ID %d]: %s", Name1, playerid, str2);
SendClientMessage(id, yellow, str);
}
if(playerid == id) return SendClientMessage(playerid, red,"ERROR: {FFFFFF} You cannot pm yourself!");
{
GetPlayerName(playerid, Name1, sizeof(Name1));
CMD:pm(playerid, params[])
{
new string[128],msg[128], id, Name1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME];
if(sscanf(params, "us[128]", id, msg)) //Using 's' in sscanf is to signify a string, you have to signify the size aswell though.. so "us[128]"
{
return SendClientMessage(playerid, -1, "USE: {FFFF00}/pm {FFFFFF}<id> <message>");
}
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, red,"ERROR: {FFFFFF} Player not connected");
if(playerid == id) return SendClientMessage(playerid, red,"ERROR: {FFFFFF} You cannot pm yourself!");
GetPlayerName(playerid, Name1, sizeof(Name1));
GetPlayerName(id, Name2, sizeof(Name2));
format(str, sizeof(str), "PM To %s [ID %d]: %s", Name2, id, msg);
SendClientMessage(playerid, yellow, str);
format(str, sizeof(str), "PM From %s [ID %d]: %s", Name1, playerid, msg);
SendClientMessage(id, yellow, str);
return 1;
}