Ошибка при компиляции Text with sprites 1.0.0

Статус
В этой теме нельзя размещать новые ответы.
Сообщения
2,288
Реакции
1,740
Помог
31 раз(а)
Ошибка
//// text_with_sprites.sma
//
// C:\Users\Pokemoshka\Desktop\═ютр ёсюЁър\text_with_sprites.sma(53) : error 021: symbol already defined: "MapName"
// C:\Users\Pokemoshka\Desktop\═ютр ёсюЁър\text_with_sprites.sma(145) : error 035: argument type mismatch (argument 1)
//
// 2 Errors.
// Could not locate output file C:\Users\Pokemoshka\Desktop\═ютр ёсюЁър\compiled\text_with_sprites.amx (compile failed).
//
// Compilation Time: 0,39 sec
// ----------------------------------------
Компилятор
Локальный
Amx Mod X
1.10.0
Исходный код
#include <amxmodx>
#include <amxmisc>
#include <reapi>

#if !defined MAX_MAPNAME_LENGTH
#define MAX_MAPNAME_LENGTH 64
#endif

#define ACCESS_FLAG ADMIN_RCON //Доступ к команде и messagemode

#define SCALE_MODE 1 //Режим размера спрайтов-символов (1-задается свой размер, 2-рандом между значениями)

#if SCALE_MODE == 1
#define SCALE 0.6
#else
#define SCALE_MIN 0.5
#define SCALE_MAX 0.9
#endif

//Значение интервала между спрайтами по разным осям. (если уменьшать, то спрайты будут накладываться друг на друга)
#define INTERVAL_VALUE_X 15.0
#define INTERVAL_VALUE_Y 15.0
#define INTERVAL_VALUE_Z 30.0

enum
{
MESSAGEMODE_ARRAY_BUFFER = 256,
SPRITES_ARRAY_BUFFER = 64,
SYMBOL_ARRAY_BUFFER = 3
};

new const MOVE_COORDS[][] =
{
"X++",
"X--",
"Y++",
"Y--",
"Z++",
"Z--"
};

new const PLUGIN_VER[] = "1.0.0";
new const SETTINGS_FILE_NAME[] = "text_with_sprites.ini"
new const DIR_NAME[] = "text_with_sprites";

new const ENTITY_CLASSNAME[] = "tws_sprite";
new class_num;

new Array:SaveSprites, Array:SaveSymbols, Array:SaveIndex;

new CheckMenu1[MAX_PLAYERS+1], CheckMenu2[MAX_PLAYERS+1], CheckMenu3[MAX_PLAYERS+1], bool:Check[MAX_PLAYERS+1];

new MapName[MAX_MAPNAME_LENGTH], Dir[MAX_RESOURCE_PATH_LENGTH], SavePath[MAX_RESOURCE_PATH_LENGTH], CheckCoords[MAX_PLAYERS+1];

new Float:SaveOrigin[MAX_PLAYERS+1][3], Float:Move[MAX_PLAYERS+1], Sign1[MAX_PLAYERS+1], Sign2[MAX_PLAYERS+1];

public plugin_precache()
{
register_plugin("Text with sprites", PLUGIN_VER, "wellasgood");

SaveSprites = ArrayCreate(SPRITES_ARRAY_BUFFER);
SaveSymbols = ArrayCreate(SYMBOL_ARRAY_BUFFER);
SaveIndex = ArrayCreate(6);

get_localinfo("amxx_configsdir", Dir, charsmax(Dir));

new Path[MAX_RESOURCE_PATH_LENGTH];
formatex(Path, charsmax(Path), "%s/%s", Dir, SETTINGS_FILE_NAME);

if(!file_exists(Path))
{
set_fail_state("Нету файла '%s'", Path);
}

new Data[SPRITES_ARRAY_BUFFER], f = fopen(Path, "rt"), Section;

while(!feof(f))
{
fgets(f, Data, charsmax(Data));
trim(Data);

if(!Data[0] || Data[0] == ';')
{
continue;
}

if(Data[0] == '[')
{
if(containi(Data[1], "СПРАЙТЫ") == 0)
{
Section = 1;
}
else if(containi(Data[1], "СИМВОЛЫ") == 0)
{
Section = 2;
}
else if(containi(Data[1], "КОМАНДЫ") == 0)
{
Section = 3;
}

continue;
}

switch(Section)
{
case 1:
{
ArrayPushString(SaveSprites, Data);

new index = precache_model(Data);
ArrayPushCell(SaveIndex, index);
}
case 2:
{
ArrayPushString(SaveSymbols, Data);
}
case 3:
{
register_clcmd(Data, "@TwsMenu");
}
}
}

fclose(f);
}

