Raised This Month: $ Target: $400
 0% 

respawn players where is the entity


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
apocalips
Member
Join Date: Aug 2008
Old 09-04-2009 , 10:56   respawn players where is the entity
Reply With Quote #1

How can I make an entity where to revive players ,please give examples .
apocalips is offline
Send a message via Yahoo to apocalips
apocalips
Member
Join Date: Aug 2008
Old 09-04-2009 , 10:57   Re: respawn players where is the entity
Reply With Quote #2

Code:
public revive(id)
{

new reviveEnt = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString,"info_target"));
 

 set_pev(reviveEnt, pev_classname, "revive");
 get_user_origin(id, aimVector, 3)
 
 
 IVecFVec(aimVector, fOrigin);
 
 set_pev(reviveEnt, pev_origin, fOrigin);

 engfunc(EngFunc_SetModel, reviveEnt, reviveModel);

set_pev(reviveEnt,pev_solid,SOLID_BBOX);

set_pev(reviveEnt,pev_health,500.0);
set_pev(reviveEnt,pev_max_health,500.0);
    
set_pev(reviveEnt,pev_takedamage,DAMAGE_AIM)

engfunc(EngFunc_SetSize, reviveEnt, Float:{-30.0, -30.0, -10.0}, Float:{30.0, 30.0, 10.0} )



return FMRES_IGNORED
}

 
public respawn_player(id,reviveEnt)
{
    
    
    if(!pev_valid(reviveEnt))
    return FMRES_IGNORED;

    new classname[32]
    pev(reviveEnt,pev_classname,classname,31)

    if(!equal(classname, "revive"))  
        return FMRES_IGNORED;
    
    
    
    entity_get_vector(reviveEnt,EV_VEC_origin,g_origin)
    
    if (!is_user_connected(id) || is_user_alive(id) || cs_get_user_team(id) == CS_TEAM_SPECTATOR)
    return;

    
    
    set_pev(id, pev_deadflag, DEAD_RESPAWNABLE)
    dllfunc(DLLFunc_Think, id)
        
    dllfunc(DLLFunc_Spawn, id)
    
    
    

    
    g_origin[2] += 60
    entity_set_origin(id, g_origin);

}
I tried but not work ,and sorry for double post

Last edited by Exolent[jNr]; 09-04-2009 at 14:06. Reason: Added [CODE] tags.
apocalips is offline
Send a message via Yahoo to apocalips
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 09-04-2009 , 14:06   Re: respawn players where is the entity
Reply With Quote #3

Use [CODE], [PHP], or [PAWN] tags next time.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Jon
Veteran Member
Join Date: Dec 2007
Old 09-05-2009 , 07:12   Re: respawn players where is the entity
Reply With Quote #4

  1. Create the entity in plugin_init and set it's origin, store its index in a global variable.
  2. When reviving players, respawn them and set their origin to the entity's.
Jon is offline
apocalips
Member
Join Date: Aug 2008
Old 09-05-2009 , 16:20   Re: respawn players where is the entity
Reply With Quote #5

please give examples
apocalips is offline
Send a message via Yahoo to apocalips
Jon
Veteran Member
Join Date: Dec 2007
Old 09-06-2009 , 05:02   Re: respawn players where is the entity
Reply With Quote #6

If you want us to give you the full code you posted in the wrong section.
Jon is offline
apocalips
Member
Join Date: Aug 2008
Old 09-06-2009 , 05:12   Re: respawn players where is the entity
Reply With Quote #7

one example does not mean all code
apocalips is offline
Send a message via Yahoo to apocalips
Jon
Veteran Member
Join Date: Dec 2007
Old 09-06-2009 , 06:01   Re: respawn players where is the entity
Reply With Quote #8

PHP Code:
#include <amxmodx>
#include <engine>

new g_iEnt;
new 
g_fEntOrigin] = {  ......... }

public 
plugin_init()
{
    
register_plugin"""""" );
    
    
register_event"DeathMsg""EventDeathMsg""a" );
    
    
g_iEnt create_entity"info_target" );
    
entity_set_modeliEnt, .....
    
entity_set_intiEntEV_INT_solidSOLID_BBOX );
    
entity_set_sizeiEnt, .....
    
entity_set_vectoriEntEV_VEC_origin, ....
    
    
// More stuff....
    
    
}

public 
EventDeathMsg()
{
    new 
iVictim read_data);
    
    
// Respawn victim 
    
    // Maybe add an offset to the Z axis of the entity origin to make the player spawn on it
    // g_fEntOrigin[ 2 ] += something
    
    
entity_set_originiVictimg_fEntOrigin );

Jon is offline
apocalips
Member
Join Date: Aug 2008
Old 09-06-2009 , 11:42   Re: respawn players where is the entity
Reply With Quote #9

Thank you for your example, but i want to make the entity during the game, not in the beginning of it, the problem is after i make the entity i don't seem to determine if it exists and its location
apocalips is offline
Send a message via Yahoo to apocalips
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 09-06-2009 , 13:07   Re: respawn players where is the entity
Reply With Quote #10

Here's an example.
Code:
#include <engine>   new Float:g_vecLocation[3];   public fnSaveLocation(iClient) {         // Let's save Client's location to g_vecLocation         entity_get_vector(iClient, EV_VEC_origin, g_vecLocation);         // g_vecLocation now holds the origin of Client }   public fnSpawnAndTeleport() {         // Let's create and spawn the Entity         new iEntity = create_entity("whatever_classname");           DispatchSpawn(iEntity);           // We can also check if created Entity is valid         if (!is_valid_ent(iEntity))                 return;           // Now we can teleport the Entity to the location         // that is saved in g_vecLocation         entity_set_origin(iEntity, g_vecLocation);         // Done }
__________________

Last edited by hleV; 09-06-2009 at 13:12.
hleV 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 15:14.


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