simple ayuda con sscanf...
#1

Buenas a todos, me pueden decir ke esta mal aca ke no me responde al poner las opciones?.

pawn Код:
COMMAND:test(playerid, params[]) {
    if(sscanf(params[0], "s[10]", params[0])) return SendClientMessage(playerid, -1, "   Escribe: /test [test1/test2]");
    if(sscanf(params[0], "s[10]", "test1")) {
        SendClientMessage(playerid, -1, "   Seleccionaste el test 1");
    }
    if(sscanf(params[0], "s[10]", "test2")) {
        SendClientMessage(playerid, -1, "   Seleccionaste el test 2");
    }
    return true;
}
Desde ya muchas Gracias.
Reply
#2

pawn Код:
COMMAND:test(playerid, params[]) {
    if(sscanf(params[0], "s[10]", params[0])) return SendClientMessage(playerid, -1, "   Escribe: /test [test1/test2]");
    if(sscanf(params[0], "s[10]", "test1")) {
        SendClientMessage(playerid, -1, "   Seleccionaste el test 1");
    }
    if(sscanf(params[0], "s[10]", "test2")) {
        SendClientMessage(playerid, -1, "   Seleccionaste el test 2");
    }
    return true;
}
CREO que en ves de sscanf(params[0], "s[10]", params[0]) irнa sscanf(params, "s[10]", params[0])
Reply
#3

Quote:
Originally Posted by GROVE22
Посмотреть сообщение
pawn Код:
COMMAND:test(playerid, params[]) {
    if(sscanf(params[0], "s[10]", params[0])) return SendClientMessage(playerid, -1, "   Escribe: /test [test1/test2]");
    if(sscanf(params[0], "s[10]", "test1")) {
        SendClientMessage(playerid, -1, "   Seleccionaste el test 1");
    }
    if(sscanf(params[0], "s[10]", "test2")) {
        SendClientMessage(playerid, -1, "   Seleccionaste el test 2");
    }
    return true;
}
CREO que en ves de sscanf(params[0], "s[10]", params[0]) irнa sscanf(params, "s[10]", params[0])
justamente lo acabe de testea eso y no , tampoco anda :S

EDIT:
tu decias el primer if, no eso tambien esta bien, se pone params[0] para no pone ! delante para chekear si no escribe nada, y ese responde son los otros ke no responde :S.
Reply
#4

pawn Код:
COMMAND:test(playerid, params[]) {
    if(sscanf(params[0], "s[10]", params[0])) return SendClientMessage(playerid, -1, "   Escribe: /test [test1/test2]");
    if(sscanf(params, "s[10]", params[0])) {
    if(strcmp(params[0], "test1", true))
    {
        SendClientMessage(playerid, -1, "   Seleccionaste el test 1");
    }
    else if(strcmp(params[0], "test2", true)){
        SendClientMessage(playerid, -1, "   Seleccionaste el test 2");
    }
    return true;
}
Creo que serнa asн.
Reply
#5

porque no usas mejor strcmp o es que intentas probar otro uso con sscanf ??
Reply
#6

yo lo keria hacer con sscanf pero bueh..

Funciono asi, pero ahora al poner la opcion 1 me sale el mensaje de la opcion 2 o_O
y no esta mal el SendClientMessage, podran ver.

pawn Код:
COMMAND:test(playerid, params[]) {
    if(sscanf(params[0], "s[10]", params[0])) return SendClientMessage(playerid, -1, "   Escribe: /test [test1/test2]");
    if(strcmp(params[0], "test1", true)) {
        SendClientMessage(playerid, -1, "   Seleccionaste el test 1");
    }
    else if(strcmp(params[0], "test2", true)) {
        SendClientMessage(playerid, -1, "   Seleccionaste el test 2");
    }
    return true;
}
Reply
#7

entonces en ves de true coloca false
Reply
#8

Quote:
Originally Posted by cesar_******
Посмотреть сообщение
entonces en ves de true coloca false
lo intente, y sigue igual.

WFT!, me salen arrevez o_O y no son los SendClientMessage es Raro

EDIT:

Ya Solucione, Gracias a Todos .
Reply
#9

Sscanf no es una funcion que sirva para comparar cadenas de texto. Por lo que no puedes usarla para dicho fin.
Reply
#10

Para los que no se dieron cuenta del error es que no puso == 0 al final del strcmp, por eso salнan al revйs
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)