Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This is a comment
- // uncomment the line below if you want to write a filterscript
- #define FILTERSCRIPT
- #if defined FILTERSCRIPT
- #include <a_samp>
- #include <YSI\y_timers>
- #include <YSI\y_commands>
- new bool:player_duty[MAX_PLAYERS];
- new time_duty[MAX_PLAYERS];
- public OnFilterScriptInit()
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- player_duty[i] = false;
- time_duty[i] = 0;
- }
- return true;
- }
- CMD:duty(playerid, params[])
- {
- if(IsPlayerAdmin(playerid))
- {
- new string[144];
- if(player_duty[playerid] != true)
- {
- strdel(string, 0, 144);
- format(string, sizeof(string), "** %s has been duty.", Name(playerid));
- SendClientMessageToAll(-1, string);
- player_duty[playerid] = true;
- }
- else if(player_duty[playerid] != false)
- {
- strdel(string, 0, 144);
- if(time_duty[playerid] < 60)
- {
- format(string, sizeof(string), "** %s ah mode out of duty, total time on duty: %d seconds.", Name(playerid), time_duty[playerid]*1);
- SendClientMessageToAll(-1, string);
- }
- else if(time_duty[playerid] >= 60)
- {
- format(string, sizeof(string), "** %s ah mode out of duty, total time on duty: %d minutes.", Name(playerid), time_duty[playerid]/60*1);
- SendClientMessageToAll(-1, string);
- }
- time_duty[playerid] = 0;
- player_duty[playerid] = false;
- }
- }
- else
- {
- SendClientMessage(playerid, -1, "You are not administrator.");
- }
- return true;
- }
- stock Name(playerid)
- {
- new name[24];
- GetPlayerName(playerid, name, 24);
- return name;
- }
- task count_time_duty[1000]()
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- if(player_duty[i] != false)
- {
- time_duty[i]++;
- }
- }
- }
- return true;
- }
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement