SA-MP Forums Archive
Hello need help with giving street point! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Hello need help with giving street point! (/showthread.php?tid=425752)



Hello need help with giving street point! - Scrillex - 26.03.2013

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;
}



Re: Hello need help with giving street point! - cessil - 26.03.2013

iirc booleans start off as false


Re: Hello need help with giving street point! - Babul - 26.03.2013

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?


Re: Hello need help with giving street point! - cessil - 26.03.2013

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