Factory problem, Help
#1

hi guys, i have been made my Own Milk factory but there is some problems

First, When you /getmilk, You will have to drop the milk at any 24/7 by using /dropmilk and you will get $1500 for it

But If you typed /dropmilk without /getmilk, you will get the $1500 again and you didn't /getmilk, how to fix that?

Codes:
Quote:

if (strcmp("/getmilk", cmdtext, true, 10) == 0)
{
if (IsPlayerInRangeOfPoint(playerid,3,1382.0204,-1085.4540,27.3906))
{
SendClientMessage(playerid, 0xFF8000FF, " *You have taken Bottle of Milk, Go and Deliver it at any 24/7 *");
SetPlayerCheckpoint(playerid, 1352.3014,-1755.9366,13.3520,3);
}
else
{
SendClientMessage(playerid, 0x33AA33AA, " You are not at Milk Factory ");
}
return 1;
}
if (strcmp("/dropmilk", cmdtext, true, 10) == 0)
{
if (IsPlayerInRangeOfPoint(playerid,3,1352.3014,-1755.9366,13.3520))
{
SendClientMessage(playerid, 0xFF8000FF, " 24/7: Thank you sir for the Milk, we will give you $1500 for that ");
SendClientMessage(playerid, 0xFF8000FF, " Gratz! The 24/7 gave you $1500 for the milk");
DisablePlayerCheckpoint(playerid);
}
else
{
SendClientMessage(playerid,0x33AA33AA, " You are not at any 24/7 ");
}
return 1;
}

Help please
Reply
#2

This will work
pawn Код:
//DECLARE A GLOBAL VARIABLE
new bool:HaveMilk[MAX_PLAYERS] = false;

if (strcmp("/getmilk", cmdtext, true, 10) == 0)
{
    if(HaveMilk[playerid] == true) return SendClientMessage(playerid,-1,"You already have milk");
    if (IsPlayerInRangeOfPoint(playerid,3,1382.0204,-1085.4540,27.3906))
    {
        SendClientMessage(playerid, 0xFF8000FF, " *You have taken Bottle of Milk, Go and Deliver it at any 24/7 *");
        SetPlayerCheckpoint(playerid, 1352.3014,-1755.9366,13.3520,3);
        HaveMilk[playerid] = true;
    }
    else
    {
        SendClientMessage(playerid, 0x33AA33AA, " You are not at Milk Factory ");
        HaveMilk[playerid] = false;
    }
    return 1;
}
if (strcmp("/dropmilk", cmdtext, true, 10) == 0)
{
    if(HaveMilk[playerid] == false) return SendClientMessage(playerid,-1,"You do not have milk");
    if (IsPlayerInRangeOfPoint(playerid,3,1352.3014,-1755.9366,13.3520))
    {
        SendClientMessage(playerid, 0xFF8000FF, " 24/7: Thank you sir for the Milk, we will give you $1500 for that ");
        SendClientMessage(playerid, 0xFF8000FF, " Gratz! The 24/7 gave you $1500 for the milk");
        DisablePlayerCheckpoint(playerid);
        HaveMilk[playerid] = false;
    }
    else
    {
        SendClientMessage(playerid,0x33AA33AA, " You are not at any 24/7 ");
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)