Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <YSI\y_ini>
- #define pSave "Jail/%s.ini"
- forward PlayerInJail(playerid);
- enum Info
- {
- Jail,
- JailTime
- }
- new Pnfo[MAX_PLAYERS][Info];
- forward LoadStats(playerid,name[],value[]);
- public LoadStats(playerid,name[],value[])
- {
- INI_Int("Jail", Pnfo[playerid][Jail]);
- INI_Int("JailTime", Pnfo[playerid][JailTime]);
- return 1;
- }
- public OnFilterScriptInit()
- {
- SetTimer("PlayerInJail", 1000, true);
- return 1;
- }
- public PlayerInJail(playerid)
- {
- for(new a = 0; a<MAX_PLAYERS; a ++)
- {
- if(Pnfo[a][Jail] == 1)
- {
- if(Pnfo[a][JailTime] > 0)
- {
- Pnfo[a][JailTime] -= 1;
- }else{
- Pnfo[a][Jail] = 0;
- SpawnPlayer(playerid);
- }
- }
- }
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- INI_ParseFile(UserPath(playerid),"LoadStats",.bExtra = true, .extra = playerid);
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- new INI:File = INI_Open(UserPath(playerid));
- INI_SetTag(File,"Stats");
- INI_WriteInt(File, "Jail", Pnfo[playerid][Jail]);
- INI_WriteInt(File, "JailTime", Pnfo[playerid][JailTime]);
- INI_Close(File);
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- if(Pnfo[playerid][Jail] == 1)
- {
- // send to jail function
- }
- return 1;
- }
- stock UserPath(playerid)
- {
- new string[128],playername[MAX_PLAYER_NAME];
- GetPlayerName(playerid,playername,sizeof(playername));
- format(string,sizeof(string),pSave,playername);
- return string;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement