[Ayuda] Con comando (parametros)
#4

Quote:
Originally Posted by JGomez97
Посмотреть сообщение
no sirve man, pongo la cantidad y el precio y me sale "Opcion invalida!"
Prueba esto:
pawn Код:
CMD:vender(playerid, params[])
{
    new string[144], option[128], null name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, MAX_PLAYER_NAME);
    if(sscanf(params, "s[128]i", option, null)) return SendClientMessage(playerid, -1, "/vender (opciones: crack).");

    if(strcmp(option, "crack", true) == 0)
    {
        if(sscanf(params, "{s}uii", cmdid, cantidad, precio)) return SendClientMessage(playerid,-1,"Uso: /vender crack [id] [cantidad] [precio]");

        if(cmdid == playerid) return SendClientMessage(playerid,-1,"No puedes venderte a ti mismo.");
        if(IsPlayerNPC(cmdid)) return SendClientMessage(playerid, COLOR_ROJO, "Esa id es de un NPC!");
        if(!IsPlayerConnected(cmdid) || cmdid == INVALID_PLAYER_ID) return SendClientMessage(playerid,-1,"ID Invalido.");
        new Float:Pos[3];
        GetPlayerPos(cmdid, Pos[0], Pos[1], Pos[2]);
        if(!IsPlayerInRangeOfPoint(playerid, 6.0, Pos[0], Pos[1], Pos[2])) return SendClientMessage(playerid,-1,"Esta persona esta muy lejos.");
        if(Informacion[playerid][Crack] < cantidad) return SendClientMessage(playerid,-1,"No tienes suficiente crack para vender");
        if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,-1,"Necesitas estar afuera del vehiculo.");
        new oname[MAX_PLAYER_NAME];
        GetPlayerName(cmdid, oname, sizeof(oname));
        format(msg, sizeof(msg), "Le as ofrecido %i gramo(s) de crack a %s por el precio de $%i.",cantidad,oname,precio);
        print(string);
        Teofrecieron[cmdid] = 1;
        SetPVarInt(cmdid, "Persona", playerid);
        SetPVarInt(cmdid, "Cantidad", cantidad);
        SetPVarInt(cmdid, "Precio", precio);
        format(string2, sizeof(string2), "%s te a ofrecido %i gramo(s) de crack por $%i. Usa /aceptar crack si aceptas.", name,cantidad,precio);
        SendClientMessage(playerid,-1, msg);
        SendClientMessage(cmdid,-1, string2);
    }
    else SendClientMessage(playerid, -1, "Opcion invalida!");
    return 1;
}
Reply


Messages In This Thread
[Ayuda] Con comando (parametros) - by JGomez97 - 17.05.2015, 19:37
Re: [Ayuda] Con comando (parametros) - by SickAttack - 17.05.2015, 21:32
Re: [Ayuda] Con comando (parametros) - by JGomez97 - 17.05.2015, 21:56
Re: [Ayuda] Con comando (parametros) - by SickAttack - 17.05.2015, 22:01
Re: [Ayuda] Con comando (parametros) - by JGomez97 - 17.05.2015, 22:07
Respuesta: [Ayuda] Con comando (parametros) - by Darken3 - 17.05.2015, 22:14

Forum Jump:


Users browsing this thread: 1 Guest(s)