Bot as normal player -
blackwave - 05.03.2011
Everyone should know you can put a bot on the server through a filterscript and npc recording file. But the bot isn't shown on the online players list. The question is if could I make the bot as normal player, which would be shown on the online player list, and on the my dialog list, using:
or
pawn Код:
for(new v; v < MAX_PLAYERS; v++)
{
if(IsPlayerConnected(v)) ...
}
Thanks.
Re: Bot as normal player - [L3th4l] - 05.03.2011
Use the foreach version. But try this one instead:
pawn Код:
foreach(Character, i)
{
// Code
}
Character = Players + Bots
Player = Players
Bot = Bots
Re: Bot as normal player -
blackwave - 05.03.2011
Thx. But do you know how can I make each list item from dialog as listitem option, which would return the info from the player chosen?
pawn Код:
dcmd_allip(playerid, params[])
{
#pragma unused params
new string[300];
foreach(Character, i)
{
format(string,sizeof(string),""#red" \n%s (id: %d) | "#green"Ip: %s\n",GetMyName(i),i,GetMyIp(i));
}
return ShowPlayerDialog(playerid,IP_DIALOG,DIALOG_STYLE_LIST,""#red"IP "#green"List",string,"Ok","");
}
I've tried the switching on dialog, but it just shows all online Character 'i':
pawn Код:
if(dialogid == IP_DIALOG)
{
foreach(Character, i)
{
switch(i)
{
case 0 .. 500: printf("%s (id: %d)",GetMyName(i),i);
}
}
}
Re: Bot as normal player - rjjj - 05.03.2011
Quote:
Originally Posted by blackwave
Thx. But do you know how can I make each list item from dialog as listitem option, which would return the info from the player chosen?
pawn Код:
dcmd_allip(playerid, params[]) { #pragma unused params new string[300]; foreach(Character, i) { format(string,sizeof(string),""#red" \n%s (id: %d) | "#green"Ip: %s\n",GetMyName(i),i,GetMyIp(i)); } return ShowPlayerDialog(playerid,IP_DIALOG,DIALOG_STYLE_LIST,""#red"IP "#green"List",string,"Ok",""); }
I've tried the switching on dialog, but it just shows all online Character 'i':
pawn Код:
if(dialogid == IP_DIALOG) { foreach(Character, i) { switch(i) { case 0 .. 500: printf("%s (id: %d)",GetMyName(i),i); } } }
|
So, you can use
strins function to do this, look:
pawn Код:
dcmd_allip(playerid, params[])
{
#pragma unused params
new SuperString[5000];
foreach(Character, i)
{
strins(SuperString,PlayerIPData(i),strlen(SuperString),sizeof(SuperString));
}
return ShowPlayerDialog(playerid,IP_DIALOG,DIALOG_STYLE_LIST,""#red"IP "#green"List",SuperString,"Ok","");
}
//And, in the end of your gamemode:
stock PlayerIPData(playerid)
{
new txt[128];
format(txt,128,""#red" \n%s (id: %d) | "#green"Ip: %s\n",GetMyName(playerid),playerid,GetMyIp(playerid));
return txt;
}
I hope that i have helped
Re: Bot as normal player -
Gh0sT_ - 05.03.2011
5000 for string? o_O
Re: Bot as normal player - rjjj - 05.03.2011
Quote:
Originally Posted by Gh0sT_
5000 for string? o_O
|
Yes, because the strins function will add the text of the ip,name and id of each the player to the variable

.
I read ******'s tutorial about 256 cells, but it is necessary in this case.
I think that an if statement + IsPlayerConnected function would be excellent in the loop to do not make the string much bigger without reasons
Re: Bot as normal player -
blackwave - 05.03.2011
Dude, let me explain again for see if you can understand.
The command Allip would show all player name/IP (online players). On a dialog, you can click on the listitem. There, I wanted to make the listitem clicked return the info about the player which was on this listitem clicked.
Example:
Код:
Dialog:
1. BOT
2. ME
// And I click on "ME". It had to show anything I want about the clicked player, according what I put on the switch listitem function. Hope have understood.
Re: Bot as normal player -
Mauzen - 05.03.2011
There is no, and there will never be a legal method to show bots on the online player list and to count them as real players.
https://sampforum.blast.hk/showthread.php?tid=232838
Re: Bot as normal player -
blackwave - 05.03.2011
but what about my last question? is that possible? it's above you
Re: Bot as normal player -
blackwave - 06.03.2011
Dude, please read..
I want a command which would show all online players/bots (whatever) on dialog, and on OnDialogResponse callback, and each player which is on the dialog, would be a listitem (Dialog), which I could click on this item and show player info (anything I could add)