Problem with command.
#1

pawn Код:
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;
    }
}
}
The problem is that, even if i got the items, the command returns this message: USAGE: /sell [wallet/cellphone/creditcard/mp3]");

ALWAYS.
Reply
#2

bump ey this is an emergency give me a solution lol
Reply
#3

Sorry but, the indentation on your code is quite messy so I'll have to take a while trying to understand how this works.

Edit: It *could* be to do with the fact that after returning the SendClientMessage for your script, you then proceed to have another curly brace for the if statement? Would it not be more suited to an if {} else {} logic block?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)