sell pot
#1

I made sell pot with a dialog so if someone buys a pot from that person, how can i make the money goes to the seller
pawn Код:
CMD:sellpot(playerid,params[])
{
    if(PlayerData[playerid][IsGang] == 1)
    {
        if(selling[playerid] == 1) return SendClientMessage(playerid,red,"ERROR: You are already selling items");
        selling[playerid] = 1;
        TogglePlayerControllable(playerid,0);
        GetPlayerPos(playerid,Float:X,Float:Y,Float:Z);
        sellingpot = CreateDynamicCP(Float:X+1.5,Float:Y,Float:Z,2.0,-1,-1,-1,100.0);
        SendClientMessage(playerid,orange,"You are selling pot!");
    }
    else return 0;
    return 1;
}
pawn Код:
public OnPlayerEnterDynamicCP(playerid,checkpointid)
{

    if(checkpointid == sellingpot)
    {
    ShowPlayerDialog(playerid,22,DIALOG_STYLE_LIST,"Pots","1 Gram $1000\n2 Grams $2000\n3 Grams $3000\n4 Grams $4000\n5 Grams $5000","Buy","Close");
    }
      return 1;
}
pawn Код:
if(dialogid == 22)
    {
        if(response)
        {
            if(listitem == 0)
            {
                if(GetPlayerMoney(playerid) < 1000) return SendClientMessage(playerid,red,"ERROR: You don't have enough money!");
                GivePlayerMoney(playerid,-1000);
                GivePlayerMoney(ID,1000);
                PlayerData[playerid][Pot] = PlayerData[playerid][Pot] + 1;
                SendClientMessage(playerid,orange,"You have buy 1 gram of pot, do /usepot to use it!");
            }
            if(listitem == 1)
            {
                if(GetPlayerMoney(playerid) < 2000) return SendClientMessage(playerid,red,"ERROR: You don't have enough money!");
                GivePlayerMoney(playerid,-2000);
                GivePlayerMoney(ID,2000);
                PlayerData[playerid][Pot] = PlayerData[playerid][Pot] + 2;
                SendClientMessage(playerid,orange,"You have buy 2 gram of pot, do /usepot to use it!");
            }
            if(listitem == 2)
            {
                if(GetPlayerMoney(playerid) < 3000) return SendClientMessage(playerid,red,"ERROR: You don't have enough money!");
                GivePlayerMoney(playerid,-3000);
                GivePlayerMoney(ID,3000);
                PlayerData[playerid][Pot] = PlayerData[playerid][Pot] + 3;
                SendClientMessage(playerid,orange,"You have buy 3 gram of pot, do /usepot to use it!");
            }
            if(listitem == 3)
            {
                if(GetPlayerMoney(playerid) < 4000) return SendClientMessage(playerid,red,"ERROR: You don't have enough money!");
                GivePlayerMoney(playerid,-4000);
                GivePlayerMoney(ID,4000);
                PlayerData[playerid][Pot] = PlayerData[playerid][Pot] + 4;
                SendClientMessage(playerid,orange,"You have buy 4 gram of pot, do /usepot to use it!");
            }
            if(listitem == 4)
            {
                if(GetPlayerMoney(playerid) < 5000) return SendClientMessage(playerid,red,"ERROR: You don't have enough money!");
                GivePlayerMoney(playerid,-5000);
                GivePlayerMoney(ID,5000);
                PlayerData[playerid][Pot] = PlayerData[playerid][Pot] + 5;
                SendClientMessage(playerid,orange,"You have buy 5 gram of pot, do /usepot to use it!");
            }
        }
    }
Reply
#2

pawn Код:
new string[128], giveplayerid, needed, money;
    if(sscanf(params, "udd", giveplayerid, needed, money)) return SendClientMessageEx(playerid, COLOR_SYN, "[Syntax:]{FFFFFF}  /sellpot [playerid] [amount] [price]");

    if(needed < 1 || needed > 99) { SendClientMessageEx(playerid, COLOR_GREY, "   Grams no lower then 1, or above 99!"); return 1; }
    if(money < 1 || money > 99999) { SendClientMessageEx(playerid, COLOR_GREY, "   Price not lower then 1, or above 99999!"); return 1; }
Reply
#3

how can i make a accept for that? /accept pot?
Reply
#4

You have to make a global variable, something like...

pawn Код:
// top of script

new OfferedPot[MAX_PLAYERS];

// in the command where you offer the person pot

OfferedPot[giveplayerid] = 1; // im assuming the target is giveplayerid

// in the /acceptpot command

if(OfferedPot[playerid] == 1)
{
       // give pot and other stuff here etc...
       return 1;
} else return SendClientMessage(playerid,COLOR,"You Weren't Offered Any Pot.");
Reply
#5

cant i make the pot like player buy from a dialog? on my first post about the topic cause i saw some servers has like taht
Reply
#6

Bump
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)