Help with command
#1

Can someone make this command to be with minutes.
bucause the days aren't working.

Код:
	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] [Days] [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] [Days] [Cell]");
				return 1;
			}
			money = strval(tmp);
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GREY, "{33CCFF}USAGE:{FFFFFF} /prison [playerid/PartOfName] [Days] [Cell]");
				return 1;
			}
			cell = strval(tmp);
			if(cell > 24 || cell < 1) return SendClientMessage(playerid, COLOR_GREY, "{33CCFF}USAGE:{FFFFFF} /prison [playerid/PartOfName] [Days] [Cell 1-5]");
			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 arrest %s to los santos prison .", giveplayer);
							SendClientMessage(playerid, COLOR_YELLOW, string);
							format(string, sizeof(string), "* You were arrested by %s.", sendername);
							SendClientMessage(playa, COLOR_YELLOW, string);
							FullResetPlayerWeapons(playa);
							PlayerInfo[playa][pJailed] = 3;
							PlayerInfo[playa][pJailCell] = cell;
							PlayerInfo[playa][pArrested] += 1;
							format(string, sizeof(string), "You are arrsted for %d days.", money);
							SendClientMessage(playa, COLOR_LIGHTBLUE, string);
							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(money != 999)
								format(result, sizeof(result), "%d/%d/%d",day,month,year);
							else if(money == 999)
							    format(result, sizeof(result), "Forever!",day,month,year);
							format(string, sizeof(string), "* You arrest %s until %s .", giveplayer,result);
							SendClientMessage(playerid, COLOR_YELLOW, string);
							format(string, sizeof(string), "* You arrested until %s .", giveplayer,result);
							SendClientMessage(playa, COLOR_YELLOW, string);
							strmid(PlayerInfo[playa][pPrisonDate], result, 0, strlen(result), 255);
							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;
	}
And how to update the time inside the game if the cop puts him for 10 mins so the time will update
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)