SA-MP Forums Archive
Problem with command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Problem with command (/showthread.php?tid=484077)



Problem with command - yancarlos4500 - 29.12.2013

Hello i have a problem with my command
pawn Код:
CMD:vender(playerid, params[])
{
        if(isnull(params))
        {
            SendClientMessageEx(playerid, 0x008FECFF, "Modo de uso: {FFFFFF}/vender [Item]");
            if(Info[playerid][pMember] == 9 || Info[playerid][pLeader] == 9)
            {
            SendClientMessageEx(playerid, 0x008FECFF, "Informaciуn: {FFFFFF}pala, maza, ghumo, motosierra, extinguidor");
        }
        return 1;
    }

if(strcmp(params, "rz", true) == 0)
{
    new string[200], giveplayerid, amount, price;
    if(sscanf(params, "ddd", giveplayerid, amount, price)) return SendClientMessageEx(playerid, 0x008FECFF, "Modo de uso: {FFFFFF}/vender rz [ID] [cantidad] [precio]");

    if(amount < 0 || amount > 9999999)
    {
        SendClientMessageEx(playerid, COLOR_DIALOGO1, "ERROR: {FFFFFF}Los valores no pueden ser mayores a 9999999 monedas ni menores a 1.");
        return 1;
    }
    if(IsPlayerConnected(playerid))
    {
        if(IsPlayerConnected(giveplayerid))
        {
            if(ProxDetectorS(8.0, playerid, giveplayerid))
            {
                if(giveplayerid == playerid) return SendClientMessageEx(playerid, 0x008FECFF, "Informaciуn: {FFFFFF}No puedes venderte a ti mismo.");
                format(string, sizeof(string), "[Ventas] {FFFFFF}Le ofreciste {F5FF00}%s {FFFFFF}Monedas Rz a {F5FF00}%s {FFFFFF}por {00CC00}$%d", amount, GetPlayerNameEx(giveplayerid), price);
                SendClientMessageEx(playerid, 0x00CC00FF, string);
                format(string, sizeof(string), "%s {FFFFFF}te ofrece {F5FF00}%s {FFFFFF}Monedas Rz por {00CC00}$%d, {FFFFFF}para aceptarla usa {F5FF00}/aceptar rz", GetPlayerNameEx(playerid), amount, price);
                SendClientMessageEx(giveplayerid, 0xF5FF00FF, string);
                FOffer[giveplayerid] = playerid;
                FPrice[giveplayerid] = price;
                return FAmount[giveplayerid] = amount;
            }
            else return SendClientMessageEx(playerid, COLOR_DIALOGO1, "ERROR: {FFFFFF}Ese jugador estб lejos de ti.");
        }
    }
    else SendClientMessageEx(playerid, COLOR_DIALOGO1, "ERROR: {FFFFFF}ID Invбlida.");
    return 1;
}

else SendClientMessageEx(playerid, COLOR_DIALOGO1, "ERROR: {FFFFFF}Has ingresado un comando incorrecto, usa /vender [Item]");
return 1;
}
When I type the command with like this /vender rz 2 250 100 it tells me Error has ingresado un comando incorrecto, usa /vender [item]


Re: Problem with command - ToiletDuck - 29.12.2013

Try this
pawn Код:
CMD:vender(playerid, params[])
{
    new choice[3];
    if(sscanf(params, "s[3]",choice))
    {
        SendClientMessageEx(playerid, 0x008FECFF, "Modo de uso: {FFFFFF}/vender [Item]");
        if(Info[playerid][pMember] == 9 || Info[playerid][pLeader] == 9)
        {
            SendClientMessageEx(playerid, 0x008FECFF, "Informaciуn: {FFFFFF}pala, maza, ghumo, motosierra, extinguidor");
        }
        return 1;
    }

    if(!strcmp(choice, "rz", false, 2))
    {
        new string[200], giveplayerid, amount, price;
        if(sscanf(choice, "s[3]ddd",choice ,giveplayerid, amount, price)) return SendClientMessageEx(playerid, 0x008FECFF, "Modo de uso: {FFFFFF}/vender rz [ID] [cantidad] [precio]");

        if(amount < 0 || amount > 9999999)
        {
            SendClientMessageEx(playerid, COLOR_DIALOGO1, "ERROR: {FFFFFF}Los valores no pueden ser mayores a 9999999 monedas ni menores a 1.");
            return 1;
        }
        if(IsPlayerConnected(playerid))
        {
            if(IsPlayerConnected(giveplayerid))
            {
                if(ProxDetectorS(8.0, playerid, giveplayerid))
                {
                    if(giveplayerid == playerid) return SendClientMessageEx(playerid, 0x008FECFF, "Informaciуn: {FFFFFF}No puedes venderte a ti mismo.");
                    format(string, sizeof(string), "[Ventas] {FFFFFF}Le ofreciste {F5FF00}%s {FFFFFF}Monedas Rz a {F5FF00}%s {FFFFFF}por {00CC00}$%d", amount, GetPlayerNameEx(giveplayerid), price);
                    SendClientMessageEx(playerid, 0x00CC00FF, string);
                    format(string, sizeof(string), "%s {FFFFFF}te ofrece {F5FF00}%s {FFFFFF}Monedas Rz por {00CC00}$%d, {FFFFFF}para aceptarla usa {F5FF00}/aceptar rz", GetPlayerNameEx(playerid), amount, price);
                    SendClientMessageEx(giveplayerid, 0xF5FF00FF, string);
                    FOffer[giveplayerid] = playerid;
                    FPrice[giveplayerid] = price;
                    return FAmount[giveplayerid] = amount;
                }
                else return SendClientMessageEx(playerid, COLOR_DIALOGO1, "ERROR: {FFFFFF}Ese jugador estб lejos de ti.");
            }
        }
        else SendClientMessageEx(playerid, COLOR_DIALOGO1, "ERROR: {FFFFFF}ID Invбlida.");
        return 1;
    }

    else SendClientMessageEx(playerid, COLOR_DIALOGO1, "ERROR: {FFFFFF}Has ingresado un comando incorrecto, usa /vender [Item]");
    return 1;
}