public plugin_init()
{
register_dictionary("tws.txt");

register_menu("@TwsMenu", 1023, "@HandleTwsMenu", 0);
register_concmd("CmdActivateDisplay", "@ActivateHandler");

register_menu("@MoveMenu", 1023, "@Handle_MoveMenu", 0);
register_concmd("MoveValue", "@MoveHandler");

register_menu("@DeleteMenu", 1023, "@Handle_DeleteMenu", 0);

register_cvar("text_with_sprites_version", PLUGIN_VER, FCVAR_SERVER|FCVAR_SPONLY|FCVAR_UNLOGGED);
}

public plugin_cfg()
{
get_mapname(MapName, charsmax(MapName));
formatex(SavePath, charsmax(SavePath), "%s/%s/%s-coord.cfg", Dir, DIR_NAME, MapName);

new PlDir[MAX_RESOURCE_PATH_LENGTH];
formatex(PlDir, charsmax(PlDir), "%s/%s", Dir, DIR_NAME);

if(!dir_exists(PlDir)) mkdir(PlDir);

ReadCoords();
}

public client_connect(id)
{
if(~get_user_flags(id) & ACCESS_FLAG) return;
Sign1[id] = 1;
}

@TwsMenu(id)
{
if(~get_user_flags(id) & ACCESS_FLAG) return 0;

new Menu[MAX_MENU_LENGTH], Keys = MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_0;
new Len = formatex(Menu, charsmax(Menu), "\r[\y%L\r] \w%L^n^n", id, "TWS_PREFIX", id, "TWS_MAIN_MENU_TITLE");

Len += formatex(Menu[Len], charsmax(Menu) - Len, "\r[1] \y# \w%L^n^n", id, "TWS_MENU_ITEM_DELETE");

Len += formatex(Menu[Len], charsmax(Menu) - Len, CheckMenu2[id] == 2 ? "\r[2] \y# \w%L \r[\yZ\r]^n^n" : (CheckMenu2[id] == 0 ? "\r[2] \y# \w%L \r[\yX\r]^n^n" : "\r[2] \y# \w%L \r[\yY\r]^n^n"), id, "TWS_MAIN_MENU_ITEM2");

Len += formatex(Menu[Len], charsmax(Menu) - Len, "\r[3] \y# \w%L \r[\y%L\r]^n^n", id, "TWS_MAIN_MENU_ITEM3", id, fmt("TWS_MAIN_MENU_ITEM3_%d_%d", CheckMenu2[id], CheckMenu3[id]));

Len += formatex(Menu[Len], charsmax(Menu) - Len, "\r[4] \y# \w%L^n^n", id, "TWS_MENU_ITEM_MOVE");

Len += formatex(Menu[Len], charsmax(Menu) - Len, "\r[5] \y# \w%L^n^n", id, "TWS_MAIN_MENU_ITEM4");

formatex(Menu[Len], charsmax(Menu) - Len, "\r[0] \y# \w%L", id, "TWS_MENU_EXIT");
return show_menu(id, Keys, Menu, -1, "@TwsMenu");
}

