15.12.2010, 19:57
Quote:
@Benjo, you're creating a string which is 65 characters long, 500 times which is a total waste of CPU/Memory and people could just spam the command all day long and imagine the lag you get.
|
Anyway Larsey, regarding your last post, yes that is possible. Bear with me as I'm pretty rusty with dialogs:
Defines at the top:
pawn Код:
#define DIALOG_LOGIN_BLUE 1 // This is the dialogid
#define BLUE_PASSWORD "qwerty1" // changethis
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case(DIALOG_LOGIN_BLUE):
if(!response) { /* user cancelled */ } else
{
if(strcmp(inputtext, BLUE_PASSWORD, false, strlen(BLUE_PASSWORD)) == 0)
{
SendClientMessageToAll(0xDEEE20FF, "|_List of blue players_|");
new names[MAX_PLAYER_NAME], string[44];
for(new i=0; i<MAX_PLAYERS; i++)
{
if(GetPlayerColor(i) == 0x00137FAA) //0x00137FFAA = Blue color
{
GetPlayerName(i, names, sizeof(names));
format(string, sizeof(string), "%s(%d)",names ,playerid);
SendClientMessage(playerid, 0x7F0037AA, string);
}
}
} else {
SendClientMessage(playerid, 0xDEEE20FF, "Incorrect password.");
}
}
default:{printf("DEBUG: Undefined dialogid.");}
}
}
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/blue", cmdtext, true, 5) == 0)
{
ShowPlayerDialog(playerid, DIALOG_LOGIN_BLUE, DIALOG_STYLE_INPUT, "Authentication", "Please type the password for the blue team.", "Ok", "Cancel");
return 1;
}
return 0;
}