SA-MP Forums Archive
Restricted Commands - 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: Restricted Commands (/showthread.php?tid=323426)



Restricted Commands - Jack- - 05.03.2012

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?


Re: Restricted Commands - Twisted_Insane - 05.03.2012

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



Re: Restricted Commands - Jack- - 05.03.2012

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


Re: Restricted Commands - Twisted_Insane - 05.03.2012

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?