#1

I want to know what's wrong with this command, when i type /sell and any of the options which is mp3, wallet, cellphone and creditcard it says unknown command

I know this is the problem :

}
SendClientMessage(playerid,RED, "You don't have a MP3.");

}
SendClientMessage(playerid,RED, "You don't have a Cellphone.");
}
SendClientMessage(playerid,RED, "You don't have a Wallet.");
}
SendClientMessage(playerid,RED, "You don't have a Credit-card.");
}
}

But what is the correct formula ?


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)
    {
    if(!strcmp(tmp,"mp3"))
    {
        SetTimer("illegaljob", 1000*1200, false); // Set a timer of 1000 miliseconds (1 second)
        PlayerData[playerid][MP3] = 0;
        GivePlayerMoney(playerid, 200);
        SendClientMessage(playerid, YELLOW, " You have sold the black market a credit card for 200$ American Dollars");
        return 1;
        }
    if(PlayerData[playerid][Cellphone] == 1)
    {
    if(!strcmp(tmp,"cellphone"))
        {
        PlayerData[playerid][Cellphone] = 0;
        SetTimer("illegaljob", 1000*1200, false); // Set a timer of 1000 miliseconds (1 second)
        GivePlayerMoney(playerid, 250);
        SendClientMessage(playerid, YELLOW, " You have sold the black market a credit card for 250$ American Dollars");
        return 1;
        }
    if(PlayerData[playerid][Wallet] == 1)
    {
    if(!strcmp(tmp,"wallet"))
        {
        SetTimer("illegaljob", 1000*1200, false); // Set a timer of 1000 miliseconds (1 second)
        PlayerData[playerid][Wallet] = 0;
        GivePlayerMoney(playerid, 400);
        SendClientMessage(playerid, YELLOW, " You have sold the black market a credit card for 400$ American Dollars");
        return 1;
        }
    if(PlayerData[playerid][Creditcard] == 1)
    {
    if(!strcmp(tmp,"Creditcard"))
        {
        SetTimer("illegaljob", 1000*1200, false); // Set a timer of 1000 miliseconds (1 second)
        PlayerData[playerid][Creditcard] = 0;
        GivePlayerMoney(playerid, 400);
        SendClientMessage(playerid, YELLOW, " You have sold the black market a credit card for 400$ American Dollars");
        return 1;
        }
        else
        {
        SendClientMessage(playerid, RED, " You didn't type a right item-name.");
        }
    return 1;
    }
 }
    SendClientMessage(playerid,RED, "You don't have a MP3.");
   
 }
    SendClientMessage(playerid,RED, "You don't have a Cellphone.");
 }
    SendClientMessage(playerid,RED, "You don't have a Wallet.");
 }
    SendClientMessage(playerid,RED, "You don't have a Credit-card.");
 }
 }
Reply
#2

Why are you checking if it "Is not" the string found?

Try changing

!strcmp

to

strcmp
Reply
#3

Quote:
Originally Posted by Godhimself
Посмотреть сообщение
Why are you checking if it "Is not" the string found?

Try changing

!strcmp

to

strcmp
You're very wrong, when comparing strings if it is equal to 0 then it matches, thus him doing !strcmp would mean if it is equal to 0.

edit; I'm pretty sure the timers are causing it, can you post the "illegaljob" function ?
Reply
#4

forward illegaltime(playerid);

public illegaltime(playerid)
{
SendClientMessage(playerid, RED, "ANNOUNCE: 2 hours has passed away, you're able to do an illegal job again.");
PlayerData[playerid][illegaljob] = 0;
}

i dont think is this because the timer works for other illegal jobs, only at /sell command

as i said before i think its the

}
}
}

but idk which isu the right formula
Reply
#5

so ?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)