19.08.2011, 16:58
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!");
}
}
}