SA-MP Forums Archive
How select players in dialog - 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: How select players in dialog (/showthread.php?tid=346260)



How select players in dialog - liinor - 27.05.2012

I tried to make code which sends message to player who i select from dialog but it doesn't work. :I
Can anyone help me?
pawn Код:
new msgline[256];
new strtext[256];
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
GetPlayerName(i, psame, sizeof(psame));
format(msgline,sizeof(msgline),"%s",psame);
haxedplayer[playerid] = i;
strcat(strtext, "\n");
strcat(strtext, msgline);
   
}
   
}
ShowPlayerDialog(playerid,723,DIALOG_STYLE_LIST,"Bank hack program",strtext,"Option 1", "Option 2");
}
pawn Код:
switch(dialogid == 723) // Lookup the dialogid
{
case 1:
{
if(!response)
{
SendClientMessage(playerid, 0xFF0000FF, "You cancelled.");
return 1; // We processed it
}
 SendClientMessage(haxedplayer[playerid],COLOR_RED,"LOOOL");
}
}



Re: How select players in dialog - FalconX - 27.05.2012

Mate, what exactly you are looking for? Well, you want the list of the online players? and then if a player clicks on that player he sends a PM or a message he wants? if that so, you can use the following functions:-

OnPlayerClickPlayer(playerid, clickedplayerid, source);

When you press tab you can see the online players right? you can use that.

If you are not looking for such function then please explain well with the proper indentation of your script.

Regards FalconX


Re: How select players in dialog - liinor - 27.05.2012

Quote:
Originally Posted by FalconX
Посмотреть сообщение
Mate, what exactly you are looking for? Well, you want the list of the online players? and then if a player clicks on that player he sends a PM or a message he wants? if that so, you can use the following functions:-

OnPlayerClickPlayer(playerid, clickedplayerid, source);

When you press tab you can see the online players right? you can use that.

If you are not looking for such function then please explain well with the proper indentation of your script.

Regards FalconX
I don't mean that and i have already that kind of pm system but When clicks player name in this dialog it should send that ClientMessage "looool" to player which was clicked in that dialog.


Re: How select players in dialog - mati233 - 28.05.2012

I hope that helps:
PHP код:
new dialoglist[1024], name[32];
new 
ii=0;
for(new 
i=0i<MAX_PLAYERSi++){
    if(
IsPlayerConnected(i)){
        
GetPlayerName(inamesizeof(name));
        
format(dialoglist,sizeof(dialoglist),"%s\n%s",dialoglist,name);
        
haxedplayer[ii]=i;
        
ii+=1;
    }
}
return 
ShowPlayerDialog(playerid,723,DIALOG_STYLE_LIST,"Bank hack program",dialoglist,"Option 1""Option 2");
switch(
dialogid==723){
    if(!
response) return SendClientMessage(playerid0xFF0000FF"You cancelled.");
    else return 
SendClientMessage(haxedplayer[listitem],COLOR_RED,"LOOOL");




Re: How select players in dialog - Jefff - 28.05.2012

1.
Код:
new strtext[1024];
for(new i=0; i<MAX_PLAYERS; i++)
{
	if(IsPlayerConnected(i))
	{
		GetPlayerName(i, psame, sizeof(psame));
		format(strtext,sizeof(strtext),"%s%s\n",strtext,psame);
	}
}
ShowPlayerDialog(playerid,723,DIALOG_STYLE_LIST,"Bank hack program",strtext,"Option 1", "Option 2");


stock ReturnID(nick[])
{
	new d,name[24];
	while(d != MAX_PLAYERS)
	{
		if(IsPlayerConnected(d))
		{
			GetPlayerName(d,name,24);
			if(!strcmp(nick,name)) return d;
		}
		d++;
	}
	return INVALID_PLAYER_ID;
}

switch(dialogid) // Lookup the dialogid
{
	case 723:
	{
		if(!response) SendClientMessage(playerid, 0xFF0000FF, "You cancelled."); // We processed it
		else{
			new ID = ReturnID(inputtext);
			if(ID == INVALID_PLAYER_ID) SendClientMessage(playerid,COLOR_RED,"Player is not connected");
			else SendClientMessage(ID,COLOR_RED,"LOOOL");
		}
	}
}
2.
Код:
new strtext[1024],cnt;
new haxedplayer[MAX_SLOTS][MAX_SLOTS];
for(new i=0; i<MAX_PLAYERS; i++)
{
	if(IsPlayerConnected(i))
	{
		GetPlayerName(i, psame, sizeof(psame));
		format(msgline,sizeof(msgline),"%s%s\n",strtext,psame);
		haxedplayer[playerid][cnt] = i;
		cnt++;
	}
}
ShowPlayerDialog(playerid,723,DIALOG_STYLE_LIST,"Bank hack program",strtext,"Option 1", "Option 2");

switch(dialogid) // Lookup the dialogid
{
	case 723:
	{
		if(!response) SendClientMessage(playerid, 0xFF0000FF, "You cancelled."); // We processed it
		else SendClientMessage(haxedplayer[playerid][listitem],COLOR_RED,"LOOOL");
	}
}
Your choice ;d


Re: How select players in dialog - liinor - 28.05.2012

Thank you all for helping me.