Timer issue.
#1

Yeah, so I've been working on using timers and I'll admit, I'm totally useless when it comes to the more advanced timer use. So all I'd like to do is when I use /jail, it'll store their amount of minutes into a variable which can be used to be shown on a command and will decrease every minute. Here's my code;

Код:
if(strcmp(cmd, "/jail", true) == 0)
  {
    if(IsPlayerConnected(playerid))
    {
     tmp = strtok(cmdtext, idx);
     if(!strlen(tmp))
     {
      SendClientMessage(playerid, COLOR_RED, "USAGE: /jail [ID] [Minutes] [Reason]");
      return 1;
     }
     new playa;
     new money;
     playa = strval(tmp);
     tmp = strtok(cmdtext, idx);
 			if(PlayerData[playerid][Admin] < 3) return SendClientMessage(playerid, RED, "SERVER MESSAGE: You are not admin level 3.");
			{
       if(IsPlayerConnected(playa))
       {
         if(playa != INVALID_PLAYER_ID)
         {
      	 new otherplayer = strval(tmp);
new length = strlen(cmdtext);
	while ((idx < length) && (cmdtext[idx] <= ' '))
	{
	idx++;
	}
	new offset = idx;
	new result[64];
	while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
	{
	result[idx - offset] = cmdtext[idx];
	idx++;
	}
	result[idx - offset] = EOS;
   			 GetPlayerName(playa, giveplayer, sizeof(giveplayer));
         GetPlayerName(playerid, sendername, sizeof(sendername));
         if(PlayerData[playerid][onduty] == 0) return SendClientMessage(playerid, RED, "Your not on Administration duty!");
 		 	   if(PlayerData[playerid][Admin] < PlayerData[otherplayer][Admin]) return SendClientMessage(playerid, RED, "You can't use this command on higher level Admins than yourself!");
         format(string, sizeof(string), "*Administrator %s jailed %s for %d minutes – [Reason: %s]", sendername,giveplayer,PlayerData[playa][PrisonTime],result);
         SendClientMessageToAll(COLOR_RED1, string);
         ResetPlayerWeapons(playa);
         PlayerData[playa][Prison] = 1;
         GameTextForPlayer(playa, "~r~Admin Jailed", 3000, 3);
         SetPlayerInterior(playa, 6);
         SetPlayerPos(playa, 264.6288,77.5742,1001.0391);
         format(string, sizeof(string), "You are jailed for %d minutes – Reason: %s", PlayerData[playa][PrisonTime],result);
         SendClientMessage(playa, COLOR_RED1, string);
					PlayerData[playa][PrisonTime] = money*60000;
					SetTimerEx("JailTimerPassing",60000,1,"-",playa);
				}
      }
     }
   }
   return 1;
  }
I apologize for the terrible indentation but I can't help it. Anyhow, I'd appreciate any help here as I don't have a clue what I'm doing here.
Reply


Messages In This Thread
Timer issue. - by [LSB]Clinz - 29.08.2009, 23:19
Re: Timer issue. - by Weirdosport - 29.08.2009, 23:23
Re: Timer issue. - by [LSB]Clinz - 29.08.2009, 23:27
Re: Timer issue. - by Backwardsman97 - 29.08.2009, 23:27
Re: Timer issue. - by Erkan - 29.08.2009, 23:32
Re: Timer issue. - by Erkan - 30.08.2009, 00:01

Forum Jump:


Users browsing this thread: 4 Guest(s)