Hello need help with giving street point!
#1

So basiclly it shows the message: "You can't use this command yet!"! Even when I didn't use it.

+ The question if it will send to another player which id gived street point and player name?

pawn Код:
CMD:street(playerid, params[])
{
    if(CanUseCmd[playerid] == true)
    {
        new str[256], Name1[MAX_PLAYER_NAME], id;
        if(sscanf(params, "u", id)) return SendClientMessage(playerid, 0xCC0000AA, "USAGE: /street <playerid/partofname>");
        PlayerInfo[playerid][StreetRespect]++;
        format(str, sizeof(str), "Gived you Street Point %s(ID %d)", Name1, playerid);
        SendClientMessage(id, 0xFF0000FF, str);
        RestrictTime[playerid] = SetTimer("RestrictionOver", 3_600_000, false);
        CanUseCmd[playerid] = false;
    }
    else return SendClientMessage(playerid, 0xCC0000AA, "You can't use this command yet!");
    return 1;
}
Reply
#2

iirc booleans start off as false
Reply
#3

did you consider to rename CanUseCmd to CantUseCmd? you would need to check
pawn Код:
if(CanUseCmd[playerid] == false)
...as cessil pointed out, no variable gets written a value into when its initialized.
btw, where is the allowance given to the player? a timer, or when entering an interior/vehicle?
Reply
#4

Quote:
Originally Posted by Babul
Посмотреть сообщение
did you consider to rename CanUseCmd to CantUseCmd? you would need to check
That would be using negative logic and isn't as easy to understand when you look back on it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)