[HELP] /selldrugs CMD :(
#1

Hello everyone im getting trouble with /selldrug commands, can someone help me please? IT consists that u do /selldrugs <id> <amount> and when player clicks on yes on the dialog he gets 1 drug and gets - amount of money, and the seller gets one less drug and more money.. here is my script.. i have already defined all ...

pawn Код:
CMD:selldrugs(playerid, params[])
{
    new pName[24], string[200];
   
    if(sscanf(params, "ui", iId, iAmount))
        return SendClientMessage(playerid, DEEPPINK, "USAGE: /selldrugs <id> <amount>");
       
    if(!IsPlayerConnected(iId))
        return SendClientMessage(playerid, DEEPPINK, "ERROR: Player is not connected");
       
    if(PlayerInfo[playerid][pDrugs] = 0)
        return SendClientMessage(playerid, DEEPPINK, "ERROR: You don't have any drugs to sell");

    if(playerid == iId)
        return SendClientMessage(playerid, DEEPPINK, "ERROR: You can't sell drugs to yourself");
       
    if (GetPlayerMoney(playerid) < iAmount)
        return SendClientMessage(playerid, DEEPPINK, "ERROR: Insufficent funds");
       
    {
        GetPlayerName(playerid, pName, sizeof pName);
        format(string, sizeof(string), ""COL_RED"\t\tDrug Sellers\n\n"COL_RED"%s "COL_WHITE"wants to sell you a drug for "COL_RED"%d "COL_WHITE"amount\nDo you want to you buy one?", pName, iAmount);
        ShowPlayerDialog(iId, DIALOG_SELLDRUGS, DIALOG_STYLE_MSGBOX, ""COL_WHITE"Drug Sellers", string, "Yes", "No");
    }
    return 1;
}
OnDialogResponse

pawn Код:
case DIALOG_SELLDRUGS:
        {
            if(!response)
            {
                return 1;
            }
            if(response)
            {
                PlayerInfo[playerid][pDrugs]--;
                PlayerInfo[iId][pDrugs]++;
                GivePlayerMoney(playerid, iAmount);
                GivePlayerMoney(iId, - iAmount);
            }
            return 1;
        }
please help me , reegards, MiGu3X
Reply


Messages In This Thread
[HELP] /selldrugs CMD :( - by MiGu3X - 30.04.2013, 20:34
Re: [HELP] /selldrugs CMD :( - by Chenko - 01.05.2013, 00:07
Re: [HELP] /selldrugs CMD :( - by MiGu3X - 01.05.2013, 00:11
Re: [HELP] /selldrugs CMD :( - by Chenko - 01.05.2013, 00:24
Re: [HELP] /selldrugs CMD :( - by MiGu3X - 01.05.2013, 00:25
Re: [HELP] /selldrugs CMD :( - by Chenko - 01.05.2013, 00:30
Respuesta: [HELP] /selldrugs CMD :( - by MiGu3X - 01.05.2013, 04:32
Re: [HELP] /selldrugs CMD :( - by MiGu3X - 02.05.2013, 13:08
Re: [HELP] /selldrugs CMD :( - by MiGu3X - 10.05.2013, 00:50
Re: [HELP] /selldrugs CMD :( - by horsemeat - 10.05.2013, 02:25

Forum Jump:


Users browsing this thread: 4 Guest(s)