How to make stock stop a script?
#1

Hi, im using this stock i've made:
pawn Code:
stock GivePlayerDrugs(playerid, amount)
{
    new formatt[64];
    if(PlayerInfo[playerid][pDrugs]+amount > MAX_DRUGS)
    {
        format(formatt, sizeof(formatt), "You cant carry that much drugs! (Limit: %d grams)", MAX_DRUGS);
        return SendMessage(playerid, MSG_ERROR, formatt);
    }
    else
    {
        PlayerInfo[playerid][pDrugs] += amount;
        format(formatt, sizeof(formatt), " *** %s grabs some drugs..", PlayerName(playerid));
        return SendLocalMessage(playerid, COLOR_PURPLE, formatt);
    }
}
And i want to use it like this:
pawn Code:
CMD(playerid, params[])
{
     GivePlayerDrugs(playerid, 100); // So if player cant carry that much drugs,
     OtherFunc(playerid); //--------// then this function and all below wont be called.
     AnotherFunction();
     return 1;
}
Is this possible? How?
Reply
#2

Have you defined MAX_DRUGS?
pawn Code:
#define MAX_DRUGS 100
pawn Code:
CMD(playerid, params[])
{
     GivePlayerDrugs(playerid, =< MAX_DRUGS); // So if player cant carry that much drugs,
     OtherFunc(playerid); //--------// then this function and all below wont be called.
     AnotherFunction();
     return 1;
}
try this
Reply
#3

Quote:
Originally Posted by Kh4led
View Post
Have you defined MAX_DRUGS?
pawn Code:
#define MAX_DRUGS 100
pawn Code:
CMD(playerid, params[])
{
     GivePlayerDrugs(playerid, =< MAX_DRUGS); // So if player cant carry that much drugs,
     OtherFunc(playerid); //--------// then this function and all below wont be called.
     AnotherFunction();
     return 1;
}
try this
Reply
#4

pawn Code:
stock Check(playerid)
{
   if(PlayerInfo[playerid][pDrugs]+amount > MAX_DRUGS) return 0;
   return 1;
}


CMD:drug(playerid)
{
    new formatt[64];
    if(Check(playerid) == 1)
    {

    }
    else
    {

    }

}
Reply
#5

Quote:
Originally Posted by HuSs3n
View Post
pawn Code:
stock Check(playerid)
{
   if(PlayerInfo[playerid][pDrugs]+amount > MAX_DRUGS) return 0;
   return 1;
}


CMD:drug(playerid)
{
    new formatt[64];
    if(Check(playerid) == 1)
    {

    }
    else
    {

    }

}
I didnt ask for a solution, i just asked if its possible to do it my way. + That is not a good solution.
Reply
#6

its possible
if you use return 1 in your stock then check in ur cmd if GivePlayerDrugs equals to 1
i dont think its possible in other way (only if you use a new variable)
Reply
#7

Don't help him, he only needs to know if it's possible or not.
Reply
#8

pawn Code:
stock GivePlayerDrugs(playerid, amount)
{
    new formatt[64];
    if(PlayerInfo[playerid][pDrugs]+amount < MAX_DRUGS)
    {
        PlayerInfo[playerid][pDrugs] += amount;
        format(formatt, sizeof(formatt), " *** %s grabs some drugs..", PlayerName(playerid));
        SendLocalMessage(playerid, COLOR_PURPLE, formatt);
        return 1;
    }
    format(formatt, sizeof(formatt), "You can't carry that much drugs! (Limit: %d grams)", MAX_DRUGS);
    SendMessage(playerid, MSG_ERROR, formatt);
    return 0;
}
pawn Code:
CMD(playerid, params[])
{
     if(!GivePlayerDrugs(playerid, 100)) return 1; // So if player cant carry that much drugs,
     OtherFunc(playerid); //--------// then this function and all below wont be called.
     AnotherFunction();
     return 1;
}
Reply
#9

Quote:
Originally Posted by Neozftw
View Post
pawn Code:
stock GivePlayerDrugs(playerid, amount)
{
    new formatt[64];
    if(PlayerInfo[playerid][pDrugs]+amount < MAX_DRUGS)
    {
        PlayerInfo[playerid][pDrugs] += amount;
        format(formatt, sizeof(formatt), " *** %s grabs some drugs..", PlayerName(playerid));
        SendLocalMessage(playerid, COLOR_PURPLE, formatt);
        return 1;
    }
    format(formatt, sizeof(formatt), "You can't carry that much drugs! (Limit: %d grams)", MAX_DRUGS);
    SendMessage(playerid, MSG_ERROR, formatt);
    return 0;
}
pawn Code:
CMD(playerid, params[])
{
     if(!GivePlayerDrugs(playerid, 100)) return 0; // So if player cant carry that much drugs,
     OtherFunc(playerid); //--------// then this function and all below wont be called.
     AnotherFunction();
     return 1;
}
Finally someone who gets me, thanks dude!
Reply
#10

Quote:
Originally Posted by Neozftw
View Post
pawn Code:
stock GivePlayerDrugs(playerid, amount)
{
    new formatt[64];
    if(PlayerInfo[playerid][pDrugs]+amount < MAX_DRUGS)
    {
        PlayerInfo[playerid][pDrugs] += amount;
        format(formatt, sizeof(formatt), " *** %s grabs some drugs..", PlayerName(playerid));
        SendLocalMessage(playerid, COLOR_PURPLE, formatt);
        return 1;
    }
    format(formatt, sizeof(formatt), "You can't carry that much drugs! (Limit: %d grams)", MAX_DRUGS);
    SendMessage(playerid, MSG_ERROR, formatt);
    return 0;
}
pawn Code:
CMD(playerid, params[])
{
     if(!GivePlayerDrugs(playerid, 100)) return 0; // So if player cant carry that much drugs,
     OtherFunc(playerid); //--------// then this function and all below wont be called.
     AnotherFunction();
     return 1;
}
It's not about the money, money, money,
We don't need your money, money, money,
We just wanna make the world dance,
Forget about the price tag....
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)