29.06.2012, 18:59
I want that after that prison command it will calculate the minutes the cop has entered
And after the minutes the player will be released
And after the minutes the player will be released
Код:
if(strcmp(cmd, "/prison", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GREY, "{33CCFF}USAGE:{FFFFFF} /prison [playerid/PartOfName] [Mins] [Cell]"); return 1; } new playa; new money; new cell; playa = ReturnUser(tmp); tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GREY, "{33CCFF}USAGE:{FFFFFF} /prison [playerid/PartOfName] [Mins] [Cell]"); return 1; } money = strval(tmp); tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GREY, "{33CCFF}USAGE:{FFFFFF} /prison [playerid/PartOfName] [Mins] [Cell]"); return 1; } cell = strval(tmp); if(cell > 24 || cell < 1) return SendClientMessage(playerid, COLOR_GREY, "{33CCFF}USAGE:{FFFFFF} /prison [playerid/PartOfName] [Mins] [Cell 1-24]"); if (IsACop(playerid) || IsAPrisonGuard(playerid)) { if(IsPlayerConnected(playa)) { if(playa != INVALID_PLAYER_ID) { if(!PlayerToPoint(20, playerid,1834.0980,-1721.9845,5202.5859) || !PlayerToPoint(20, playerid,1827.5184,-1721.5369,5206.1860) || !PlayerToPoint(20, playerid,1844.3748,-1719.8369,5206.1870))// Jail spot { SendClientMessage(playerid, COLOR_GREY, "You cannot arrest anybody if your not near the prison`s cells!"); return 1; } if(GetDistanceBetweenPlayers(playerid,playa) < 10) {//PlayerInfo[playerid][pJailCell] pPrisonDate GetPlayerName(playa, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "* You have arrested %s to los santos prison for %d minutes.", giveplayer, money); SendClientMessage(playerid, COLOR_RED, string); format(string, sizeof(string), "* You have been arrested for Los Santos Prison by %s for %d minutes.", sendername, money); SendClientMessage(playa, COLOR_YELLOWG, string); FullResetPlayerWeapons(playa); PlayerInfo[playa][pJailed] = 4; PlayerInfo[playa][pJailCell] = cell; PlayerInfo[playa][pArrested] += 1; new year, month,day; getdate(year, month, day); //new result[128]; day += money; while(day > 31) { day -= 31; month++; } while(month > 12) { month -= 12; year++; } if(PlayerInfo[playa][pJailCell] == 1) SetPlayerPos(playa,1827.8213,-1731.9299,5202.5859); else if(PlayerInfo[playa][pJailCell] == 2) SetPlayerPos(playa,1831.0103,-1731.8927,5202.5859); else if(PlayerInfo[playa][pJailCell] == 3) SetPlayerPos(playa,1834.0918,-1732.0209,5202.5859); else if(PlayerInfo[playa][pJailCell] == 4) SetPlayerPos(playa,1837.2913,-1730.9072,5202.5859); else if(PlayerInfo[playa][pJailCell] == 5) SetPlayerPos(playa,1840.5859,-1731.9993,5202.5859); else if(PlayerInfo[playa][pJailCell] == 6) SetPlayerPos(playa,1843.7784,-1732.3024,5202.5859); else if(PlayerInfo[playa][pJailCell] == 7) SetPlayerPos(playa,1843.7201,-1711.8350,5202.5859); else if(PlayerInfo[playa][pJailCell] == 8) SetPlayerPos(playa,1840.3660,-1712.1101,5202.5859); else if(PlayerInfo[playa][pJailCell] == 9) SetPlayerPos(playa,1837.1741,-1711.9928,5202.5859); else if(PlayerInfo[playa][pJailCell] == 10) SetPlayerPos(playa,1833.9534,-1712.1176,5202.5859); else if(PlayerInfo[playa][pJailCell] == 11) SetPlayerPos(playa,1830.5641,-1711.7528,5202.5859); else if(PlayerInfo[playa][pJailCell] == 12) SetPlayerPos(playa,1827.4946,-1711.4478,5202.5859); else if(PlayerInfo[playa][pJailCell] == 13) SetPlayerPos(playa,1827.7543,-1711.7517,5206.1860); else if(PlayerInfo[playa][pJailCell] == 14) SetPlayerPos(playa,1830.7646,-1711.9414,5206.1860); else if(PlayerInfo[playa][pJailCell] == 15) SetPlayerPos(playa,1834.0128,-1711.8164,5206.1860); else if(PlayerInfo[playa][pJailCell] == 16) SetPlayerPos(playa,1837.3129,-1711.6401,5206.1860); else if(PlayerInfo[playa][pJailCell] == 17) SetPlayerPos(playa,1840.5027,-1711.7007,5206.1860); else if(PlayerInfo[playa][pJailCell] == 18) SetPlayerPos(playa,1843.6472,-1711.7065,5206.1860); else if(PlayerInfo[playa][pJailCell] == 19) SetPlayerPos(playa,1843.6439,-1731.7734,5206.1860); else if(PlayerInfo[playa][pJailCell] == 20) SetPlayerPos(playa,1840.4283,-1731.8011,5206.1860); else if(PlayerInfo[playa][pJailCell] == 21) SetPlayerPos(playa,1837.1818,-1731.8258,5206.1860); else if(PlayerInfo[playa][pJailCell] == 22) SetPlayerPos(playa,1834.2139,-1732.4745,5206.1860); else if(PlayerInfo[playa][pJailCell] == 23) SetPlayerPos(playa,1831.0645,-1731.7957,5206.1860); else if(PlayerInfo[playa][pJailCell] == 24) SetPlayerPos(playa,1827.8179,-1731.8121,5206.1860); else { SetPlayerPos(playa,1827.5184,-1721.5369,5206.1860); //SetPlayerFacingAngle(playa, 269.8099); } TogglePlayerControllable(playa, 0); hostimer[playa] = SetTimerEx("EnterHospital",2000,1,"d",playa); SetPlayerInterior(playa, 2); PlayerInfo[playa][pInt] = 2; } } } } else { SendClientMessage(playerid, COLOR_GREY, "{BCD4E6}Error: {FFFFFF}Sorry, you cant use this command."); } } return 1; }