Raised This Month: $ Target: $400
 0% 

ignore spawn entity if the spawn location used by any player


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Old.School
Senior Member
Join Date: Sep 2015
Location: France
Old 09-04-2016 , 13:14   ignore spawn entity if the spawn location used by any player
Reply With Quote #1

i need to make ignore spawn entity if the Spawn location is used by any player to prevent players stuck

PHP Code:
public NPCOrigin(id)
{
        
entity_get_vector(idEV_VEC_originfNPCOrigin)
}

public 
NPCCreate(id)
{  
        
iPlayer_ID id
 
        
if(iNPC_ID)
        {
                
remove_entity(iNPC_ID)
                
iNPC_ID 0
        
}
 
        
iNPC_ID create_entity("info_target")
 
        if(
pev_validiNPC_ID ))
        {
                
ColorChat(id,NORMAL,"^4[%L]^1 %L"LANG_PLAYER"PRIFIX"LANG_PLAYER"PET_CREATE")
        }else{
                return 
PLUGIN_HANDLED
        
}
 
        
entity_set_origin(iNPC_IDfNPCOrigin)
 
        
entity_set_float(iNPC_IDEV_FL_takedamage,1.0)
 
        new 
Float:fHealth floatget_pcvar_numg_Cvar[1] ))
        
entity_set_float(iNPC_IDEV_FL_healthfHealth)
 
        
entity_set_model(iNPC_IDgModel)
        
entity_set_string(iNPC_IDEV_SZ_classnamegClassname)
   
        
entity_set_int(iNPC_IDEV_INT_solidSOLID_BBOX)
        
entity_set_int(iNPC_IDEV_INT_movetypeMOVETYPE_PUSHSTEP)
 
        
entity_set_size(iNPC_IDFloat:{-16.0, -16.0, -36.0}, Float:{16.016.036.0})
 
        
entity_set_float(iNPC_IDEV_FL_nextthinkhalflife_time() + 0.01)
 
        
set_pev(iNPC_IDpev_enemy0)
        
entity_set_int(iNPC_IDEV_INT_gamestate,1)
 
        
entity_set_int(iNPC_IDEV_INT_sequence1)
        
entity_set_float(iNPC_IDEV_FL_animtimeget_gametime())
        
entity_set_float(iNPC_IDEV_FL_framerate,  1.0)
        
entity_set_float(iNPC_IDEV_FL_frame0.0)
 
        
RegisterHamFromEntity(Ham_KillediNPC_ID"NPCKilled")
 
        new 
iWeapon create_entity("info_target")
 
        
entity_set_int(iWeaponEV_INT_solidSOLID_NOT)
        
entity_set_int(iWeaponEV_INT_movetypeMOVETYPE_FOLLOW)
        
entity_set_edict(iWeaponEV_ENT_aimentiNPC_ID)
 
        return 
PLUGIN_HANDLED

__________________
You keep bringing B.R down .. He will rise again and kick Enemies asses !
Old.School is offline
Old 09-05-2016, 13:15
Old.School
This message has been deleted by HamletEagle. Reason: Wait 14 days before bump
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 09-05-2016 , 13:21   Re: ignore spawn entity if the spawn location used by any player
Reply With Quote #2

You can use tracehull to check if space is empty.
__________________
HamletEagle is offline
Old.School
Senior Member
Join Date: Sep 2015
Location: France
Old 09-05-2016 , 13:54   Re: ignore spawn entity if the spawn location used by any player
Reply With Quote #3

any example?
__________________
You keep bringing B.R down .. He will rise again and kick Enemies asses !
Old.School is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 09-06-2016 , 04:38   Re: ignore spawn entity if the spawn location used by any player
Reply With Quote #4

Search?
__________________
HamletEagle is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 09-06-2016 , 06:27   Re: ignore spawn entity if the spawn location used by any player
Reply With Quote #5

Just use below plugin:

[3 in 1] Fail Spawn Protector + Auto Spawn Creator + Team Limiter
zmd94 is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 09-06-2016 , 07:41   Re: ignore spawn entity if the spawn location used by any player
Reply With Quote #6

Maybe with EngFunc_FindEntityInSphere.

I just search a little and thats the most appropiate, read entire thread not only arkshine reply: https://forums.alliedmods.net/showpo...58&postcount=7


You can check if that sphere contain valid entities and then generate other coordinates(origin). + Check for entities valid with pev valid please.
__________________
Project: Among Us

Last edited by Craxor; 09-06-2016 at 07:44.
Craxor is offline
Send a message via ICQ to Craxor
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 09-06-2016 , 14:59   Re: ignore spawn entity if the spawn location used by any player
Reply With Quote #7

Yes, as Hamlet said, it's better to check if space is empty.
Because when a player is spawned he can stay in the same possition and not move, just being afk, and this can lead to the stuck, because this spawn point is not used anymore but space is not empty.
Or a player can just sit down in that spawn point to wait for an enemy, so better check for entities around the spawn.

Also it would be better if you check nearest entities from spawn because if you spawn and a player is aiming in that zone and he's near you ,he can just kill you and it won't be very nice in my opinion. Even if you use spawn protection than you will kill him with no sense because he can't damage you as you have godmode for some time.

Last edited by siriusmd99; 09-06-2016 at 15:04.
siriusmd99 is offline
KiLLeR.
Senior Member
Join Date: Jul 2014
Location: Bulgaria
Old 09-06-2016 , 15:05   Re: ignore spawn entity if the spawn location used by any player
Reply With Quote #8

Quote:
Originally Posted by Old.School View Post
any example?
PHP Code:
stock bool:is_spawn_location_empty(Float:origin[3]);
{
    
engfunc(EngFunc_TraceHulloriginoriginDONT_IGNORE_MONSTERSHULL_HUMAN00);
            
    if(!
get_tr2(0TR_AllSolid) && get_tr2(0TR_InOpen) && !get_tr2(0TR_StartSolid))
    {
        return 
true;
    }
    
    return 
false;


Last edited by KiLLeR.; 09-06-2016 at 15:12.
KiLLeR. 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 09:17.


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