Case message
#1

Please help me, what I want to do is make it so that it sends the player a message and lets him know when he finds crack, pot and pizza.
Below is how it is right now, you wont be notified if you find crack,pot or pizza it will just be added.
Код:
 if (strcmp(cmd, "/searchtrash", true) == 0)
	{
	  if(IsPlayerConnected(playerid) && gPlayerLogged[playerid])
	  {
			if(!IsPlayerInRangeOfPoint(playerid, 1.0, -2652.7739, 92.2361, 4.0798))
			{
			  SendClientMessage(playerid, COLOR_GRAD2, " You are not near the trashcan.");
			  return 1;
			}
			if(PlayerInfo[playerid][pTrashTime] > 0) { SendClientMessage(playerid, COLOR_GRAD2, " There is nothing in the trash right now, try again later."); return 1; }
			new amount = RandomEx(1, 13);
			switch (amount)
			{
			  case 1: GivePlayerMoney(playerid, 1);
			  case 2: GivePlayerMoney(playerid, 2);
			  case 3: GivePlayerMoney(playerid, 3);
			  case 4: GivePlayerMoney(playerid, 4);
			  case 5: GivePlayerMoney(playerid, 5);
			  case 6: GivePlayerMoney(playerid, 6);
			  case 7: GivePlayerMoney(playerid, 7);
			  case 8: GivePlayerMoney(playerid, 8);
			  case 9: GivePlayerMoney(playerid, 9);
			  case 10: GivePlayerMoney(playerid, 10);
			  case 11: PlayerInfo[playerid][pPot] +=2;
			  case 12: PlayerInfo[playerid][pCrack] +=2;
			  case 13: PlayerInfo[playerid][pPizza] +=1;
			}
			format(string, sizeof(string), "* You found $%d in the trash.", amount);
  			SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
			PlayerInfo[playerid][pTrashTime] = 600;
		}
		return 1;
	}
Reply
#2

Here:
Код:
if (strcmp(cmd, "/searchtrash", true) == 0)
	{
	  if(IsPlayerConnected(playerid) && gPlayerLogged[playerid])
	  {
			if(!IsPlayerInRangeOfPoint(playerid, 1.0, -2652.7739, 92.2361, 4.0798))
			{
			  SendClientMessage(playerid, COLOR_GRAD2, " You are not near the trashcan.");
			  return 1;
			}
			if(PlayerInfo[playerid][pTrashTime] > 0) { SendClientMessage(playerid, COLOR_GRAD2, " There is nothing in the trash right now, try again later."); return 1; }
			new amount = RandomEx(1, 13);
			switch (amount)
			{
			  case 1: GivePlayerMoney(playerid, 1);
			  case 2: GivePlayerMoney(playerid, 2);
			  case 3: GivePlayerMoney(playerid, 3);
			  case 4: GivePlayerMoney(playerid, 4);
			  case 5: GivePlayerMoney(playerid, 5);
			  case 6: GivePlayerMoney(playerid, 6);
			  case 7: GivePlayerMoney(playerid, 7);
			  case 8: GivePlayerMoney(playerid, 8);
			  case 9: GivePlayerMoney(playerid, 9);
			  case 10: GivePlayerMoney(playerid, 10);
			  case 11: PlayerInfo[playerid][pPot] +=2;
			  case 12: PlayerInfo[playerid][pCrack] +=2;
			  case 13: PlayerInfo[playerid][pPizza] +=1;
			}
                 if(amount < 11)
   		      format(string, sizeof(string), "* You found $%d in the trash.", amount);
                 else if(amount == 11)//Pot
                 format(string, sizeof(string), "* You found some pot in the trash.");
                 else if(amount == 12)//Crack
                 format(string, sizeof(string), "* You found some crack in the trash.");
                 else if(amount == 13)//Pizza
                 format(string, sizeof(string), "* You found pizza in the trash.");
                 SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
			PlayerInfo[playerid][pTrashTime] = 600;
		}
		return 1;
	}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)