Small help
#1

I have a /selldrugs command for all the gang orgs on my server. It a checkpoint at their position and when another player walks into it, it shows them the menu to buy drugs.

The problem is that the person who is buying the drugs should loose cash and the person who is selling the drugs should get the cash. But i dont know what is the problem, only id 0 it will work for.

This is the Command. It is ok.
pawn Code:
COMMAND:selldrugs(playerid, params[])
{
    new Float:dx,Float:dy,Float:dz;
    if(IsGang[playerid] !=1 )return 1;
    {
        GetPlayerPos(playerid,dx,dy,dz);
        DrugCP = CreateDynamicCP(dx,dy,dz, 2.0,-1,-1,-1,100.0);
        SendClientMessage(playerid,orange,"You are now dealing drugs. Dont get caught");
        ApplyAnimation(playerid, "DEALER", "DEALER_DEAL", 4.0, 1, 0, 0, 0, 0,1);
    }
    return 1;
}
Now here is the place where i want the seller to the get the cash but id 0 gets it.
pawn Code:
{
                new cash = GetPlayerMoney(playerid),sellerid;
                if(cash < 200)return SendClientMessage(playerid, red, "You need $200 to buy 1 gram of cocine");
                if(Drugs[playerid] == 10)return SendClientMessage(playerid,red,"You already have the maximum ammout of drugs (10)");
                GetPlayerName(playerid,Name,MAX_PLAYER_NAME);
                format(String,sizeof(String),"%s has just bought 1 gram of drugs",Name);
                SendClientMessage(sellerid,green,String);
                SendClientMessage(playerid, green, "You just bought 1 gram of cocaine. Type /usedrugs");
                GivePlayerMoney(playerid, -200);
                GivePlayerMoney(sellerid,200);
                GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
                format(file,sizeof(file),USER_FILES, Name);
                if(dini_Exists(file))
                {
                    dini_IntSet(file, "Drugs",Drugs[playerid] = 1);
                }
                Drugs[playerid] = 1;
            }
Thanks in advance.
Reply


Messages In This Thread
Small help - by Tee - 21.12.2010, 00:34
Respuesta: Small help - by admantis - 21.12.2010, 00:35
Re: Small help - by Tee - 21.12.2010, 00:37

Forum Jump:


Users browsing this thread: 1 Guest(s)