Raised This Month: $ Target: $400
 0% 

get origin - set origin [SOLVED!]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
anakin_cstrike
Veteran Member
Join Date: Nov 2007
Location: Romania
Old 08-27-2008 , 10:38   get origin - set origin [SOLVED!]
Reply With Quote #1

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 ?
__________________


Last edited by anakin_cstrike; 08-28-2008 at 10:35.
anakin_cstrike is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 08-27-2008 , 10:52   Re: get origin - set origin
Reply With Quote #2

Yea, hook DeathMsg(), get player origin pev(id, pev_origin, vOrigin) ,then after you revive it set his origin engfunc(EngFunc_SetOrigin, id, vOrigin) .
Alka is offline
anakin_cstrike
Veteran Member
Join Date: Nov 2007
Location: Romania
Old 08-27-2008 , 11:01   Re: get origin - set origin
Reply With Quote #3

Ok, thanks.
__________________

anakin_cstrike is offline
PrEn1umz
Junior Member
Join Date: Feb 2007
Location: Nice, France
Old 08-27-2008 , 13:17   Re: get origin - set origin
Reply With Quote #4

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;
}
PrEn1umz is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-27-2008 , 13:20   Re: get origin - set origin
Reply With Quote #5

spawn(id) is a bad idea.
Read all posts from this snippet for more details : http://forums.alliedmods.net/showthread.php?t=76179
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
anakin_cstrike
Veteran Member
Join Date: Nov 2007
Location: Romania
Old 08-27-2008 , 13:26   Re: get origin - set origin
Reply With Quote #6

@ PrEn1umz : nice but, why you are using engine ? fun module can be removed...
__________________

anakin_cstrike is offline
PrEn1umz
Junior Member
Join Date: Feb 2007
Location: Nice, France
Old 08-27-2008 , 13:34   Re: get origin - set origin
Reply With Quote #7

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
PrEn1umz is offline
anakin_cstrike
Veteran Member
Join Date: Nov 2007
Location: Romania
Old 08-27-2008 , 13:38   Re: get origin - set origin
Reply With Quote #8

Quote:
Originally Posted by PrEn1umz View Post
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.
__________________

anakin_cstrike is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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