@HandleTwsMenu(id, Keys)
{
switch(Keys)
{
case 0:
{
@DeleteMenu(id);
return;
}
case 1:
{
CheckMenu2[id] = (CheckMenu2[id] + 1) % 3;
}
case 2:
{
CheckMenu3[id] = (CheckMenu3[id] + 1) % 2;
}
case 3:
{
CheckCoords[id] = 0;

@MoveMenu(id);
return;
}
case 4:
{
client_cmd(id, "messagemode ^"CmdActivateDisplay^"");
}
case 9:
{
return;
}
}

@TwsMenu(id);
}

@DeleteMenu(id)
{
new Menu[MAX_MENU_LENGTH], Keys = MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_0;
new Len = formatex(Menu, charsmax(Menu), "\r[\y%L\r] \w%L^n^n", id, "TWS_PREFIX", id, "TWS_MENU_ITEM_DELETE");

Len += formatex(Menu[Len], charsmax(Menu) - Len, "\r[1] \y# \w%L \r[\y%L\r]^n", id, "TWS_MENU_DELETE_ITEM1", id, fmt("TWS_MENU_DELETE_ITEM1_%d", CheckMenu1[id]));

Len += formatex(Menu[Len], charsmax(Menu) - Len, "\r[2] \y# \w%L^n^n", id, "TWS_MENU_DELETE_ITEM2");

formatex(Menu[Len], charsmax(Menu) - Len, "\r[0] \y# \w%L", id, "TWS_MENU_BACK");
return show_menu(id, Keys, Menu, -1, "@DeleteMenu");
}

@Handle_DeleteMenu(id, Keys)
{
switch(Keys)
{
case 0:
{
CheckMenu1[id] = (CheckMenu1[id] + 1) % 2;
}
case 1:
{
new Entity;

switch(CheckMenu1[id])
{
case 0:
{
new body;
get_user_aiming(id, Entity, body, 9999);

new i;

while(i <= class_num)
{
if(FClassnameIs(Entity, fmt("%s-%d", ENTITY_CLASSNAME, i)))
{
delete_file(SavePath);
SaveSprite(Entity, 0, 1);

break;
}

i++;
}
}
case 1:
{
new i;

while(i <= class_num)
{
DeleteAllHandler(i++);
}

class_num = 0;
delete_file(SavePath);
}
}
}
case 9:
{
@TwsMenu(id);
return;
}
}

@DeleteMenu(id);
}

DeleteAllHandler(num)
{
new Entity = rg_find_ent_by_class(NULLENT, fmt("%s-%d", ENTITY_CLASSNAME, num), false);

while(Entity > 0)
{
set_entvar(Entity, var_flags, FL_KILLME);
set_entvar(Entity, var_nextthink, get_gametime() + 0.01);
Entity = rg_find_ent_by_class(Entity, fmt("%s-%d", ENTITY_CLASSNAME, num), false);
}
}

@ActivateHandler(id)
{
if(~get_user_flags(id) & ACCESS_FLAG) return;

new Data[MESSAGEMODE_ARRAY_BUFFER];
read_args(Data, charsmax(Data));

class_num++;

new i;
while(Data[i] != EOS)
{
new num = SymbolsHandler(Data[i++]);

if(num < 0) continue;

ShowSprites(id, num);
}

if(i == 0) class_num--;

Check[id] = false;
}

SymbolsHandler(data[])
{
new i;

while(i < ArraySize(SaveSymbols))
{
new Buffer[SYMBOL_ARRAY_BUFFER];
ArrayGetString(SaveSymbols, i, Buffer, charsmax(Buffer));

if(containi(data[0], Buffer) == 0) return i;
i++;
}

return -1;
}

ShowSprites(id, num)
{
if(!Check[id])
{
get_entvar(id, var_origin, SaveOrigin[id]);

SaveOrigin[id][0] += 30.0;
SaveOrigin[id][1] += 30.0;
SaveOrigin[id][2] += 15.0;

Check[id] = true;
}

OriginHandler(id);

CreateSprite(id, num, 0);
SaveSprite(id, num, 0, class_num);
}

