Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define FILTERSCRIPT
- #include <a_samp>
- #include <Dini>
- #include <sscanf2>
- #include <zcmd>
- new JailFile[64];
- new JailTimer[MAX_PLAYERS] = -1;
- public OnFilterScriptInit()
- {
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- if(JailTimer[playerid] != -1)
- {
- format(JailFile, sizeof(JailFile), "Jailed_ppl/%s.ini", GetName(playerid));
- KillTimer(JailTimer[playerid]);
- dini_Create(JailFile);
- }
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- format(JailFile, sizeof(JailFile), "Jailed_ppl/%s.ini", GetName(playerid));
- if(dini_Exists(JailFile))
- {
- SendClientMessage(playerid, 0xffffffff, "You get +5 mins jail for disconnecting while in jail!");
- //SetPlayerPos(playerid, x, y, z); Jail Pos
- JailTimer[playerid] = SetTimerEx("Unjail", 5*60*1000, 0, "d", playerid);//5 mins in the jail for DC
- dini_Remove(JailFile);
- }
- return 1;
- }
- CMD:jail(playerid, params[])
- {
- new id, mins, str[128];
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xffffffff, "You're not Admin!");
- if(sscanf(params, "ud", id, mins)) return SendClientMessage(playerid, 0xffffffff, "[Usage]: /jail <id> <minutes>");
- if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xffffffff, "Invalid player id.");
- //SetPlayerPos(id, x, y, z); Jail Pos
- JailTimer[id] = SetTimerEx("Unjail", mins*60*1000, 0, "d", id);
- format(str, sizeof(str), "You jailed %s for %d mins.", GetName(id), mins);
- SendClientMessage(playerid, 0xffffffff, str);
- format(str, sizeof(str), "%s jailed you for %d mins.", GetName(playerid), mins);
- SendClientMessage(id, 0xffffffff, str);
- return 1;
- }
- forward Unjail(playerid);
- public Unjail(playerid)
- {
- SendClientMessage(playerid, 0xffffffff, "You're free!");
- //SetPlayerPos(playerid, x, y, z); Out of Jail Pos
- JailTimer[playerid] = -1;
- }
- stock GetName(playerid)
- {
- new name[24];
- GetPlayerName(playerid, name, 24);
- return name;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement