Problem with command
#1

This command is supposed to be made at a certain place which is the blackmarket, to sell some items you must have and gain some money by selling them, the thing is it always returns this message.

USAGE: /sell [wallet/cellphone/creditcard/mp3]");


pawn Code:
if(strcmp(cmd,"/sell",true)==0)
    {
    if(!IsPlayerInRangeOfPoint(playerid, 1.5 , 2379.1194,-655.6750,127.8510)) return SendClientMessage(playerid,RED, " You are not at the black market. ");
    {
    if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /sell [wallet/cellphone/creditcard/mp3]");
    {
    if(PlayerData[playerid][MP3] == 1 && !strcmp(tmp,"mp3"))
    {
        SetTimer("illegaljob", 1000*1200, false); // Set a timer of 1000 miliseconds (1 second)
        PlayerData[playerid][MP3] = 0;
        PlayerData[playerid][illegaljob] = 1;
        GivePlayerMoney(playerid, 200);
        SendClientMessage(playerid, YELLOW, " You have sold to the black market a credit card for 200$ American Dollars.");
        return 1;
        }
    if(PlayerData[playerid][Cellphone] == 1 && strcmp(tmp,"cellphone",true) == 0)
        {
        PlayerData[playerid][Cellphone] = 0;
        PlayerData[playerid][illegaljob] = 1;
        SetTimer("illegaljob", 1000*1200, false); // Set a timer of 1000 miliseconds (1 second)
        GivePlayerMoney(playerid, 250);
        SendClientMessage(playerid, YELLOW, " You have sold to the black market a credit card for 250$ American Dollars.");
        return 1;
        }
    if(PlayerData[playerid][Wallet] == 1 && !strcmp(tmp,"wallet"))
        {
        SetTimer("illegaljob", 1000*1200, false); // Set a timer of 1000 miliseconds (1 second)
        PlayerData[playerid][Wallet] = 0;
        PlayerData[playerid][illegaljob] = 1;
        GivePlayerMoney(playerid, 400);
        SendClientMessage(playerid, YELLOW, " You have sold to the black market a credit card for 400$ American Dollars.");
        return 1;
        }
    if(PlayerData[playerid][Creditcard] == 1 && !strcmp(tmp,"Creditcard"))
        {
        SetTimer("illegaljob", 1000*1200, false); // Set a timer of 1000 miliseconds (1 second)
        PlayerData[playerid][Creditcard] = 0;
        PlayerData[playerid][illegaljob] = 1;
        GivePlayerMoney(playerid, 400);
        SendClientMessage(playerid, YELLOW, " You have sold to the black market a credit card for 400$ American Dollars.");
        return 1;
        }
        else
        {
        SendClientMessage(playerid, RED, " You didn't type a right item-name or you don't have that item.");
        }
    return 1;
    }
}
}
Reply
#2

bump
Reply
#3

1) stop bumping ( your allowed to bump once 2 days )
2) next time post your prob in 1 topic and not double topic in the same time
3) whats the prob
Reply
#4

the problem is the command always returns this message even if i have the the item

USAGE: /sell [wallet/cellphone/creditcard/mp3]");
Reply
#5

y are you using strcmp?
convert it to zcmd...its alot better
Reply
#6

pawn Code:
if(strcmp(cmd,"/sell",true)==0)
{
    if(!IsPlayerInRangeOfPoint(playerid, 1.5 , 2379.1194,-655.6750,127.8510)) return SendClientMessage(playerid,RED, " You are not at the black market. ");
    if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /sell [wallet/cellphone/creditcard/mp3]");
    if(PlayerData[playerid][MP3] == 1 && !strcmp(tmp,"mp3"))
    {
        SetTimer("illegaljob", 1000*1200, false); // Set a timer of 1000 miliseconds (1 second)
        PlayerData[playerid][MP3] = 0;
        PlayerData[playerid][illegaljob] = 1;
        GivePlayerMoney(playerid, 200);
        SendClientMessage(playerid, YELLOW, " You have sold to the black market a credit card for 200$ American Dollars.");
        return 1;
    }
    if(PlayerData[playerid][Cellphone] == 1 && strcmp(tmp,"cellphone",true) == 0)
    {
        PlayerData[playerid][Cellphone] = 0;
        PlayerData[playerid][illegaljob] = 1;
        SetTimer("illegaljob", 1000*1200, false); // Set a timer of 1000 miliseconds (1 second)
        GivePlayerMoney(playerid, 250);
        SendClientMessage(playerid, YELLOW, " You have sold to the black market a credit card for 250$ American Dollars.");
        return 1;
    }
    if(PlayerData[playerid][Wallet] == 1 && !strcmp(tmp,"wallet"))
    {
        SetTimer("illegaljob", 1000*1200, false); // Set a timer of 1000 miliseconds (1 second)
        PlayerData[playerid][Wallet] = 0;
        PlayerData[playerid][illegaljob] = 1;
        GivePlayerMoney(playerid, 400);
        SendClientMessage(playerid, YELLOW, " You have sold to the black market a credit card for 400$ American Dollars.");
        return 1;
        }
    if(PlayerData[playerid][Creditcard] == 1 && !strcmp(tmp,"Creditcard"))
    {
        SetTimer("illegaljob", 1000*1200, false); // Set a timer of 1000 miliseconds (1 second)
        PlayerData[playerid][Creditcard] = 0;
        PlayerData[playerid][illegaljob] = 1;
        GivePlayerMoney(playerid, 400);
        SendClientMessage(playerid, YELLOW, " You have sold to the black market a credit card for 400$ American Dollars.");
        return 1;
    }
    SendClientMessage(playerid, RED, " You didn't type a right item-name or you don't have that item.");
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)