AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   get origin - set origin [SOLVED!] (https://forums.alliedmods.net/showthread.php?t=76603)

anakin_cstrike 08-27-2008 10:38

get origin - set origin [SOLVED!]
 
Hi.
So,here's what i want. I want to revive a player and move to the spot where he died. It's posible with set origin ?

Alka 08-27-2008 10:52

Re: get origin - set origin
 
Yea, hook DeathMsg(), get player origin pev(id, pev_origin, vOrigin) ,then after you revive it set his origin engfunc(EngFunc_SetOrigin, id, vOrigin) .

anakin_cstrike 08-27-2008 11:01

Re: get origin - set origin
 
Ok, thanks.

PrEn1umz 08-27-2008 13:17

Re: get origin - set origin
 
This should help you.

Code:

#include <amxmodx>
#include <fakemeta>
#include <engine>
#include <fun>

new Float:g_DeathOrigin[33][3];

new pCVAR_autospawn;

public plugin_init()
{
    register_plugin("Death Respawn", "0.1.a", "PrEn1umz");
    register_event("DeathMsg", "Event_DeathMsg", "a");
   
    pCVAR_autospawn = register_cvar("amxx_autospawn", "1");
}

public Event_DeathMsg()
{
    if (get_pcvar_num(pCVAR_autospawn))
    {
        new id = read_data(2);
       
        pev(id, pev_origin, g_DeathOrigin[id]);
       
        set_task(0.5, "Task_Respawn", id + 123);
    }
}

public Task_Respawn(TaskID)
{
    new id = TaskID - 123;
   
    if (get_user_team(id) != 2 || is_user_alive(id))
    {
        return PLUGIN_CONTINUE;
    }
           
    spawn(id);
   
    engfunc(EngFunc_SetOrigin, id, g_DeathOrigin[id]);
   
    return PLUGIN_CONTINUE;
}


ConnorMcLeod 08-27-2008 13:20

Re: get origin - set origin
 
spawn(id) is a bad idea.
Read all posts from this snippet for more details : http://forums.alliedmods.net/showthread.php?t=76179

anakin_cstrike 08-27-2008 13:26

Re: get origin - set origin
 
@ PrEn1umz : nice but, why you are using engine ? fun module can be removed...

PrEn1umz 08-27-2008 13:34

Re: get origin - set origin
 
i'm using fun because of spawn() function.
I know it's not the best method, like connorr saids, but you can change it easily

anakin_cstrike 08-27-2008 13:38

Re: get origin - set origin
 
Quote:

Originally Posted by PrEn1umz (Post 676750)
i'm using fun because of spawn() function.
I know it's not the best method, like connorr saids, but you can change it easily

Yeah...it works, thanks.:up:


All times are GMT -4. The time now is 03:17.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.