PM Dialogs?!
#1

Hey... I need help. I'm building a roleplay server, and there is a post office. There is a pickup(briefcase). When you walk into it, I need it to show a dialog that asks for the ID you are going to send the message to, then after that one is closed it will ask for the Message you are going to send. Then, I need it to send a message to the other player, like a basic /pm command would. I don't have much ANY code whatsoever, because what I tried didn't work. The only code I can give out is the OnPlayerPickupPickup code.
Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
	if(pickupid == postoffice)
	{
     //attempt to show dialogs here...
	}
	return 1;
}
Reply
#2

Top of script:

Код:
new SendToID[MAX_PLAYERS];
Between the { and }:

Код:
ShowPlayerDialog(playerid,dialogid,DIALOG_STYLE_INPUT,"PM","Type in the playerid you want to send a message to:","Send","Cancel");
In OnDialogResponse:

Код:
if(dialogid == dialogid)
{
if(!response) return 1;
if(!IsNumeric(inputtext)) return ShowPlayerDialog(playerid,dialogid,DIALOG_STYLE_INPUT,"PM","Error: ID must be a number!\nType in the playerid you want to send a message to:","Send","Cancel");
if(!IsPlayerConnected(inputtext)) return ShowPlayerDialog(playerid,dialogid,DIALOG_STYLE_INPUT,"PM","Error: Player offline!\nType in the playerid you want to send a message to:","Send","Cancel");
SendToID[playerid] = inputtext;
new string[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(inputtext,name,sizeof(name));
format(string,sizeof(string),"Alright, type the message you want to send to %s",name);
ShowPlayerDialog(playerid,dialogid,DIALOG_STYLE_INPUT,"PM",string,"Send","Cancel");
}
if(dialogid == dialogid) // DIALOG ID OF ^
{
if(!response) 
{
SendToID[playerid] = -1;
return 1;
}
new string[256];
new name1[MAX_PLAYER_NAME];
new name2[MAX_PLAYER_NAME];
GetPlayerName(playerid,name1,sizeof(name1));
GetPlayerName(SendToID[playerid],name2,sizeof(name2));
format(string,sizeof(string),"PM from %s: %s",name1,inputtext);
SendClientMessage(SendToID[playerid],color,string);
format(string,sizeof(string),"PM sent to %s: %s",name2,inputtext);
SendClientMessage(playerid,color,string);
}
Reply
#3

I think
pawn Код:
SendToID[playerid] = inputtext;
Might need to be
pawn Код:
SendToID[playerid] = strval(inputtext);
Reply
#4

Quote:
Originally Posted by Baked-Banana
I think
pawn Код:
SendToID[playerid] = inputtext;
Might need to be
pawn Код:
SendToID[playerid] = strval(inputtext);
Thanks much. It helped aot!
Quote:
Originally Posted by Coole[AG
]
Top of script:

Код:
new SendToID[MAX_PLAYERS];
Between the { and }:

Код:
ShowPlayerDialog(playerid,dialogid,DIALOG_STYLE_INPUT,"PM","Type in the playerid you want to send a message to:","Send","Cancel");
In OnDialogResponse:

Код:
if(dialogid == dialogid)
{
if(!response) return 1;
if(!IsNumeric(inputtext)) return ShowPlayerDialog(playerid,dialogid,DIALOG_STYLE_INPUT,"PM","Error: ID must be a number!\nType in the playerid you want to send a message to:","Send","Cancel");
if(!IsPlayerConnected(inputtext)) return ShowPlayerDialog(playerid,dialogid,DIALOG_STYLE_INPUT,"PM","Error: Player offline!\nType in the playerid you want to send a message to:","Send","Cancel");
SendToID[playerid] = inputtext;
new string[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(inputtext,name,sizeof(name));
format(string,sizeof(string),"Alright, type the message you want to send to %s",name);
ShowPlayerDialog(playerid,dialogid,DIALOG_STYLE_INPUT,"PM",string,"Send","Cancel");
}
if(dialogid == dialogid) // DIALOG ID OF ^
{
if(!response) 
{
SendToID[playerid] = -1;
return 1;
}
new string[256];
new name1[MAX_PLAYER_NAME];
new name2[MAX_PLAYER_NAME];
GetPlayerName(playerid,name1,sizeof(name1));
GetPlayerName(SendToID[playerid],name2,sizeof(name2));
format(string,sizeof(string),"PM from %s: %s",name1,inputtext);
SendClientMessage(SendToID[playerid],color,string);
format(string,sizeof(string),"PM sent to %s: %s",name2,inputtext);
SendClientMessage(playerid,color,string);
}
Thanks... I've been coding for quite a bit of time, but have taken alot of time off since 0.2x
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)