How select players in dialog
#1

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");
}
}
Reply
#2

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
Reply
#3

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.
Reply
#4

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");

Reply
#5

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
Reply
#6

Thank you all for helping me.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)