Re: Problem with command - Mattakil - 29.12.2013

Did you try removing the line?


Re: Problem with command - yancarlos4500 - 29.12.2013

Quote:
Originally Posted by ToiletDuck
Посмотреть сообщение
Try this
pawn Код:
CMD:vender(playerid, params[])
{
    new choice[3];
    if(sscanf(params, "s[3]",choice))
    {
        SendClientMessageEx(playerid, 0x008FECFF, "Modo de uso: {FFFFFF}/vender [Item]");
        if(Info[playerid][pMember] == 9 || Info[playerid][pLeader] == 9)
        {
            SendClientMessageEx(playerid, 0x008FECFF, "Informaciуn: {FFFFFF}pala, maza, ghumo, motosierra, extinguidor");
        }
        return 1;
    }

    if(!strcmp(choice, "rz", false, 2))
    {
        new string[200], giveplayerid, amount, price;
        if(sscanf(choice, "s[3]ddd",choice ,giveplayerid, amount, price)) return SendClientMessageEx(playerid, 0x008FECFF, "Modo de uso: {FFFFFF}/vender rz [ID] [cantidad] [precio]");

        if(amount < 0 || amount > 9999999)
        {
            SendClientMessageEx(playerid, COLOR_DIALOGO1, "ERROR: {FFFFFF}Los valores no pueden ser mayores a 9999999 monedas ni menores a 1.");
            return 1;
        }
        if(IsPlayerConnected(playerid))
        {
            if(IsPlayerConnected(giveplayerid))
            {
                if(ProxDetectorS(8.0, playerid, giveplayerid))
                {
                    if(giveplayerid == playerid) return SendClientMessageEx(playerid, 0x008FECFF, "Informaciуn: {FFFFFF}No puedes venderte a ti mismo.");
                    format(string, sizeof(string), "[Ventas] {FFFFFF}Le ofreciste {F5FF00}%s {FFFFFF}Monedas Rz a {F5FF00}%s {FFFFFF}por {00CC00}$%d", amount, GetPlayerNameEx(giveplayerid), price);
                    SendClientMessageEx(playerid, 0x00CC00FF, string);
                    format(string, sizeof(string), "%s {FFFFFF}te ofrece {F5FF00}%s {FFFFFF}Monedas Rz por {00CC00}$%d, {FFFFFF}para aceptarla usa {F5FF00}/aceptar rz", GetPlayerNameEx(playerid), amount, price);
                    SendClientMessageEx(giveplayerid, 0xF5FF00FF, string);
                    FOffer[giveplayerid] = playerid;
                    FPrice[giveplayerid] = price;
                    return FAmount[giveplayerid] = amount;
                }
                else return SendClientMessageEx(playerid, COLOR_DIALOGO1, "ERROR: {FFFFFF}Ese jugador estб lejos de ti.");
            }
        }
        else SendClientMessageEx(playerid, COLOR_DIALOGO1, "ERROR: {FFFFFF}ID Invбlida.");
        return 1;
    }

    else SendClientMessageEx(playerid, COLOR_DIALOGO1, "ERROR: {FFFFFF}Has ingresado un comando incorrecto, usa /vender [Item]");
    return 1;
}
It Doesn't work


Re: Problem with command - yancarlos4500 - 29.12.2013

bump


Re: Problem with command - yancarlos4500 - 29.12.2013

please help


Re: Problem with command - yancarlos4500 - 30.12.2013

PLEASE