#include <a_samp> #include "../include/gl_common.inc" #define COLOR_YELLOW 0xFFFF00AA //------------------------------------------------ public OnFilterScriptInit() { print("Private Message Script Loaded"); return 1; } //------------------------------------------------ public OnPlayerCommandText(playerid, cmdtext[]) { new cmd[256]; new tmp[256]; new Message[256]; new gMessage[256]; new pName[MAX_PLAYER_NAME+1]; new iName[MAX_PLAYER_NAME+1]; new idx; cmd = strtok(cmdtext, idx); // PM Command if(strcmp("/pm", cmd, true) == 0) { tmp = strtok(cmdtext,idx); if(!strlen(tmp) || strlen(tmp) > 5) { SendClientMessage(playerid,COLOR_YELLOW,"Usage: /pm (ID) (message)"); return 1; } new id = strval(tmp); gMessage = strrest(cmdtext,idx); if(!strlen(gMessage)) { SendClientMessage(playerid,COLOR_YELLOW,"Usage: /pm (ID) (message)"); return 1; } if(!IsPlayerConnected(id)) { SendClientMessage(playerid,COLOR_YELLOW,"/pm : You Entered a Wrong ID!"); return 1; } if(playerid != id) { GetPlayerName(id,iName,sizeof(iName)); GetPlayerName(playerid,pName,sizeof(pName)); format(Message,sizeof(Message),"PM Sent to %s(%d): %s",iName,id,gMessage); SendClientMessage(playerid,COLOR_YELLOW,Message); format(Message,sizeof(Message),"PM From %s(%d): %s",pName,playerid,gMessage); SendClientMessage(id,COLOR_YELLOW,Message); PlayerPlaySound(id,1085,0.0,0.0,0.0); printf("PM: %s",Message); } else { SendClientMessage(playerid,COLOR_YELLOW,"You Cannot Private Message Yourself."); } return 1; } return 0; }
#include <a_samp>
#include "../include/gl_common.inc"
#define COLOR_YELLOW 0xFFFF00AA
#define DIALOG_REPLY 50
new PlayerRecevied[MAX_PLAYERS];
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[128];
new tmp[128];
new idx;
cmd = strtok(cmdtext, idx);
if(!strcmp("/pm", cmd, true))
{
tmp = strtok(cmdtext,idx);
if(!strlen(tmp) || strlen(tmp) > 5)
return SendClientMessage(playerid,COLOR_YELLOW,"Usage: /pm (ID) (message)");
if(!strlen(strrest(cmdtext,idx)))
return SendClientMessage(playerid,COLOR_YELLOW,"Usage: /pm (ID) (message)");
if(!IsPlayerConnected(strval(tmp)))
return SendClientMessage(playerid,COLOR_YELLOW,"/pm : You Entered a Wrong ID!");
if(playerid != strval(tmp))
return SendClientMessage(playerid,COLOR_YELLOW,"You Cannot Private Message Yourself.");
PlayerRecevied[strval(tmp] = playerid;
PlayerPlaySound(strval(tmp),1085,0.0,0.0,0.0);
ShowPlayerDialog(playerid, DIALOG_REPLY, DIALOG_STYLE_INPUT, "~ New Message ~", strrest(cmdtext,idx), "Reply", "Okay");
return 1;
}
return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_REPLY)
{
if(response)
{
if(!strlen(inputtext))
{
SendClientMessage(playerid, -1,"||>> Put message !");
ShowPlayerDialog(playerid, DIALOG_REPLY, DIALOG_STYLE_INPUT, "~ New Message ~", strrest(cmdtext,idx), "Reply", "Okay");
return true;
}
ShowPlayerDialog(PlayerRecevied[playerid], DIALOG_REPLY, DIALOG_STYLE_INPUT, "~ New Message ~", inputtext, "Reply", "Okay");
}
}
return true;
}
And Reply!
pawn Код:
|
error 001: expected token: ",", but found "]" error 017: undefined symbol "cmdtext"
PlayerRecevied[strval(tmp)] = playerid;
ShowPlayerDialog(playerid, DIALOG_REPLY, DIALOG_STYLE_INPUT, "~ New Message ~", inputtext, "Reply", "Okay");