Command doesn't remove the value
#1

I am making a pot smoking system but when i smoke it i don't lose the pots from my saving system i have checked everything in the saving system but everything seems to be fine also my animation doesn't work at all i am trying to make a animation that he will loop once but i cant seem to find the answer.

here is my code
pawn Код:
CMD:use(playerid,params[])
{
    new option[20],string[128];
    if(sscanf(params, "s[20]", option))
    {
        SendClientMessage(playerid,-1,"Available Options: pot,crack,materials,meth,heroin,radio,coldmeds.");
        SendClientMessage(playerid,-1,"Available Options: acid,seeds,pizza.");
        return 1;
    }
    if(!strcmp(option, "pot", true))
    {
        if(CantSmokePots[playerid] >= 1)
        {
            SendClientMessage(playerid,-1,"You already smoked some pots, please wait before doing it again.");
            return 1;
        }
        if(pInfo[playerid][pPot] == 0)
        {
           SendClientMessage(playerid,-1,"You don't have any pots to smoke..");
           return 1;
        }
        pInfo[playerid][pPot] -= 2;
        AddHealth(playerid,20);
        ApplyAnimation(playerid,"FOOD","EAT_burger",4.1,-1,-1,-1,-1,-1,-1);
        SendClientMessage(playerid,-1,"You have smoked 2 grams of pot.");
        format(string,sizeof(string),"*%s started to smoke some pots.",GetName(playerid));
        SendMessageToAllClosePlayers(playerid,COLOR_PURPLE,string);
        CantSmokePots[playerid] = 20;
        return 1;
    }
    if(!strcmp(option, "crack", true))
    {
        return 1;
    }
    return 1;
}
Reply
#2

change
Код:
        pInfo[playerid][pPot] -=2;
to
Код:
        pInfo[playerid][pPot] -2;
Reply
#3

it gives me a warning that it doesn't have any effect and my way that i stated above is correct i just don't know why it doesn't work
Reply
#4

try :

pInfo[playerid][pPot] --;

or

PlayerInfo[playerid][pPot] --;
Reply
#5

Nope that will decrease it in a unlimited matter -- is mostly used for timers.
Reply
#6

try it, i do like that in my gamemodes, and it works fine
Reply
#7

it will only decrease by one and i want it to decrease by two and none of the ways above except mine seem to work but it still doesn't remove anything from the ini file
Reply
#8

Why would it change your .ini file? There is nothing in the code you posted that even saves anything to the ini file.
It most likely won't change the ini file until you disconnect, assuming you have some sort of SaveStats under OnPlayerDisconnect.
Reply
#9

Nevermind forgot the saving part in the OnPlayerDisconnect.
Thanks for helping
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)