SA-MP Forums Archive
simple ayuda con sscanf... - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Español/Spanish (https://sampforum.blast.hk/forumdisplay.php?fid=29)
+---- Thread: simple ayuda con sscanf... (/showthread.php?tid=422727)



simple ayuda con sscanf... - OTACON - 15.03.2013

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.


Respuesta: simple ayuda con sscanf... - Fluid016 - 15.03.2013

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])


Respuesta: simple ayuda con sscanf... - OTACON - 15.03.2013

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.


Respuesta: simple ayuda con sscanf... - JustBored - 15.03.2013

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н.


Respuesta: simple ayuda con sscanf... - Parka - 15.03.2013

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


Respuesta: simple ayuda con sscanf... - OTACON - 15.03.2013

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;
}



Respuesta: simple ayuda con sscanf... - Parka - 15.03.2013

entonces en ves de true coloca false


Respuesta: simple ayuda con sscanf... - OTACON - 15.03.2013

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 .


Respuesta: simple ayuda con sscanf... - TheChaoz - 15.03.2013

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


Respuesta: simple ayuda con sscanf... - Jovazxc - 16.03.2013

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