14.03.2014, 13:45
(
Последний раз редактировалось ATomas; 14.03.2014 в 19:38.
)
Hello,
I wrote this function code:
and I want to overwrite it into a universal form something like this:
When I compile, it writes:
I wrote this function code:
pawn Код:
#include <a_samp>
enum LIST_INFO
{
l_int,
l_str[10],
Float:l_float
}
new List[][LIST_INFO] = {
{2,"Test2",2.2},
{1,"Test1",1.1},
{4,"Test4",4.4},
{3,"Test3",3.3},
{5,"Test5",5.5}
};
stock BubbleSort(array[][LIST_INFO],index = 0,start = 0,len = sizeof(array),len2 = sizeof(array[]))
{
for(new i=start;i<len-1+start;i++)
{
for(new j=start;j<len-1-i+start;j++)
{
if(array[j+1][LIST_INFO:index] < array[j][LIST_INFO:index])
{
new temp[LIST_INFO];
for(new t;t<len2;t++)
{
temp[LIST_INFO:t] = array[j+1][LIST_INFO:t];
array[j+1][LIST_INFO:t] = array[j][LIST_INFO:t];
array[j][LIST_INFO:t] = temp[LIST_INFO:t];
}
}
}
}
return 1;
}
public OnFilterScriptInit()
{
BubbleSort(List);
for(new i;i<sizeof(List);i++) printf("%d %s %.f",List[i][l_int],List[i][l_str],List[i][l_float]);
return 1;
}
pawn Код:
#include <a_samp>
enum LIST_INFO
{
l_int,
l_str[10],
Float:l_float
}
new List[][LIST_INFO] = {
{2,"Test2",2.2},
{1,"Test1",1.1},
{4,"Test4",4.4},
{3,"Test3",3.3},
{5,"Test5",5.5}
};
stock BubbleSort(array[][LIST_INFO],enum ENUM_NAME,index = 0,start = 0,len = sizeof(array),len2 = sizeof(array[]))
{
for(new i=start;i<len-1+start;i++)
{
for(new j=start;j<len-1-i+start;j++)
{
if(array[j+1][ENUM_NAME:index] < array[j][ENUM_NAME:index])
{
new temp[LIST_INFO];
for(new t;t<len2;t++)
{
temp[ENUM_NAME:t] = array[j+1][ENUM_NAME:t];
array[j+1][ENUM_NAME:t] = array[j][ENUM_NAME:t];
array[j][ENUM_NAME:t] = temp[ENUM_NAME:t];
}
}
}
}
return 1;
}
public OnFilterScriptInit()
{
BubbleSort(List,LIST_INFO);
for(new i;i<sizeof(List);i++) printf("%d %s %.f",List[i][l_int],List[i][l_str],List[i][l_float]);
return 1;
}
Quote:
C:\Users\Atoma_000\Desktop\samp03z\filterscripts\b ub.pwn(17) : error 010: invalid function or declaration C:\Users\Atoma_000\Desktop\samp03z\filterscripts\b ub.pwn(17) : error 017: undefined symbol "ENUM_NAME" C:\Users\Atoma_000\Desktop\samp03z\filterscripts\b ub.pwn(17) : error 010: invalid function or declaration C:\Users\Atoma_000\Desktop\samp03z\filterscripts\b ub.pwn(17 -- 19) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 4 Errors. |