SA-MP Forums Archive
[DUDA]Zcmd y 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: [DUDA]Zcmd y Sscanf (/showthread.php?tid=523187)



[DUDA]Zcmd y Sscanf - lucotaku1 - 01.07.2014

Bueno tengo este cmd

pawn Код:
new cmd[128];

if (strcmp(cmd, "/skin", true, 11)==0)
        {
            cmd = strtok(cmdtext, idx);
                if(!strlen(cmd))
                {
                SendClientMessage(playerid, 0xFFFFFFAA, "Usa: /Skin [ID DEL SKIN]");
                        return 1;
            }
            new param2=strval(cmd);
            if(param2<7)
            {
                SendClientMessage(playerid, 0xFFFFFFAA, "Su Skin Debe Ser De 7 Y 299");
                        return 1;
                }
            if(param2==8||param2==42||param2==65||param2==74||param2==86||param2==208||param2==289) //||74||86||208||289)
            {
                SendClientMessage(playerid, 0xFFFFFFAA, "Este Numero De Skin es Invalido");
                        return 1;
                }
                if(param2>264 && param2<274)
            {
                SendClientMessage(playerid, 0xFFFFFFAA, "Este Numero De Skin es Invalido");
                        return 1;
                }
                if(param2>299)
            {
                SendClientMessage(playerid, 0xFFFFFFAA, "Skin Deve Ser De 7 Y 299");
                        return 1;
                }
            SetPlayerSkin(playerid, param2);
            return 1;
        }
Yo quiero transformarlo a ZCMD (eso es facil) pero tambien quiero usar Sscanf para no usar strtok.No se usar muy bien sscanf


Re: [DUDA]Zcmd y Sscanf - Schocc - 01.07.2014

Aquн estб la documentaciуn para estudiar sobre sscanf ...

e.g
pawn Код:
CMD:skinid(playerid, params[]){
    new tmpVarSkin;

    if (sscanf(params,"d", tmpVarSkin))
        return SendClientMessage(playerid, 0xFFFFFFAA, "Usa: /Skin [ID DEL SKIN]");

    if (tmpVarSkin == 8 ||
        tmpVarSkin == 42 ||
        tmpVarSkin == 65 ||
        tmpVarSkin == 74 ||
        tmpVarSkin == 86 ||
        tmpVarSkin == 208 ||
        tmpVarSkin == 289)
    {
        SendClientMessage(playerid, 0xFFFFFFAA, "Este Numero De Skin es Invalido");
        return 1;
    }
   
    if (tmpVarSkin > 264 && tmpVarSkin < 274)
    {
        SendClientMessage(playerid, 0xFFFFFFAA, "Este Numero De Skin es Invalido");
        return 1;
    }
    if (tmpVarSkin > 299)
    {
        SendClientMessage(playerid, 0xFFFFFFAA, "Skin Deve Ser De 7 Y 299");
        return 1;
    }
    SetPlayerSkin(playerid, tmpVarSkin);
    return 1;
}



Re: [DUDA]Zcmd y Sscanf - lucotaku1 - 01.07.2014

Quote:
Originally Posted by Schocc
Посмотреть сообщение
Aquн estб la documentaciуn para estudiar sobre sscanf ...

e.g
pawn Код:
CMD:skinid(playerid, params[]){
    new tmpVarSkin;

    if (sscanf(params,"d", tmpVarSkin))
        return SendClientMessage(playerid, 0xFFFFFFAA, "Usa: /Skin [ID DEL SKIN]");

    if (tmpVarSkin == 8 ||
        tmpVarSkin == 42 ||
        tmpVarSkin == 65 ||
        tmpVarSkin == 74 ||
        tmpVarSkin == 86 ||
        tmpVarSkin == 208 ||
        tmpVarSkin == 289)
    {
        SendClientMessage(playerid, 0xFFFFFFAA, "Este Numero De Skin es Invalido");
        return 1;
    }
   
    if (tmpVarSkin > 264 && tmpVarSkin < 274)
    {
        SendClientMessage(playerid, 0xFFFFFFAA, "Este Numero De Skin es Invalido");
        return 1;
    }
    if (tmpVarSkin > 299)
    {
        SendClientMessage(playerid, 0xFFFFFFAA, "Skin Deve Ser De 7 Y 299");
        return 1;
    }
    SetPlayerSkin(playerid, tmpVarSkin);
    return 1;
}
Gracias,le echare una mirada a la documentacion!