OriginHandler(id)
{
switch(CheckMenu2[id])
{
case 0:
{
if(CheckMenu3[id] == 0) SaveOrigin[id][0] -= INTERVAL_VALUE_X;
else SaveOrigin[id][0] += INTERVAL_VALUE_X;
}
case 1:
{
if(CheckMenu3[id] == 0) SaveOrigin[id][1] -= INTERVAL_VALUE_Y;
else SaveOrigin[id][1] += INTERVAL_VALUE_Y;
}
case 2:
{
if(CheckMenu3[id] == 0) SaveOrigin[id][2] -= INTERVAL_VALUE_Z;
else SaveOrigin[id][2] += INTERVAL_VALUE_Z;
}
}
}

CreateSprite(id, num, cl_num, Float:Origin[3]={0.0, 0.0, 0.0}, Float:Angles=0.0)
{
new Buffer[SPRITES_ARRAY_BUFFER];
ArrayGetString(SaveSprites, num, Buffer, charsmax(Buffer));

new Index = ArrayGetCell(SaveIndex, num);

new Entity = rg_create_entity("info_target", false);

set_entvar(Entity, var_classname, fmt("%s-%d", ENTITY_CLASSNAME, id ? class_num : cl_num));
set_entvar(Entity, var_model, Buffer);
set_entvar(Entity, var_modelindex, Index);

set_entvar(Entity, var_chain, num);

set_entvar(Entity, var_movetype, MOVETYPE_FLY);
set_entvar(Entity, var_solid, SOLID_SLIDEBOX);

new Float:Mins[3] = {-5.0, -5.0, -5.0};
set_entvar(Entity, var_mins, Mins);

new Float:Maxs[3] = {5.0, 5.0, 5.0};
set_entvar(Entity, var_maxs, Maxs);

new Float:Size[3];

Size[0] = Maxs[0] - Mins[0];
Size[1] = Maxs[1] - Mins[1];
Size[2] = Maxs[2] - Mins[2];

set_entvar(Entity, var_size, Size);

#if SCALE_MODE == 1
set_entvar(Entity, var_scale, SCALE);
#else
set_entvar(Entity, var_scale, random_float(SCALE_MIN, SCALE_MAX));
#endif

set_entvar(Entity, var_origin, id ? SaveOrigin[id] : Origin);

if(!id)
{
new Float:EntAngles[3];
EntAngles[2] = Angles;

set_entvar(Entity, var_angles, EntAngles);
}
}

SaveSprite(id, num, value, cls_num = 0, Float:Origin[3]={0.0, 0.0, 0.0}, Float:Angles=0.0)
{
switch(value)
{
case 0:
{
new Buffer[SYMBOL_ARRAY_BUFFER], Data[128];

ArrayGetString(SaveSymbols, num, Buffer, charsmax(Buffer));
formatex(Data, charsmax(Data), "%d %s %d %f %f %f %f", cls_num, Buffer, num, id ? SaveOrigin[id][0] : Origin[0], id ? SaveOrigin[id][1] : Origin[1], id ? SaveOrigin[id][2] : Origin[2], Angles);

write_file(SavePath, Data);
}
case 1:
{
new i;

while(i <= class_num)
{
SaveAllHandler(id, i++);
}
}
}
}

SaveAllHandler(id, num)
{
new Entity = rg_find_ent_by_class(NULLENT, fmt("%s-%d", ENTITY_CLASSNAME, num), false);

while(Entity > 0)
{
if(id && id == Entity)
{
set_entvar(Entity, var_flags, FL_KILLME);
set_entvar(Entity, var_nextthink, get_gametime() + 0.01);

Entity = rg_find_ent_by_class(Entity, fmt("%s-%d", ENTITY_CLASSNAME, num), false);

continue;
}

new Float:EntOrigin[3], Float:EntAngles[3];
get_entvar(Entity, var_origin, EntOrigin);
get_entvar(Entity, var_angles, EntAngles);

new ent_num = get_entvar(Entity, var_chain);

new Class[32]
get_entvar(Entity, var_classname, Class, charsmax(Class));

new Part1[2][6];
strtok(Class, Part1[0], charsmax(Part1[]), Part1[1], charsmax(Part1[]), '-');

SaveSprite(0, ent_num, 0, str_to_num(Part1[1]), EntOrigin, EntAngles[2]);

Entity = rg_find_ent_by_class(Entity, fmt("%s-%d", ENTITY_CLASSNAME, num), false);
}
}

