[Ajuda] Comando para aparecer o id sу aparece o id de quem digitou;
#1

Pessoal, estou precisando de uma ajuda, este comando abaixo ele й para mostrar o ID do jogador indicado, mas sу estб mostrando o id de quem digitou o comando, exemplo:

Fulano (ID: 14);
Fulana (ID: 1);
Fudкncio (ID: 4),

Mas na verdade estб assim, por exemplo, se eu sou Smiley, com ID: 10, ficarб assim:

Fulano (ID: 10);
Fulana (ID: 10);
Fudкncio (ID: 10),

O comando й este a seguir:

HTML Code:
COMMAND:comboiomembros(playerid, params[])
{
	// Setup local variables
	new Name[24], MemberList[2000], Convoy;

	// Send the command to all admins so they can see it
	SendAdminText(playerid, "/comboiomembros", params);

	// Check if the player has logged in
	if (APlayerData[playerid][LoggedIn] == true)
	{
		// Check if the member is in a convoy
		if (APlayerData[playerid][InConvoy] == true)
		{
			// Get the convoyID of the member
			Convoy = APlayerData[playerid][ConvoyID];

			// Loop through all members
			for (new i; i < CONVOY_MAX_MEMBERS; i++)
			{
			    if (AConvoys[Convoy][Members][i] != -1) // Check if this member-spot is occupied
				{
					// Get the name of the member
					GetPlayerName(AConvoys[Convoy][Members][i], Name, sizeof(Name));
					// Add the membernames to the list
					format(MemberList, 2000, "{B9D3EE}%s%s (id: {FFFFFF}%i{B9D3EE})\n", MemberList, Name, playerid);
				}
			}

			// Show the dialog
			ShowPlayerDialog(playerid, DialogConvoyMembers, DIALOG_STYLE_MSGBOX, "Membros do comboio", MemberList, "OK", "");
		}
		else
		    SendClientMessage(playerid, 0xFF0000FF, "Vocк nгo й um membro de um comboio.");
	}
	else
	    return 0;

	// Let the server know that this was a valid command
	return 1;
}
Por favor, me ajudem.. nгo sei o que estб acontecendo. )=
Reply
#2

Quote:
Originally Posted by AndersonAq
View Post
Pessoal, estou precisando de uma ajuda, este comando abaixo ele й para mostrar o ID do jogador indicado, mas sу estб mostrando o id de quem digitou o comando, exemplo:

Fulano (ID: 14);
Fulana (ID: 1);
Fudкncio (ID: 4),

Mas na verdade estб assim, por exemplo, se eu sou Smiley, com ID: 10, ficarб assim:

Fulano (ID: 10);
Fulana (ID: 10);
Fudкncio (ID: 10),

O comando й este a seguir:

HTML Code:
COMMAND:comboiomembros(playerid, params[])
{
	// Setup local variables
	new Name[24], MemberList[2000], Convoy;

	// Send the command to all admins so they can see it
	SendAdminText(playerid, "/comboiomembros", params);

	// Check if the player has logged in
	if (APlayerData[playerid][LoggedIn] == true)
	{
		// Check if the member is in a convoy
		if (APlayerData[playerid][InConvoy] == true)
		{
			// Get the convoyID of the member
			Convoy = APlayerData[playerid][ConvoyID];

			// Loop through all members
			for (new i; i < CONVOY_MAX_MEMBERS; i++)
			{
			    if (AConvoys[Convoy][Members][i] != -1) // Check if this member-spot is occupied
				{
					// Get the name of the member
					GetPlayerName(AConvoys[Convoy][Members][i], Name, sizeof(Name));
					// Add the membernames to the list
					format(MemberList, 2000, "{B9D3EE}%s%s (id: {FFFFFF}%i{B9D3EE})\n", MemberList, Name, playerid);
				}
			}

			// Show the dialog
			ShowPlayerDialog(playerid, DialogConvoyMembers, DIALOG_STYLE_MSGBOX, "Membros do comboio", MemberList, "OK", "");
		}
		else
		    SendClientMessage(playerid, 0xFF0000FF, "Vocк nгo й um membro de um comboio.");
	}
	else
	    return 0;

	// Let the server know that this was a valid command
	return 1;
}
Por favor, me ajudem.. nгo sei o que estб acontecendo. )=
Tente usar isto:

Code:
stock GetPlayerID(name[]) {
    new id = -1;
    for(new i; i < MAX_PLAYERS; i++) {
        if(IsPlayerConnected(i)) {
            if(!strcmp(name, GetPlayerName_(i), false)) {
                id = i;
                break;
            }
        }
    }
    if(id == -1) return 0;
    return id;
}

stock GetPlayerName_(id) {
    new name[25];
    if(IsPlayerConnected(id)) GetPlayerName(id, name, sizeof(name));
    return name;
}
O "playerid" sempre darб o ID de quem digitou, acredito eu.. Espero ter ajudado..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)