Duda sobre id Player...
#1

Buenas a Todos, Quiera saber como podria obtener el id de los jugadores, segun la letra inicial, ejemplo:

/comando O

otacon [ID:0]
otaconcito [ID:1]
otaku [ID:2]
etc...

desde ya muchas Gracias.
Reply
#2

pawn Код:
if(!sscanf(params, "u", params[0]))
{
//funciones
}
O tambiйn puedes usar strmid y GetPlayerName junto a un bucle. (for)
Reply
#3

Quote:
Originally Posted by JustBored
Посмотреть сообщение
pawn Код:
if(!sscanf(params, "u", params[0]))
{
//funciones
}
O tambiйn puedes usar strmid y GetPlayerName junto a un bucle. (for)
lo primero no sirve, ya ke es el nombre o id y yo kiero obtener el id con la primer letra nada mas.
Reply
#4

Quote:
Originally Posted by JustBored
Посмотреть сообщение
pawn Код:
if(!sscanf(params, "u", params[0]))
{
//funciones
}
O tambiйn puedes usar strmid y GetPlayerName junto a un bucle. (for)
No sirve, tiene que usar strcmp, strlen y una funciуn que ordena el score tu solo lo modificas para que ordene las ids.
Reply
#5

Quote:
Originally Posted by GROVE22
Посмотреть сообщение
No sirve, tiene que usar strcmp, strlen y una funciуn que ordena el score tu solo lo modificas para que ordene las ids.
como esta ? https://sampforum.blast.hk/showthread.php?pid=1792412#pid1792412
Reply
#6

Quote:
Originally Posted by bytytus
Посмотреть сообщение
No creo que no hace falta, el bucle corre de menor al mayor, al aparecer te va aparecer el menor y luego el mayor, ahora lo hago, dame unos minutos.

EDIT:

pawn Код:
for(new i = 0; i <= GetMaxPlayers(); i ++)
    {
        if(IsPlayerConnected(i))
        {
            new nombre[256];
            GetPlayerName(i, nombre, 25);
            if(strcmp(nombre, "o", true, 1) == 0)
            {
                new info[256];
                format(info, sizeof(info), "%s[ID:%d]", nombre, i);
                SendClientMessage(playerid, -1, info);
            }
        }
    }
Fijate, deberнa funcionar, no lo pude probar porque estoy solo.
Reply
#7

Quote:
Originally Posted by GROVE22
Посмотреть сообщение
No creo que no hace falta, el bucle corre de menor al mayor, al aparecer te va aparecer el menor y luego el mayor, ahora lo hago, dame unos minutos.

EDIT:

pawn Код:
for(new i = 0; i <= GetMaxPlayers(); i ++)
    {
        if(IsPlayerConnected(i))
        {
            new nombre[256];
            GetPlayerName(i, nombre, 25);
            if(strcmp(nombre, "o", true, 1) == 0)
            {
                new info[256];
                format(info, sizeof(info), "%s[ID:%d]", nombre, i);
                SendClientMessage(playerid, -1, info);
            }
        }
    }
Fijate, deberнa funcionar, no lo pude probar porque estoy solo.
¬¬ eso lo se hacer, no me entendieron.
eso al poner O saldra el nombre y id del ke puso O.

lo ke yo kiero hacer es poner O y salgan todosl os nombres de todos los players con inicial O como el ejemplo ke di primero.

pero creo ke ya tengo una idea, creo ke tendre ke crear una funcion como isNumeric pero en vez de numero con las iniciales del alfabeto y GetPlayerName.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)