Posts: 4,930
Threads: 467
Joined: Dec 2010
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.
Posts: 4,930
Threads: 467
Joined: Dec 2010
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.
Posts: 4,930
Threads: 467
Joined: Dec 2010
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
Posts: 4,930
Threads: 467
Joined: Dec 2010
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.