Jump to content
  • 0

Problema /accept pills


Question

Posted

Bun am sistemul de Pills pe server, dar nu merge comanda /accept pills cand un medic da /sell pills.

[pawn]if(strcmp(cmd, "/sellpills", true) == 0)

{

if(PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pLeader] == 4)

{

tmp = strtok(cmdtext, idx);

if(!strlen(tmp))

{

SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /sellpills [playerid/PartOfName] [ammount] [price]");

return 1;

}

new playa;

new money;

new needed;

playa = ReturnUser(tmp);

tmp = strtok(cmdtext, idx);

if(!strlen(tmp)) { return 1; }

needed = strval(tmp);

if(needed < 1 || needed > 50) { SendClientMessage(playerid, COLOR_GREY, "  Grams not lower then 1, or above 50!"); return 1; }

tmp = strtok(cmdtext, idx);

if(!strlen(tmp)) { return 1; }

money = strval(tmp);

if(money < 1 || money > 1000) { SendClientMessage(playerid, COLOR_GREY, "  Price not lower then 1, or above 1000!"); return 1; }

if(needed > PlayerInfo[playerid][pPills]) { SendClientMessage(playerid, COLOR_GREY, "  You dont have that much Pills with you !"); return 1; }

if(IsPlayerConnected(playa))

{

    if(playa != INVALID_PLAYER_ID)

    {

if (ProxDetectorS(8.0, playerid, playa))

{

new giveplayamoney = GetPlayerMoney(playa);

if( moneys > giveplayamoney )

{

SendClientMessage(playerid ,COLOR_GRAD2 ,  "That player doesn't have the cash to pay the pills");

}

if(playa == playerid)

    {

        SendClientMessage(playerid, COLOR_GREY, "  Cant sell to yourself!");

        return 1;

    }

    GetPlayerName(playa, giveplayer, sizeof(giveplayer));

GetPlayerName(playerid, sendername, sizeof(sendername));

    format(string, sizeof(string), "* You offerd %s %d pills for %s .", giveplayer, needed, FormatMoney(money));

SendClientMessage(playerid, COLOR_LIGHTBLUE, string);

format(string, sizeof(string), "* Medic %s wants to sell you %d pills for %s, (type /accept pills) to buy.", sendername, needed, FormatMoney(money));

SendClientMessage(playa, COLOR_LIGHTBLUE, string);

PillsOffer[playa] = playerid;

PillsPrice[playa] = money;

Pills[playa] = needed;

}

else

{

    SendClientMessage(playerid, COLOR_GREY, "  That player is not near you !");

}

}

}

else

{

    SendClientMessage(playerid, COLOR_GREY, "  You are not a News Reporter !");

}

}

return 1;

}[/pawn]

Va rog sa ma ajutati :).

6 answers to this question

Recommended Posts

Posted

ii acolo nu am alta comanda, ii la fel ca si la /accept drugs .

Odata ce nu ai comanda /accelpt pills cum vrei sa mearga ;))

Stiu si eu ... branza e pe bani, dar eu tot ma joc pe gratis!

Posted

pai asa ii si la /accept drugs nu are comanda.... am cautat peste tot /accept pills si nu este si am cautat si /accept drugs ti tot nu este. la drugs merge si la pills nu

Posted

[pawn]else if(strcmp(x_job,"pills",true) == 0)

{

    if(PillsOffer[playerid] < 999)

    {

        if(GetPlayerMoney(playerid) > PillsPrice[playerid])

    {

        if(PlayerInfo[playerid][pPills] < 7)

        {

        if(IsPlayerConnected(PillsOffer[playerid]))

        {

            GetPlayerName(PillsOffer[playerid], giveplayer, sizeof(giveplayer));

GetPlayerName(playerid, sendername, sizeof(sendername));

format(string, sizeof(string), "* You bought %d pills for %s from Medic %s.",Pills[playerid],FormatMoney(PillsPrice[playerid]),giveplayer);

SendClientMessage(playerid, COLOR_LIGHTBLUE, string);

format(string, sizeof(string), "* %s has bought your %d pills, the %s was added to your PayCheck.",sendername,Pills[playerid],FormatMoney(PillsPrice[playerid]));

SendClientMessage(PillsOffer[playerid], COLOR_LIGHTBLUE, string);

PlayerInfo[PillsOffer[playerid]][pPayCheck] += PillsPrice[playerid];

GivePlayerMoneyEx(playerid, -PillsPrice[playerid]);

PlayerInfo[playerid][pPills] += Pills[playerid];

PlayerInfo[PillsOffer[playerid]][pPills] -= Pills[playerid];

            PillsOffer[playerid] = 999;

PillsPrice[playerid] = 0;

Pills[playerid] = 0;

return 1;

}

return 1;

}

else

{

    SendClientMessage(playerid, COLOR_GREY, "  You are fully loaded with Pills, use them first !");

    return 1;

}

}

else

{

    SendClientMessage(playerid, COLOR_GREY, "  You can't afford those Pills !");

    return 1;

}

    }

    else

    {

        SendClientMessage(playerid, COLOR_GREY, "  No-one offerd you any Pills !");

        return 1;

    }

}[/pawn] Am gasit ceva :-?

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.