SA-MP Forums Archive
PM - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: PM (/showthread.php?tid=103063)



PM - _ReloadeD_ - 18.10.2009

how i can do a PM command with that:

Код:
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
  	new s[128];
  format(s,sizeof(s),"Privet Masasge");
  ShowPlayerDialog(playerid,3,DIALOG_STYLE_LIST,"Massage::",s,"Send","Cancel");
  
	return 1;
}
help pliz


Re: PM - Gergo1352 - 18.10.2009

Use DIALOG_STYLE_INPUT instead of DIALOG_STYLE_LIST and detect the message with the OnDialogResponse callback.


Re: PM - _ReloadeD_ - 18.10.2009

but how i detect the clickedplayerid on OnDialogResponse??


Re: PM - Beaver07 - 18.10.2009

you can use something like

Код:
new ClickedPlayerID[MAX_PLAYERS];
then onplayerspawn

Код:
ClickedPlayerID[playerid] = -1; // -1 so it doesnt get a players id
Код:
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
  	new s[128];
  clickedplayerid = ClickedPlayerID[playerid]; 
  format(s,sizeof(s),"Privet Masasge");
  ShowPlayerDialog(playerid,3,DIALOG_STYLE_INPUT,"Enter A Message::",s,"Send","Cancel");
  
	return 1;
}
i'm sure you can figure out the rest


Re: PM - Gergo1352 - 18.10.2009

Quote:
Originally Posted by Beaver07
Код:
clickedplayerid = ClickedPlayerID[playerid];
It should be:

Код:
ClickedPlayerID[playerid] = clickedplayerid;



Re: PM - _ReloadeD_ - 18.10.2009

i want to do alist of commands when you click on player like:
Privet Massage
Player Stats

how i do that?


Re: PM - Think - 18.10.2009

Quote:
Originally Posted by HITMANBOY
i want to do alist of commands when you click on player like:
Privet Massage
Player Stats

how i do that?
The same as your first post:

ShowPlayerDialog(playerid,3,DIALOG_STYLE_INPUT,"Co mmands","Number 1\nNumber 2\nNumber 3\nNumber 4","Ok","Cancel");

Just look @ the wiki itll explain most of the scripting problems.


Re: PM - Gergo1352 - 18.10.2009

Quote:
Originally Posted by HITMANBOY
i want to do alist of commands when you click on player like:
Privet Massage
Player Stats

how i do that?
Well, make a main menu with DIALOG_STYLE_LIST. Then other dialogs can be created by clicking certain elements of the main menu. For example DIALOG_STYLE_INPUT for Private Message and DIALOG_STYLE_MSGBOX for Player Stats.


Re: PM - _ReloadeD_ - 18.10.2009

but how i do if i choose in the List Privet Massage it's open a new ShowPlayerDialog and if i choose on the list Give Cash it's open me another ShowPlayerDialog??


Re: PM - _ReloadeD_ - 18.10.2009

Quote:
Originally Posted by Gergo1352
Quote:
Originally Posted by HITMANBOY
i want to do alist of commands when you click on player like:
Privet Massage
Player Stats

how i do that?
Well, make a main menu with DIALOG_STYLE_LIST. Then other dialogs can be created by clicking certain elements of the main menu. For example DIALOG_STYLE_INPUT for Private Message and DIALOG_STYLE_MSGBOX for Player Stats.
can you give me exmple?


Re: PM - Beaver07 - 18.10.2009

this is what i use

Код:
new string[256],string2[256];
	new clickedplayer[MAX_PLAYER_NAME];
	ClickedPlayerID[playerid] = clickedplayerid;
  GetPlayerName(clickedplayerid, clickedplayer, sizeof(clickedplayer));
  format(string, sizeof(string), "Player %s (%d) Menu", clickedplayer,clickedplayerid);
  if (PlayerInfo[playerid][pAdmin] == 0)
	{
		format(string2, sizeof(string2), "Stats\nPersonal Message\nGive Money\n");
	}
  if (PlayerInfo[playerid][pAdmin] > 0)
	{
		format(string2, sizeof(string2), "Stats\nPersonal Message\nGive Money\nAdmin Menu");
  }
  ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, string, string2, "Select", "Cancel");
just want to point out that's just a small part of it


