cmd /ad
#1

what wrong here not working
Код:
if(strcmp(cmd, "/advertise", true) == 0 || strcmp(cmd, "/ad", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			new length = strlen(cmdtext);
			while ((idx < length) && (cmdtext[idx] <= ' '))
			{
				idx++;
			}
			new offset = idx;
			new result[128];
			while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
			{
				result[idx - offset] = cmdtext[idx];
				idx++;
			}
			result[idx - offset] = EOS;
			if(!strlen(result))
   			{
				SendClientMessage(playerid, COLOR_WHITE, "[Usage:] (/ad)vertise [advert text]");
				return 1;
			}
   	    	for(new i = 0; i < sizeof(Businesses); i++)
			{
				if(IsPlayerInRangeOfPoint(playerid,1.0,Businesses[i][EnterX],Businesses[i][EnterY],Businesses[i][EnterZ]) || IsPlayerInRangeOfPoint(playerid,25.0,Businesses[i][ExitX],Businesses[i][ExitY],Businesses[i][ExitZ]))
				{
					if(GetPlayerVirtualWorld(playerid) == i)
					{
			    		if(Businesses[i][BizType] == 5)
			    		{
				        	if(Businesses[i][Products] != 0)
				        	{
								if((!adds) && (PlayerInfo[playerid][pAdmin] < 1))
								{
									format(string, sizeof(string), "[Error:] You must wait %d seconds before making another advertisement",  (addtimer/1000));
									SendClientMessage(playerid, COLOR_GREY, string);
									return 1;

								}
								new payout = idx * 25;
								if(GetPlayerCash(playerid) < payout)
						        {
						            SendClientMessage(playerid, COLOR_GREY, "[Error:] You do not have enough money");
						            return 1;
						        }
						        GivePlayerCash(playerid, - payout);
								Businesses[i][Till] += payout;
								Businesses[i][Products] --;
								format(string, sizeof(string), "|____________________Advertisement (%s)____________________|",  Businesses[i][BusinessName]);
								SendClientMessageToAll(COLOR_LIGHTGREEN,string);
								format(string, sizeof(string), "[Advertisement:] %s",  result);
								SendClientMessageToAll(COLOR_WHITE,string);
								format(string, sizeof(string), "Advertisement By: %s - Phone Number: %d",  GetPlayerNameEx(playerid),PlayerInfo[playerid][pPhoneNumber],Businesses[i][BusinessName]);
								SendClientMessageToAll(COLOR_WHITE,string);
								SendClientMessageToAll(COLOR_LIGHTGREEN,"______________________________________________________________________________________");
						        if(PlayerInfo[playerid][pAdmin] < 1){SetTimer("AddsOn", addtimer, 0);adds = 0;}
						        format(string, sizeof(string), "[Info:] Characters Contained: %d - Cost: $%d - Thanks from %s", idx,payout,Businesses[i][BusinessName]);
								SendClientMessage(playerid,COLOR_WHITE,string);
								PlayerActionMessage(playerid,15.0,"gives the business some money and gets his advertisement posted in return");
								SaveBusinesses();
								return 1;
							}
							else
							{
								SendClientMessage(playerid, COLOR_GREY, "[Error:] The business is out of products");
							}
						}
						else
						{
							SendClientMessage(playerid, COLOR_GREY, "[Error:] This business is not an advertising company");
						}
					}
	   			}
	   			else
				{
				}
			}
		}
		return 1;
	}
Reply
#2

im use /ad , Adver not recived in chat
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)