First insert these codes on top of your script
#include <a_samp>
#include <sscanf>
#include <zcmd>
And then insert this codes in bottom of your script or in your CMDs section.
CMD:pm(playerid, params[])
{
new id, msgs[100], string[140], sender[MAX_PLAYER_NAME], target[MAX_PLAYER_NAME];
if(sscanf(params, "us", id, msgs)) return SendClientMessage(playerid, Your Color, "CMD: /pm [target]");
if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, Your Color, "ERROR: Player not found");
else
{
GetPlayerName(playerid, sender, sizeof(sender));
GetPlayerName(id, target, sizeof(target));
format(string, sizeof(string), "%s : %s", sender, msgs);
SendClientMessage(id, Your Color, string);
format(string, sizeof(string), "Sent to %s: %s", target, msgs);
SendClientMessage(playerid, Your Color, string);
}
return 1;
}
Okay i'll explain it to you,
These codes
CMD:pm(playerid, params[])They'll scan the player's command, if the players aren't fill the CMD form, the server gonna send error message or tell the player about the structures of this command.
{
new id, msgs[100], string[140], sender[MAX_PLAYER_NAME], target[MAX_PLAYER_NAME];
if(sscanf(params, "us", id, msgs)) return SendClientMessage(playerid, Your Color, "CMD: /pm [target]");
And then these codes
if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, Your Color, "ERROR: Player not found");These codes mean it'll process the command, if the player's target isn't connect, the server'll send an error message, otherwise if the player's target was connected it'll continue the process with scanning player's name and the target's name, eventually the server will send the message to each player
else
{
GetPlayerName(playerid, sender, sizeof(sender));
GetPlayerName(id, target, sizeof(target));
format(string, sizeof(string), "%s : %s", sender, msgs);
SendClientMessage(id, Your Color, string);
format(string, sizeof(string), "Sent to %s: %s", target, msgs);
SendClientMessage(playerid, Your Color, string);
}
That's all for today, thank you for visiting my site, and sorry for my bad english and my another mistakes.
Best regards, Ryu a.K.a Raveronze
Waw so helpful..
BalasHapusthx for the info.
Wah ngeri banget ya
BalasHapus