Jump to content
  • 0

Problema GF


Carmin

Question

Salut, am introdus in gamemodul meu un sistem de pills, adica pastile pentru medics/paramedics si nu imi prelueaza comenzile "/sell pills" , "/usepills" desii ele sunt bagate in gamemod corespunzator (cred), pe langa asta mai sunt 2 probleme care provin de la sistemul de pills :D :

warning 219: local variable "price" shadows a variable at a preceding level

warning 219: local variable "ammount" shadows a variable at a preceding level

Need help! Thanks.

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

/agivepills - functioneaza (admin give pills), dar fara comanda /usepills nu-si are rostul

/usepills - carenu functioneaza (SERVER:Unknown Command)

/get pills - functioneaza, dar fara locatia in care sa dau /get nu-si are niciun rost

/sellpills - nici asta nu merge

/accept pills - nici asta nu merge

si

/accept - nu merge deloc.

Atat.

Link to comment
Share on other sites

Poftim

//===============================================================================================//

//---Comanda: /sellpills---//

//===============================================================================================//

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 $%d .", giveplayer, needed, money);

SendClientMessage(playerid, COLOR_LIGHTBLUE, string);

format(string, sizeof(string), "* Medic %s wants to sell you %d pills for $%d, (type /accept pills) to buy.", sendername, needed, 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;

}

//===============================================================================================//

//---Comanda: /usepills---//

//===============================================================================================//

if(strcmp(cmdtext, "/usepills", true) == 0)

{

    if(IsPlayerConnected(playerid))

  {

      if(PlayerBoxing[playerid] > 0)

        {

            SendClientMessage(playerid, COLOR_GREY, "Cant use Pills while you are fighting !");

            return 1;

        }

if(PlayerInfo[playerid][pPills] > 0)

{

if(PlayerInfo[playerid][pPills] == 0)

    {

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

      SetPlayerHealth(playerid, 100);

    SendClientMessage(playerid, COLOR_GREY, "1 Pill used !");

    format(string, sizeof(string), "%s took a pills a very good !", sendername);

ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);

    PlayerInfo[playerid][pPills] -= 1;

    PlayerInfo[playerid][pPills] = 300;

    if(STDPlayer[playerid]==1)

{

    STDPlayer[playerid] = 0;

    SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You are no longer infected with a STD anymore because of the Drugs !");

}

else if(STDPlayer[playerid]==2)

{

    STDPlayer[playerid] = 1;

    SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You lowered the STD to Chlamydia because of the Drugs !");

}

else if(STDPlayer[playerid]==3)

{

    STDPlayer[playerid] = 2;

    SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You lowered the STD to Gonorrhea because of the Drugs !");

}

} else SendClientMessage(playerid, COLOR_GREY, "Please wait 300 seconds to consume pills again");

}

else

{

    SendClientMessage(playerid, COLOR_GREY, "You dont have any Pills left !");

}

}

return 1;

}

Link to comment
Share on other sites

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.