Restricted Commands
#1

I want to make a command where I can set people to a file, Then if there names are in that file they are able to do certain commands.
So for example "/setfile id" then they can do the command "/opengate"
Then do the opposite "/removefile id" then they cant do the gate command.
Can anyone point me in the right way on how to do this?
Reply
#2

Yeah, I think I somehow know what you want! You'd need to create a log for that:

pawn Код:
#define gatePATH    "Logs/GateLog.txt" //directory for the log of gates
Then, under a command, simply you could write into the log which you created, while creating a stock for your function:

pawn Код:
stock GateLog(Target)
            {
                new File:Log = fopen(gatePATH, io_append);
                new logData[128];
                new name[MAX_PLAYER_NAME];
                GetPlayerName(Target,name,sizeof(name));
                new fTime[6];
                getdate(fTime[0], fTime[1], fTime[2]);
                gettime(fTime[3], fTime[4], fTime[5]);
                format(logData, sizeof logData, "[%02d/%02d/%04d || %02d:%02d:%02d]%s performed an ACTION!\r\n", fTime[2], fTime[1], fTime[0], fTime[3], fTime[4], fTime[5], name);
                fwrite(Log, logData);
                fclose(Log);
                return 1;
            }
Under your command, you could use this function then simply with one line:

pawn Код:
GateLog(playerid);
Reply
#3

Thank you for your help, I'm new to this. So how would I create the removefile cmd and setfile.
Reply
#4

Okay, look, I have to leave right now, also have sent ya a PM, right?
3 things:

-Which saving-system are you using, dini??
-Are you using ZCMD? Because I only know how to script such cases with ZCMD, not with "!strcmp"
-What shall the command exactly do?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)