SA-MP Forums Archive
/bugs command help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /bugs command help (/showthread.php?tid=431800)



/bugs command help - MichaelWharton101 - 20.04.2013

Okay So I have it so I can do '/bugs low/mid/major' but want it so I can also do '/bugs all' but can not seem to figure it out... Please help me

Code for /bugs
Код:
CMD:bugs(playerid,params[])
{
	// Calculating
	new Year, Month, Day;
	getdate(Year, Month, Day);
	{
	    new ActualDay;
		PlayerInfo[playerid][pIDay] = ActualDay;
		PlayerInfo[playerid][pIMonth] = Month;
  		PlayerInfo[playerid][pIDay] = Day;
		PlayerInfo[playerid][pIMonth] = Month;
		PlayerInfo[playerid][pIYear] = Year;
	}
    new bugtype[64];
	if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
	if(sscanf(params, "s[64]", bugtype))
	{
	    SendClientMessage(playerid, COLOR_WHITE, "** [Usage]:/bugs [type]");
	    SendClientMessage(playerid, COLOR_WHITE, "Valid types are: Low, Mid, Major, Fixed, All");
	    return 1;
	}
 	if(!strcmp(bugtype, "low", true))
 	{
  		if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
	    if(strlen(params) > 128) return SendClientMessage(playerid, COLOR_GREY, "Maximum characters limit is 128.");
   		new string[128], File: file = fopen("buglow.cfg", io_read), idx=1;
		format(string, sizeof(string), "American Roleplay - Low-Bugs until %d/%d/%d", PlayerInfo[playerid][pIMonth], PlayerInfo[playerid][pIDay], PlayerInfo[playerid][pIYear]);
 		SendClientMessage(playerid, COLOR_LIGHTRED, string);
		while(fread(file, string))
		{
			format(string, sizeof(string), "[%d] %s - Status:", idx, string);
			SendClientMessage(playerid, COLOR_YELLOW, string);
			idx ++;
		}
		fclose(file);
	}
	else if(!strcmp(bugtype, "mid", true))
 	{
  		if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
	    if(strlen(params) > 128) return SendClientMessage(playerid, COLOR_GREY, "Maximum characters limit is 128.");
   		new string[128], File: file = fopen("bugmid.cfg", io_read), idx=1;
	    format(string, sizeof(string), "American Roleplay - Mid-Bugs until %d/%d/%d", PlayerInfo[playerid][pIMonth], PlayerInfo[playerid][pIDay], PlayerInfo[playerid][pIYear]);
 		SendClientMessage(playerid, COLOR_LIGHTRED, string);
		while(fread(file, string))
		{
			format(string, sizeof(string), "[%d] %s - Status:", idx, string);
			SendClientMessage(playerid, COLOR_ORANGE, string);
			idx ++;
		}
		fclose(file);
	}
	else if(!strcmp(bugtype, "major", true))
 	{
  		if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
	    if(strlen(params) > 128) return SendClientMessage(playerid, COLOR_GREY, "Maximum characters limit is 128.");
   		new string[128], File: file = fopen("bugmid.cfg", io_read), idx=1;
	    format(string, sizeof(string), "American Roleplay - Major-Bugs until %d/%d/%d", PlayerInfo[playerid][pIMonth], PlayerInfo[playerid][pIDay], PlayerInfo[playerid][pIYear]);
 		SendClientMessage(playerid, COLOR_LIGHTRED, string);
		while(fread(file, string))
		{
			format(string, sizeof(string), "[%d] %s - Status:", idx, string);
			SendClientMessage(playerid, COLOR_LIGHTRED, string);
			idx ++;
		}
		fclose(file);
	}
	return 1;
}



- Giroud12 - 20.04.2013

DELETED


Re: /bugs command help - MichaelWharton101 - 20.04.2013

It has no error I want it so I can also do /bugs all and it will show me all the bugs


Re: /bugs command help - Giroud12 - 20.04.2013

Ok, let see the code.


Re: /bugs command help - MichaelWharton101 - 20.04.2013

I already posted it, it is the /bugs command at the top of my post...

Код:
CMD:bugs(playerid,params[])
{
	// Calculating
	new Year, Month, Day;
	getdate(Year, Month, Day);
	{
	    new ActualDay;
		PlayerInfo[playerid][pIDay] = ActualDay;
		PlayerInfo[playerid][pIMonth] = Month;
  		PlayerInfo[playerid][pIDay] = Day;
		PlayerInfo[playerid][pIMonth] = Month;
		PlayerInfo[playerid][pIYear] = Year;
	}
    new bugtype[64];
	if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
	if(sscanf(params, "s[64]", bugtype))
	{
	    SendClientMessage(playerid, COLOR_WHITE, "** [Usage]:/bugs [type]");
	    SendClientMessage(playerid, COLOR_WHITE, "Valid types are: Low, Mid, Major, Fixed, All");
	    return 1;
	}
 	if(!strcmp(bugtype, "low", true))
 	{
  		if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
	    if(strlen(params) > 128) return SendClientMessage(playerid, COLOR_GREY, "Maximum characters limit is 128.");
   		new string[128], File: file = fopen("buglow.cfg", io_read), idx=1;
		format(string, sizeof(string), "American Roleplay - Low-Bugs until %d/%d/%d", PlayerInfo[playerid][pIMonth], PlayerInfo[playerid][pIDay], PlayerInfo[playerid][pIYear]);
 		SendClientMessage(playerid, COLOR_LIGHTRED, string);
		while(fread(file, string))
		{
			format(string, sizeof(string), "[%d] %s - Status:", idx, string);
			SendClientMessage(playerid, COLOR_YELLOW, string);
			idx ++;
		}
		fclose(file);
	}
	else if(!strcmp(bugtype, "mid", true))
 	{
  		if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
	    if(strlen(params) > 128) return SendClientMessage(playerid, COLOR_GREY, "Maximum characters limit is 128.");
   		new string[128], File: file = fopen("bugmid.cfg", io_read), idx=1;
	    format(string, sizeof(string), "American Roleplay - Mid-Bugs until %d/%d/%d", PlayerInfo[playerid][pIMonth], PlayerInfo[playerid][pIDay], PlayerInfo[playerid][pIYear]);
 		SendClientMessage(playerid, COLOR_LIGHTRED, string);
		while(fread(file, string))
		{
			format(string, sizeof(string), "[%d] %s - Status:", idx, string);
			SendClientMessage(playerid, COLOR_ORANGE, string);
			idx ++;
		}
		fclose(file);
	}
	else if(!strcmp(bugtype, "major", true))
 	{
  		if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
	    if(strlen(params) > 128) return SendClientMessage(playerid, COLOR_GREY, "Maximum characters limit is 128.");
   		new string[128], File: file = fopen("bugmid.cfg", io_read), idx=1;
	    format(string, sizeof(string), "American Roleplay - Major-Bugs until %d/%d/%d", PlayerInfo[playerid][pIMonth], PlayerInfo[playerid][pIDay], PlayerInfo[playerid][pIYear]);
 		SendClientMessage(playerid, COLOR_LIGHTRED, string);
		while(fread(file, string))
		{
			format(string, sizeof(string), "[%d] %s - Status:", idx, string);
			SendClientMessage(playerid, COLOR_LIGHTRED, string);
			idx ++;
		}
		fclose(file);
	}
	return 1;
}



- Giroud12 - 20.04.2013

DELETED