Add Timer
#1

Need Some Help With My RP Mode!

I Want Set Robing Timers If Player Robing Something In Checkpoint!

Like That
/robstore Checkpoint

Must Wait If Robing Is Complete After 20 Sec


And Robing Timers Max Been 20 Sec

Here Is
Thats Code Is Taket In To My Gamemode!

Код:
// Forwards
forward BoxRobbedRecent(); //Box
forward UsedBoxRecentlyTimer(); //Box
//------------------------------------------------------------------------------
// Other Variables
new UsedBoxRecently[MAX_PLAYERS]; //Box
//------------------------------------------------------------------------------
// More Veriables
new BoxRobbed =0; //Box
//------------------------------------------------------------------------------
// CheckPoint Define
#define CP_BOX     100 //Box
//------------------------------------------------------------------------------
//new Float:checkCoords[MAX_POINTS][4] = {
{{147.4240,-96.6927,177.8985,-70.7966}, //Box
// min x, min y, max x, , max y
//------------------------------------------------------------------------------
//new Float:checkpoints[MAX_POINTS][4] = {
{162.3792,-80.0536,1001.8047,3.0}, // Box
//------------------------------------------------------------------------------
//new checkpointType[MAX_POINTS] = {
CP_BOX, //Box
//------------------------------------------------------------------------------
//public OnGameModeInit()
SetTimer("UsedBoxRecentlyTimer",1000,1); //Box
//------------------------------------------------------------------------------
//public UsedZipRecentlyTimer()
//Box
public UsedBoxRecentlyTimer()
{
  for(new i = 0; i < MAX_PLAYERS; i++)
	{
	 if(IsPlayerConnected(i))
	 {
	   if(IsSpawned[i] == 1 && UsedBoxRecently[i] >= 1)
	   {

		   UsedBoxRecently[i] --;

		 }
		}
	}
}
//------------------------------------------------------------------------------
//public ZipRobbedRecent()
//Box
    public BoxRobbedRecent()
{
    if(BoxRobbed == 1)
	 {
    BoxRobbed =0;

  }
 }
//------------------------------------------------------------------------------
//public OnPlayerConnect(playerid)
 UsedBoxRecently[playerid] =0; //Box
//------------------------------------------------------------------------------
//public OnPlayerCommandText(playerid, cmdtext[])
//Box
 	    	if(strcmp(cmdtext, "/robBox", true) == 0)
	{
	if(IsSpawned[playerid] == 0) {
	SendClientMessage(playerid, COLOR_ERROR, "You are dead. You cannot use this command");
  return 1;
  }
  if(Jailed[playerid] == 1) {
	SendClientMessage(playerid, COLOR_ERROR, "You are dead. You cannot use this command");
  return 1;
  }
	if(!IsPlayerInCheckpoint(playerid)) {
  SendClientMessage(playerid,COLOR_ERROR,"You are not in any the checkpoint");
  return 1;
  }
  if(UsedBoxRecently[playerid] >= 1) {
  SendClientMessage(playerid,COLOR_ERROR,"Please wait before using the Box again");
  return 1;
  }
  if(gTeam[playerid] == TEAM_COP || gTeam[playerid] == TEAM_ARMY || gTeam[playerid] == TEAM_MEDIC || gTeam[playerid] == TEAM_CASSEC || gTeam[playerid] == TEAM_JAILTK) {
	SendClientMessage(playerid,COLOR_ERROR,"You cannot rob anything");
	return 1;
 	}
 	if(IsPlayerInCheckpoint(playerid) && getCheckpointType(playerid) == 100)
  {
 	new zrand = random(5000);
 	if(zrand >=0 && zrand <=1000) {
 	SendClientMessage(playerid, 0xA9A9A9AA, "|_Robbery Failed_|");
 	SendClientMessage(playerid,COLOR_ERROR,"Your attempt to Rob The Box has failed");
 	UsedBoxRecently[playerid] += 120;
 	return 1;
 	}
 	else
  if(zrand >=1001 && zrand <=5000)
	{
  if(IsPlayerInCheckpoint(playerid) && getCheckpointType(playerid) == 100) {
  {
	  new plwl = GetPlayerWantedLevel(playerid);
	  SetPlayerWantedLevel(playerid, plwl +4 );
	  new mrand = random(175000);
	  new pname[30];
		GetPlayerName(playerid, pname, 30);
	  format(string, sizeof(string), "%s(%d) Has robbed $%d from The Box",pname,playerid,mrand);
		SendClientMessageToAll(0x00C7FFAA, string);
		ircSay(EchoConnection, EchoChan,string);
		format(string, sizeof(string), "%s(%d) Has robbed $%d from Box",pname,playerid,mrand);
		printf("%s", string);
		format(string, sizeof(string), "~w~ROBBERY ~b~COMPLETE~n~~w~YOU ROBBED~n~~r~ $%d~n~~w~FROM THE Box", mrand);
		GameTextForPlayer(playerid, string, 7000, 3);
		new pcol = GetPlayerColor(playerid);
 		plwl = GetPlayerWantedLevel(playerid);
		SendClientMessage(playerid, 0xA9A9A9AA, "|_Crime Commited_|");
		format(string, sizeof(string), "(Box ROBBERY) Wanted Level %d",plwl);
		SendClientMessage(playerid,pcol,string);
	  GivePlayerMoney(playerid, mrand);
	  oscore = GetPlayerScore(playerid);
	  BoxRobbed =1;
	  UsedBoxRecently[playerid] += 320;
	  SetPlayerScore(playerid, oscore +1);
    if(robberrank[playerid] >=10 && robberrank[playerid] <=18) {
  	SendClientMessage(playerid,COLOR_WHITE,"Your robbing skill level has been increased. Type /robskill for more info");
  	robberrank[playerid] +=1;
  	commitedcrimerecently[playerid] +=360;
		}
		SetTimer("BoxRobbedRecent",70000,0);
	  for(new i=0;i<MAX_PLAYERS;i++)
		{
    if(LawEnforcementRadio[i] == 1) {
ircSay(EchoConnection, EchoChan,string);
    new string1[256];
    new string2[256];
    new string3[256];
		format(string1, sizeof(string1), "DISPATCH: (Box ROBBERY) Box has been robbed. Suspect: %s(%d)", pname,playerid);
		format(string2, sizeof(string2), "ALL UNITS: Please respond to the Box north strip");
		format(string3, sizeof(string3), "Type /radoff to turn your Law Enforcement radio off");
		SendClientMessage(i, 0x00C7FFAA, string1);
		SendClientMessage(i, 0x00C7FFAA, string2);
		SendClientMessage(i, 0x00C7FFAA, string3);
		 		{
			}
	  }
	  }
		}
		}
		}
		}
    return 1;
 	  }
//------------------------------------------------------------------------------
//public OnPlayerEnterCheckpoint(playerid)
//Box
    if(getCheckpointType(playerid) == 100 && getCheckpointType(playerid) == 100)
  {
		SendClientMessage(playerid,0xAFAFAFAA,"!-!Welcome To The Box!-!");
		SendClientMessage(playerid,0xFF0000AA,"To Rob The Box Type /robBox While In The Checkpoint");
  }
//------------------------------------------------------------------------------
Sry My Bad English!
Reply
#2

somebody!
plz help
Reply
#3

nobody Answer!
Reply
#4

This ?
Код:
new rob3;
Код:
rob3 = SetTimer("RobWait",90000,1);
Reply
#5

ok i try
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)