/pm command - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /pm command (
/showthread.php?tid=345010)
/pm command -
twitteR - 23.05.2012
I need a /pm command for 0.3e. Also tell where to put it xD.. I'm a newbie scripter..
Re: /pm command -
Edward156 - 23.05.2012
pawn Код:
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, 0xFF0000FF, "Usage: /pm <id> <message>");
return 1;
}
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: Player not connected");
if(playerid == id) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: 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, 0xFF0000FF, str);
format(str, sizeof(str), "PM From %s(ID %d): %s", Name1, playerid, str2);
SendClientMessage(id, 0xFF0000FF, str);
}
return 1;
}
Make sure you're using ZCMD.
Re: /pm command -
HighPitchedVoice - 23.05.2012
Can you make it for dcmd please?
Re: /pm command - Jarnu - 23.05.2012
pawn Код:
dcmd_pm(playerid,params[])
{
if(!strlen(params)) return
SendClientMessage(playerid, orange, "Usage: /pm [PlayerID]");
PMplayer1 = strval(params);
if(PMplayer1 == playerid) return
SendClientMessage(playerid, red, "ERROR: You can't send PM to yourself!");
if(!(IsPlayerConnected(PMplayer1) && PMplayer1 != INVALID_PLAYER_ID)) return
SendClientMessage(playerid, red, "ERROR: Player not Connected!");
new string[128];
GetPlayerName(PMplayer1, PmReceiver, sizeof(PmReceiver));
format(string,sizeof(string),"PM To: \"%s(%d)\" \n\nType the message to send:", PmReceiver, PMplayer1);
ShowPlayerDialog(playerid,DIALOG_TYPE_PM,DIALOG_STYLE_INPUT,"PrivateMessage",string,"Send!","Cancel");
return 1;
}
here it is with DCMD
Re: /pm command -
HighPitchedVoice - 23.05.2012
Ops! I meant strcmp
Re: /pm command - Jarnu - 23.05.2012
Add this on Top Of Your Gamemode..
pawn Код:
#define DIALOG_TYPE_PM 7000
#define red 0xFF0000AA
#define orange 0xFF9900AA
new PmReceiver[MAX_PLAYER_NAME];
new PMplayer1;
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/pm", cmdtext, true, 10) == 0)
{
if(!strlen(params)) return
SendClientMessage(playerid, orange, "Usage: /pm [PlayerID]");
PMplayer1 = strval(params);
if(PMplayer1 == playerid) return
SendClientMessage(playerid, red, "ERROR: You can't send PM to yourself!");
if(!(IsPlayerConnected(PMplayer1) && PMplayer1 != INVALID_PLAYER_ID)) return
SendClientMessage(playerid, red, "ERROR: Player not Connected!");
new string[128];
GetPlayerName(PMplayer1, PmReceiver, sizeof(PmReceiver));
format(string,sizeof(string),"PM To: \"%s(%d)\" \n\nType the message to send:", PmReceiver, PMplayer1);
ShowPlayerDialog(playerid,DIALOG_TYPE_PM,DIALOG_STYLE_INPUT,"PrivateMessage",string,"Send!","Cancel");
return 1;
}
return 0;
}
i Hope it will Work ^^
Re: /pm command -
HighPitchedVoice - 23.05.2012
I don't want it as a dialog :S