Quote:
Originally Posted by Hunter-Digital
You really have no ideea what you are doing there.
|
Not much, but you are teaching me a lot (i think)
============================================= ========================
Quote:
portal_touch() for is called by register_touch() wich sends the toucher and touched entities (in your case the portal entity number and the player's entity number) and of course it sends you to 0 0 0 because "exOrigin" is not filled by anything.
|
Yeah, now i understand this part, but why exOrigin is not filled if in this part i fill it:
PHP Code:
new exOrigin[3]
get_user_origin(id, exOrigin)
But itīs wrong, i think that in the touch i should get the portal origin, but i donīt know how to do this
EDIT: At last iīve done somethig myself ^^! i fill the coordinates variable using this
PHP Code:
public portal_touch(ent, id)
{
new Float: fTeleportOrigin[3]
entity_get_vector(ent, EV_VEC_origin, fTeleportOrigin)
new iTeleportOrigin[3]
FVecIVec(fTeleportOrigin, iTeleportOrigin)
if(!Exit)
{
client_print(id, print_center, "Create A Exit Portal First")
}
else
{
set_user_origin(id, iTeleportOrigin)
client_print(id,print_center,"You have been teleported")
}
}
But is not done, this get the origin of the portal entrance and, if i put this code in the exit portal creation and if I add iTeleportOrigin[3] to the param of the touch doesnīt work
If i put in the param:
PHP Code:
public portal_touch( iTeleportOrigin[3], ent, id)
Nothing happens when i touch the portal
PHP Code:
public portal_touch(ent, iTeleportOrigin[3], id)
Teleport to 0 0 0
PHP Code:
public portal_touch(ent, id, iTeleportOrigin[3])
Nothing happens when i touch the portal
Portal Exit Creation:
PHP Code:
public create_portal2(exOrigin[3], id)
{
new Float:fOrigin[3]
new ent = create_entity("env_sprite")
IVecFVec(exOrigin, fOrigin)
entity_set_string(ent, EV_SZ_classname, "portal_exit")
entity_set_model(ent, "sprites/e-tele1.spr")
entity_set_int(ent, EV_INT_spawnflags, SF_SPRITE_STARTON)
entity_set_float(ent, EV_FL_framerate, 30.0)
DispatchSpawn(ent)
entity_set_origin(ent, fOrigin)
entity_set_size(ent, Float:{-25.0, -25.0, -25.0}, Float:{25.0, 25.0, 25.0})
entity_set_int(ent, EV_INT_solid, SOLID_TRIGGER)
entity_set_int(ent, EV_INT_movetype, MOVETYPE_FLY)
entity_set_int(ent, EV_INT_rendermode, kRenderTransAdd)
entity_set_float(ent, EV_FL_renderamt, 255.0)
entity_set_float(ent, EV_FL_scale, 1.0)
client_print(0, print_chat, "%d created portal (%d)", id, ent)
Exit = true
new Float: fTeleportOrigin[3]
entity_get_vector(ent, EV_VEC_origin, fTeleportOrigin)
new iTeleportOrigin[3]
FVecIVec(fTeleportOrigin, iTeleportOrigin)
}
If I make a task:
PHP Code:
set_task(0.1, "Teleport", id, iTeleportOrigin, 3)
client_print(id,print_center,"You have been teleported")
}
}
public Teleport(id, iTeleportOrigin[3])
{
set_user_origin(id, iTeleportOrigin)
client_print(id, print_chat, "Teleported..")
}
The console say:
PHP Code:
L 09/03/2010 - 17:30:32: [FUN] Player out of range (1724)
L 09/03/2010 - 17:30:32: [AMXX] Displaying debug trace (plugin "portal.amxx")
L 09/03/2010 - 17:30:32: [AMXX] Run time error 10: native error (native "set_user_origin")
L 09/03/2010 - 17:30:32: [AMXX] [0] portal.sma::Teleport (line 54)
EDIT 2: Solved^^ Iīve made the teleport origin a global variable and works ^^
============================================= ===========================
Quote:
It's better to delete the portal when another of the same type is created, and yeah, in the same function.
|
Shoul i use a bool to check it the portal is created, and if is created, delete it and create the new portal?
============================================= ==============================
Quote:
And how are "+" commands easier than non-"+" commands ? I just use "test" command that I have bound by default to V in my game so when I test something I just press V :}
|
yes, i already binded "say /portal_entrance"
============================================= =============================
Quote:
So basically, you don't have anything sorted out, you need to save origins, make functions simplier so you don't just copy paste code all over the place... etc.
|
Yeah, i know it but i canīt this before i undestand all the code & functions
Thank you again for your help
============================================= ==============================
Sorry for teh annoying cuantity of word but i want to put my problem more detailed ;)
__________________