ReadCoords()
{
if(!file_exists(SavePath)) return;

new Data[128], class_number[6], Symbol[6], num[6], Coord_X[13], Coord_Y[13], Coord_Z[13], Angles[13], Float:DataCoord[3];
new f = fopen(SavePath, "rt");

while(!feof(f))
{
fgets(f, Data, charsmax(Data));
trim(Data);

if(!Data[0]) continue;

parse(Data, class_number, charsmax(class_number), Symbol, charsmax(Symbol), num, charsmax(num), Coord_X, charsmax(Coord_X), Coord_Y, charsmax(Coord_Y), Coord_Z, charsmax(Coord_Z), Angles, charsmax(Angles));

DataCoord[0] = str_to_float(Coord_X);
DataCoord[1] = str_to_float(Coord_Y);
DataCoord[2] = str_to_float(Coord_Z);

CreateSprite(0, str_to_num(num), str_to_num(class_number), DataCoord, str_to_float(Angles));
}

class_num = str_to_num(class_number);

fclose(f);
}

@MoveHandler(id)
{
if(~get_user_flags(id) & ACCESS_FLAG) return;

new String[64];
read_argv(1, String, charsmax(String));

new Part1[32], Part2[32];
strtok(String, Part1, charsmax(Part1), Part2, charsmax(Part2), '.');

if(is_str_num(Part1) && is_str_num(Part2))
{
Move[id] = str_to_float(String);
}

@MoveMenu(id);
}

@MoveMenu(id)
{
new Menu[MAX_MENU_LENGTH], Keys = MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_6|MENU_KEY_7|MENU_KEY_0;
new Len = formatex(Menu, charsmax(Menu), "\r[\y%L\r] \w%L^n^n", id, "TWS_PREFIX", id, "TWS_MENU_ITEM_MOVE");

new Len1, BuffText[128];

if(class_num == 0)
{
Len1 += formatex(BuffText[Len1], charsmax(BuffText) - Len1, "%L", id, "TWS_MENU_MOVE_ERROR");
}
else
{
new Entity = rg_find_ent_by_class(NULLENT, fmt("%s-%d", ENTITY_CLASSNAME, Sign1[id]), false);

while(Entity > 0)
{
new ent_num = get_entvar(Entity, var_chain);

new Buffer[SYMBOL_ARRAY_BUFFER];
ArrayGetString(SaveSymbols, ent_num, Buffer, charsmax(Buffer));

Len1 += formatex(BuffText[Len1], charsmax(BuffText) - Len1, "%s", Buffer);

Entity = rg_find_ent_by_class(Entity, fmt("%s-%d", ENTITY_CLASSNAME, Sign1[id]), false);
}
}

Len += formatex(Menu[Len], charsmax(Menu) - Len, "\r[1] \y# \w%L \r[\y%s\r]^n", id, "TWS_MENU_MOVE_ITEM1", BuffText);

Len += formatex(Menu[Len], charsmax(Menu) - Len, "\r[2] \y# \w%L^n^n", id, "TWS_MENU_MOVE_ITEM2");

Len += formatex(Menu[Len], charsmax(Menu) - Len, "\r[3] \y# \w%L \r[\y%L\r]^n", id, "TWS_MENU_MOVE_ITEM3", id, fmt("TWS_MENU_MOVE_ITEM3_%d", Sign2[id]));

Len += formatex(Menu[Len], charsmax(Menu) - Len, "\r[4] \y# \w%L \r[\y%.2f\r]^n^n", id, "TWS_MENU_MOVE_ITEM4", Move[id]);

Len += formatex(Menu[Len], charsmax(Menu) - Len, "\r[5] \y# \w%L \r[\y%s\r]^n^n", id, "TWS_MENU_MOVE_ITEM5", MOVE_COORDS[Sign2[id] == 0 ? CheckCoords[id] + 4 : CheckCoords[id]]);

Len += formatex(Menu[Len], charsmax(Menu) - Len, "\r[6] \y# \w%L^n^n", id, "TWS_MENU_MOVE_ITEM6");

Len += formatex(Menu[Len], charsmax(Menu) - Len, "\r[7] \y# \w%L^n^n", id, "TWS_MENU_MOVE_ITEM7");

formatex(Menu[Len], charsmax(Menu) - Len, "\r[0] \y# \w%L", id, "TWS_MENU_BACK");
return show_menu(id, Keys, Menu, -1, "@MoveMenu");
}

