How to make commands only if you on duty
#2

pawn Код:
new playerOnDuty[MAX_PLAYERS]; // global outside any callback

// Connect initializes variable:
OnPlayerConnect(playerid) {
playerOnDuty[playerid] = 0;
}

// Command sets player OnDuty
OnPlayerCommandText() {
    if(!strcmp("/onduty", cmdtext)) {
        playerOnDuty[playerid] = 1;
        return 1;
    }

// in a command that can only be used while on duty:
    if(!strcmp("/kick", cmdtext))
    {
        if(playerOnDuty[playerid] == 1) // can use
        else SendClientMessage(playerid, COLOR_GRAD1, "You are not Admin On Duty!");
    }
}
This code is purly for educational use and needs to be implemented rather than copy-paste. It give you a global overview of how it is done.
Reply


Messages In This Thread
How to make commands only if you on duty - by RenSoprano - 16.04.2012, 16:20
Re: How to make commands only if you on duty - by mamorunl - 16.04.2012, 16:27

Forum Jump:


Users browsing this thread: 1 Guest(s)