Question
#1

Hello my usernick is Jasta and I have a short question, Is the code right?:
I have a problem that points below.

Код:
stock implodeTextVehicle(playerid, pvInfo: enum_tt, type_v, type_tt = 0)
{
	new string2[MAX_PLAYERVEHICLES*(14*MAX_MODS)];
	switch(type_tt)
	{
	    case 0:
	    {
		    new string[MAX_PLAYERVEHICLES][14*MAX_MODS], count;

		    while(count < MAX_PLAYERVEHICLES)
		    {
		        switch(type_v)
		        {
		            case 's':
		            {
						format(string[count], MAX_MODS*14, "%s", PlayerVehicleInfo[playerid][count][enum_tt]);
					}
					case 'i','d':
					{
						new count2, string3[14*MAX_MODS];
						while(count2 < MAX_MODS)
						{
						    if(count2 < MAX_MODS-1){
								format(string3, sizeof(string3), "%s%i|", string3, PlayerVehicleInfo[playerid][count][enum_tt][count2]); // THIS IS THE PROBLEM.
						    }
						    else
						    {
								format(string3, sizeof(string3), "%s%i", string3, PlayerVehicleInfo[playerid][count][enum_tt][count2]);
						    }
						}
						format(string[count], MAX_MODS*14, "[%s]", string3);
					}
					case 'f':
					{
						new count2, string3[14*MAX_MODS];
						while(count2 < MAX_MODS)
						{
						    if(count2 < MAX_MODS-1)
						    {
								format(string3, sizeof(string3), "%s%f,", string3, PlayerVehicleInfo[playerid][count][enum_tt][count2]);
						    }
						    else
						    {
								format(string3, sizeof(string3), "%s%f", string3, PlayerVehicleInfo[playerid][count][enum_tt][count2]);
						    }
						}
						format(string[count], MAX_MODS*14, "[%s]", string3);
					}
				}
		        count++;
		    }
			string2 = implode(string, ",");
			//return string2;
		}
		case 1:
	    {
		    new string[MAX_PLAYERVEHICLES][14*3], count;

		    while(count < MAX_PLAYERVEHICLES)
		    {
		        switch(type_v)
		        {
		            case 's':
		            {
						format(string[count], 3*14, "%s", PlayerVehicleInfo[playerid][count][enum_tt]);
					}
					case 'i','d':
					{
						new count2, string3[14*3];
						format(string3, sizeof(string3), "[");
						while(count2 < 3)
						{
						    if(count2 < 3-1){
								format(string3, sizeof(string3), "%s%i|", string3, PlayerVehicleInfo[playerid][count][enum_tt][count2]);
						    }
						    else
						    {
								format(string3, sizeof(string3), "%s%i", string3, PlayerVehicleInfo[playerid][count][enum_tt][count2]);
						    }
						}
						format(string3, sizeof(string3), "%s]", string3);
						format(string[count], 3*14, "%s", string3);
					}
					case 'f':
					{
						new count2, string3[14*3];
						format(string3, sizeof(string3), "[");
						while(count2 < 3)
						{
						    if(count2 < 3-1)
						    {
								format(string3, sizeof(string3), "%s%f,", string3, PlayerVehicleInfo[playerid][count][enum_tt][count2]);
						    }
						    else
						    {
								format(string3, sizeof(string3), "%s%f", string3, PlayerVehicleInfo[playerid][count][enum_tt][count2]);
						    }
						}
						format(string3, sizeof(string3), "%s]", string3);
						format(string[count], 3*14, "%s", string3);
					}
				}
		        count++;
		    }
			string2 = implode(string, ",");
			//return string2;
		}

		case 2:
	    {
		    new string[MAX_PLAYERVEHICLES][14*1], count;

		    while(count < MAX_PLAYERVEHICLES)
		    {
		        switch(type_v)
		        {
		            case 's':
		            {
						format(string[count], 1*14, "%s", PlayerVehicleInfo[playerid][count][enum_tt]);
					}
					case 'i','d':
					{
						format(string[count], 1*14, "%i", PlayerVehicleInfo[playerid][count][enum_tt]);
					}
					case 'f':
					{
						format(string[count], 1*14, "%f", PlayerVehicleInfo[playerid][count][enum_tt]);
					}
				}
		        count++;
		    }
			string2 = implode(string, ",");
			//return string2;
		}
	}
	return string2;
}
Reply
#2

case 's' ?
Reply
#3

it is a value of type_v
Reply
#4

PLASE HELP ME MEN
Reply
#5

Hello, Jastak

If type_tt is a integer like you mention in the stock, it can only accept numbers, in this case you switch it, and then you create a "case 's':" that 's' is a string, and thats wrong, either you use numbers or strings cant use both unless you convert in some way before you put it in the stock function...


Quote:

stock implodeTextVehicle(playerid, pvInfo: enum_tt, type_v, type_tt = 0)
{
new string2[MAX_PLAYERVEHICLES*(14*MAX_MODS)];
switch(type_tt)
{..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)