20.01.2015, 00:54
Here is the code: http://pastebin.com/Nr6Dibby
I don't know why the message only appears if it's small
I don't know why the message only appears if it's small
CMD:pm(playerid,params[])
{
new text[128],targetid,string[128],sendername[MAX_PLAYER_NAME],giveplayer[MAX_PLAYER_NAME];
if(sscanf(params, "us[128]", targetid, text)) SendClientMessage(playerid, COLOR_GREY, "Usage: /pm [playerid] [text]");//if player uses command wrong
else
{
if (playerid == targetid) return SendClientMessage(playerid, COLOR_GREY, "SERVER: You cannot pm to yourself.");//if player try to pm self
if(IsPlayerConnected(targetid))//check if player online
{
format(sendername, sizeof(sendername), "%s", PlayerName(playerid));
format(giveplayer, sizeof(giveplayer), "%s", PlayerName(targetid));
NameSpace(sendername);
NameSpace(giveplayer);
format(string, sizeof(string), ">> PM from %s[%d]: %s <<", sendername, playerid, text);//change format if you want
SendClientMessage(targetid, 0xF9F900FF, string);
format(string, sizeof(string), ">> PM sent to %s: %s <<", giveplayer, text);//change format if you want
SendClientMessage(playerid, 0xE5C43EAA, string);
PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
}
}
return 1;
}
stock NameSpace(str[])
{
new strl;
strl=strlen(str);
while(strl--) {
if(str[strl]=='_') str[strl]=' ';
}
return 0;
}