Repeating Problem!
#1

pawn Код:
command(test, playerid, params[])
{
    if(PlayerInfo[playerid][BT1] >= 0 )
    {
        SendClientMessage(playerid, COLOUR_LGREEN, "DONE" );
        PlayerInfo[playerid][BT1] = 1;
        PlayerInfo[playerid][TasksComplete]++;
    }
    return 1;
}
Every time I use /test it says DONE even though BT1 = 1 Is it the way i have scripted it? Please help!
Reply
#2

You are checking if it is equal or more than 0, then complete the command. So if it is 0 then it would complete the command, and if it is more than 0 (Let's say 1) it would still complete it.

pawn Код:
command(test, playerid, params[])
{
    if(PlayerInfo[playerid][BT1] == 0)
    {
        SendClientMessage(playerid, COLOUR_LGREEN, "DONE" );
        PlayerInfo[playerid][BT1] = 1;
        PlayerInfo[playerid][TasksComplete]++;
    }
    else return SendClientMessage(playerid,-1,"NOT DONE.");//You can remove this line, it's just for debugging reasons.
    return 1;
}
Reply
#3

pawn Код:
command(test, playerid, params[])
{
    if(PlayerInfo[playerid][BT1] <= 0 )// edited for smaller then instead of larger then
    {
        SendClientMessage(playerid, COLOUR_LGREEN, "DONE" );
        PlayerInfo[playerid][BT1] = 1;
        PlayerInfo[playerid][TasksComplete]++;
    }
    return 1;
}
use this
Reply
#4

That could also work if he is setting the variable to -1 etc, also for 0.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)