@Handle_MoveMenu(id, Keys)
{
switch(Keys)
{
case 0:
{
if(class_num > 1)
{
if(Sign1[id] == class_num) Sign1[id] = 1;
else Sign1[id]++;
}
}
case 1:
{
if(class_num > 0)
{
new Entity = rg_find_ent_by_class(NULLENT, fmt("%s-%d", ENTITY_CLASSNAME, Sign1[id]), false);
new Float:DataCoord[3];

while(Entity > 0)
{
get_entvar(Entity, var_origin, DataCoord);
break;
}

DataCoord[0] -= 30.0;
DataCoord[1] -= 30.0;
DataCoord[2] += 50.0;

set_entvar(id, var_origin, DataCoord);
}
}
case 2:
{
Sign2[id] = (Sign2[id] + 1) % 2;
CheckCoords[id] = 0;
}
case 3:
{
client_cmd(id, "messagemode ^"MoveValue^"");
}
case 4:
{
if(Sign2[id] == 0)
{
CheckCoords[id] = (CheckCoords[id] + 1) % 2;
}
else
{
CheckCoords[id] = (CheckCoords[id] + 1) % sizeof MOVE_COORDS;
}
}
case 5:
{
MoveEntity(id, Sign2[id] == 0 ? CheckCoords[id] + 5 : CheckCoords[id] + 1);
}
case 6:
{
delete_file(SavePath);

new i;

while(i <= class_num)
{
SaveAllHandler(0, i++);
}
}
case 9:
{
@TwsMenu(id);
return;
}
}

@MoveMenu(id);
}

MoveEntity(id, mode)
{
new Entity = rg_find_ent_by_class(NULLENT, fmt("%s-%d", ENTITY_CLASSNAME, Sign1[id]), false);

while(Entity > 0)
{
new Float:DataCoord[3];
get_entvar(Entity, Sign2[id] == 1 ? var_origin : var_angles, DataCoord);

switch(mode)
{
case 1: DataCoord[0] += Move[id];
case 2: DataCoord[0] -= Move[id];
case 3: DataCoord[1] += Move[id];
case 4: DataCoord[1] -= Move[id];
case 5: DataCoord[2] += Move[id];
case 6: DataCoord[2] -= Move[id];
}

set_entvar(Entity, Sign2[id] == 1 ? var_origin : var_angles, DataCoord);

Entity = rg_find_ent_by_class(Entity, fmt("%s-%d", ENTITY_CLASSNAME, Sign1[id]), false);
}
}
Пожалуйста помогите, хотел поставить новый плагин, а он не кампилируится
 
В этой теме было размещено решение! Перейти к решению.

wellasgood

Кидала, мошенник, вымогатель
Сообщения
1,409
Реакции
182
Помог
2 раз(а)
Обратите внимание, если вы хотите заключить сделку с этим пользователем, он заблокирован
На 1.9.0 полет нормальный, скоро сделаю фикс, не учел...
22 Мар 2021
держи) просто в 1.10.0 уже занято это наименование
 

Вложения

Статус
В этой теме нельзя размещать новые ответы.

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу