Comando /est & /est [ID] ?
#1

Hola, queria hacer un comando que cuando un jugador escriba /est le muestre sus estadisticas pero si escribe /est [ID] le muestre las estadisticas del ID del jugador. Es posible hacer eso en ZCMD? No quiero el comando, ya yo los tengo, solo quiero un ejemplo de como hacer un comando tener 2 funciones.

Gracias de antemano.
Reply
#2

pawn Код:
CMD:stats(playerid, params[])
{
    new Target, iString[300]; // definimos al otro jugador y el string que vamos a usar.
    if(!sscanf(params, "u", Target)) { // el parбmetro del otro jugador
    if(Target == INVALID_PLAYER_ID) return SCM(playerid, COLOR_RED, "Jugador desconectado."); // si el jugador estб desconectado..
    format(iString, sizeof(iString), "Kills: %d", pInfo[Target][pKills]); // Target porque es del otro jugador.
    //ShowPlayerDialog(playerid, 5551, DIALOG_STYLE_MSGBOX, " ", iString, "OK", "");
        SendClientMessage(playerid, -1, iString); // aquн muestra las estadнsticas del ID que pongas
    } else {
    format(iString, sizeof(iString), "Kills: %d",pInfo[playerid][pKills]); // aquн playerid porque son las del propio jugador.
    //ShowPlayerDialog(playerid, 5551, DIALOG_STYLE_MSGBOX, " ", iString, "OK", "");
        SendClientMessage(playerid, -1, iString); // aquн muestra las tuyas. Si pones /stats tambiйn salen, no es necesario poner /stats (tu id)..
    }
    return 1;
}
Reply
#3

Quote:
Originally Posted by Loox
Посмотреть сообщение
pawn Код:
CMD:stats(playerid, params[])
{
    new Target, iString[300]; // definimos al otro jugador y el string que vamos a usar.
    if(!sscanf(params, "u", Target)) { // el parбmetro del otro jugador
    if(Target == INVALID_PLAYER_ID) return SCM(playerid, COLOR_RED, "Jugador desconectado."); // si el jugador estб desconectado..
    format(iString, sizeof(iString), "Kills: %d", pInfo[Target][pKills]); // Target porque es del otro jugador.
    //ShowPlayerDialog(playerid, 5551, DIALOG_STYLE_MSGBOX, " ", iString, "OK", "");
        SendClientMessage(playerid, -1, iString); // aquн muestra las estadнsticas del ID que pongas
    } else {
    format(iString, sizeof(iString), "Kills: %d",pInfo[playerid][pKills]); // aquн playerid porque son las del propio jugador.
    //ShowPlayerDialog(playerid, 5551, DIALOG_STYLE_MSGBOX, " ", iString, "OK", "");
        SendClientMessage(playerid, -1, iString); // aquн muestra las tuyas. Si pones /stats tambiйn salen, no es necesario poner /stats (tu id)..
    }
    return 1;
}
gracias, no pense que fuera tan simple, ahora lo pruebo.

EDIT:
Si funciono, +rep
Reply
#4

Tambiйn puedes hacer una funciуn si quieres hacer /stats y /astats (ID).

Serнa algo asн.

Код:
forward Stats(playerid, targetid); public Stats(playerid, targetid) {
new string[256];
format(string, sizeof(string), "VARIABLE: %d", VARIABLE[targetid]);
SendClientMessage(playerid, color, string);
}
Ya tienes un sistema con el cuбl puedes hacer un comando por ejemplo, /stats y otro que sea /check, haciendo un sscanf en el segundo, nada en el primero. Suerte si te sirviу.
Reply
#5

Quote:
Originally Posted by Stront
Посмотреть сообщение
Tambiйn puedes hacer una funciуn si quieres hacer /stats y /astats (ID).

Serнa algo asн.

Код:
forward Stats(playerid, targetid); public Stats(playerid, targetid) {
new string[256];
format(string, sizeof(string), "VARIABLE: %d", VARIABLE[targetid]);
SendClientMessage(playerid, color, string);
}
Ya tienes un sistema con el cuбl puedes hacer un comando por ejemplo, /stats y otro que sea /check, haciendo un sscanf en el segundo, nada en el primero. Suerte si te sirviу.
no se los demas, pero yo me confundiste terriblemente.
Reply
#6

Recuerda cambiar los strings, de seguro no lo enlazas con tus variables.
Reply
#7

Quote:
Originally Posted by elvago
Посмотреть сообщение
Recuerda cambiar los strings, de seguro no lo enlazas con tus variables.
+1

hizo un lнo con ese code
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)