Jump to content
GIGN Forum

Plugins Teleportē Ne Tur Kur Vajag


Recommended Posts

Kas ir kāpēc viņš teleportē debesīs nevis koordinātās, kur es uzlieku startu /setstart?

Vai pie vainas ir tas, ka kompilējot rādās tag mismatch 43( janemaldos rindiņā)?

Palīdziet, esmu jauns iekš Pawn.

#include <amxmodx>

#include <amxmisc>

#include <fun> // For some Adminstuf

#include <engine> // My most used module ;o

#include <fakemeta>

#pragma semicolon 1

new g_Mapname[64], g_Filename[128];

public plugin_init()

{

register_plugin("Start position", "1.0", "PrEn1umz");

register_clcmd("say /start", "goStart");

register_clcmd("say /setstart", "setStart", ADMIN_MAP, "");

register_clcmd("say /delstart", "delStart", ADMIN_MAP, "");

get_mapname(g_Mapname, 63);

format(g_Filename, 127, "addons/amxmodx/configs/start/%s.txt", g_Mapname);

}

public goStart(id)

{

if (file_exists(g_Filename))

{

new temp[64], pos[3], str1[13], str2[13], str3[13];

new file = fopen(g_Filename, "rt");

while(!feof(file))

{

fgets(file, temp, 63);

parse(temp, str1, 12, str2, 12, str3, 12);

pos[0] = str_to_num(str1);

pos[1] = str_to_num(str2);

pos[2] = str_to_num(str3);

client_print(id, print_chat, "%d - 1", pos[0]);

client_print(id, print_chat, "%d - 2", pos[1]);

client_print(id, print_chat, "%d - 3", pos[2]);

new Float:origin[3];

//engfunc(EngFunc_SetOrigin, id, pos);

entity_get_vector(id,EV_VEC_origin,origin);

entity_set_origin(id,pos);

entity_set_vector(id,EV_VEC_velocity,Float:{0.0,0.0,0.0});

}

client_print(id, print_chat, "* Tu tiki teleporteets uz startu");

fclose(file);

}

else

{

client_print(id, print_chat, "* Nav uzlikta starta poziicija");

}

}

public setStart(id, level, cid)

{

if (!cmd_access(id, level, cid, 1))

{

client_print(id, print_chat, "* Rokas nost");

return PLUGIN_HANDLED;

}

if (file_exists(g_Filename))

{

client_print(id, print_chat, "* Starta poziicija jau ir uzlikta. Raksti /delstart");

}

else

{

new i[3], temp[128];

get_user_origin(id, i);

format(temp, 127, "%d %d %d", i[0], i[1], i[2]);

write_file(g_Filename, temp, 0);

client_print(id, print_chat, "* Starta poziicija uzlikta");

}

return PLUGIN_HANDLED;

}

public delStart(id, level, cid)

{

if (!cmd_access(id, level, cid, 1))

{

client_print(id, print_chat, "* Rokas nost");

return PLUGIN_HANDLED;

}

if (file_exists(g_Filename))

{

delete_file(g_Filename);

client_print(id, print_chat, "* Starta pozicija izdzeesta");

}

else

{

client_print(id, print_chat, "* Nav starta pozicijas");

}

return PLUGIN_HANDLED;

}

Edited by w4p1337
Link to comment
Share on other sites

Nezinu, vai ta ir vieniga problema, bet pamegini:

http://www.amxmodx.org/funcwiki.php?search=entity_set_origin&go=search

entity_set_origin ( entity, Float:NewOrigin[3] )

F-ja jabut Float'am... , bet tava koda ir vienkarshi- new pos[3];

Float'u itka defineja new Float:pos[3],

pec tam jabut pos[0] = str_to_float(...)

bet sen neesmu kodejis, tapec parbaudi.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...