Quote:
Originally Posted by Gergo1352
Quote:
Originally Posted by Beaver07
Код:
clickedplayerid = ClickedPlayerID[playerid];
It should be:

Код:
ClickedPlayerID[playerid] = clickedplayerid;
also yes i forgot wrong way round


Re: PM - Gergo1352 - 18.10.2009

Quote:
Originally Posted by HITMANBOY
Quote:
Originally Posted by Gergo1352
Quote:
Originally Posted by HITMANBOY
i want to do alist of commands when you click on player like:
Privet Massage
Player Stats

how i do that?
Well, make a main menu with DIALOG_STYLE_LIST. Then other dialogs can be created by clicking certain elements of the main menu. For example DIALOG_STYLE_INPUT for Private Message and DIALOG_STYLE_MSGBOX for Player Stats.
can you give me exmple?
Example:

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{

if(dialogid == YOURDIALOG) // This is the main menu
{
  if(response)
  {

    if (listitem == 0)
    {
      // Show dialog PRIVATE MESSAGES
    }
    else if (listitem == 1)
    {
      // Show dialog PLAYER STATS
    }
    else if (listitem == 2)
    {
      // Show dialog GIVE CASH
    }
  
  }
}

  return 1;
}



Re: PM - _ReloadeD_ - 18.10.2009

how i use here:

Код:
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
	ClickedPlayer[playerid]=clickedplayerid;
  	new s[128];
  format(s,sizeof(s),"BLABLABLA");
  ShowPlayerDialog(playerid,3,DIALOG_STYLE_LIST,"Privet Massage",s,"Ok","Cancel);
	return 1;
}
how i add more stuff to the List


Re: PM - Gergo1352 - 18.10.2009

Quote:
Originally Posted by HITMANBOY
how i use here:

Код:
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
	ClickedPlayer[playerid]=clickedplayerid;
 	new s[128];
  format(s,sizeof(s),"BLABLABLA");
  ShowPlayerDialog(playerid,3,DIALOG_STYLE_LIST,"Privet Massage",s,"Ok","Cancel);
	return 1;
}
how i add more stuff to the List
Use \n for line braking.

For example:

Код:
Private Message\nPlayer Stats\nGive Cash



Re: PM - _ReloadeD_ - 18.10.2009

i do this:
Код:
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
	ClickedPlayer[playerid]=clickedplayerid;
  	new s[128];
  format(s,sizeof(s),"BLABLABLA");
  ShowPlayerDialog(playerid,3,DIALOG_STYLE_LIST,"Private Message\nPlayer Stats\nGive Cash",s,"Ok","Cancel");
	return 1;
}
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{

	
 	if(dialogid == 3) // This is the main menu
  {
  if(response)
  {
    if (listitem == 0)
    {
		new s[128];
    format(s,sizeof(s),"Privet Massage:");
    ShowPlayerDialog(playerid,3,DIALOG_STYLE_INPUT,"Massage:",s,"Ok","Cancel");
      new str2[128];
      new name[24];
      GetPlayerName(ClickedPlayer[playerid], name, sizeof(name));
      format(str,sizeof(str),"PM To %s [%d]: %s",name,ClickedPlayer[playerid],inputtext);
      SendClientMessage(playerid,COLOR_LIGHTBLUE,str);
      format(str2,sizeof(str2),"PM From %s [%d]: %s",GetName(playerid),playerid,inputtext);
      SendClientMessage(ClickedPlayer[playerid],COLOR_AQUA,str2);
      PlayerPlaySound(ClickedPlayer[playerid],1056,0.0,0.0,0.0);
    }
    else if (listitem == 1)
    {
      new s[128];
      format(s,sizeof(s),"Cash");
      ShowPlayerDialog(playerid,3,DIALOG_STYLE_INPUT,"Cash:",s,"Send","Cancel");
			GivePlayerMoney(playerid,350);
    }
    else if (listitem == 2)
    {
      // Show dialog GIVE CASH
    }

  }
}
  return 0;
}
it's print me only BLABLABLA why?


Re: PM - MenaceX^ - 18.10.2009

Seif has made something, find it.


Re: PM - _ReloadeD_ - 18.10.2009

someone help?


Re: PM - _ReloadeD_ - 19.10.2009

Up