Raised This Month: $51 Target: $400
 12% 

Teleporting player to an entity


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SpirT
Senior Member
Join Date: Sep 2018
Location: Portugal
Old 04-24-2020 , 05:14   Teleporting player to an entity
Reply With Quote #1

Hey guys.

If possible I want to know:
- Where the TA Grenade explodes, I want to get the TA Grenade position, as well I would need to get Client Angles,

- Then when it explodes check if client as access to ADMFLAG_RESERVATION

- If yes, then teleport the client to the Grenade position.

Is that possible?

Waiting for your reply and wish you all the best,

SpirT.
__________________
SpirT is online now
FrAgOrDiE
AlliedModders Donor
Join Date: May 2018
Location: Italy
Old 04-24-2020 , 06:58   Re: Teleporting player to an entity
Reply With Quote #2

yes, you can hook event "tagrenade_detonate": https://wiki.alliedmods.net/Counter-...enade_detonate
you can retreive the position getting x, y and z positions in the event callback: https://sm.alliedmods.net/new-api/events/Event/GetFloat
https://sm.alliedmods.net/new-api/cl...etUserFlagBits for getting user flags. (Check if flag & ADMFLAG_RESERVATION)
then simply teleport with: https://sm.alliedmods.net/new-api/sd...TeleportEntity
Get client angles with https://sm.alliedmods.net/new-api/sd...lientEyeAngles
__________________
Add me on discord: FrAgOrDiE#5182
Add me on steam: https://steamcommunity.com/id/fragordie002/
Join my discord server: http://discord.gg/JpAUXMn
FrAgOrDiE is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 04-24-2020 , 07:07   Re: Teleporting player to an entity
Reply With Quote #3

- I don't see event in game when tagrenade_projectile explode or destroyed.
*edit
This is odd. When I hooked event, then it start working in net_showevents 2 :S
Spoiler





- Start use CheckCommandAccess, it's flexible, not need re-compile plugin or create Convars for "flags".


updated, using event.
PHP Code:
#include <sdktools>


public void OnPluginStart()
{
    
HookEventEx("tagrenade_detonate"tagrenade_detonate);
}

public 
void tagrenade_detonate(Event event, const char[] namebool dontBroadcast)
{
    
int client GetClientOfUserId(event.GetInt("userid"));

    if(
client == 0) return;

    if(!
IsClientInGame(client) || IsFakeClient(client) || GetClientTeam(client) <= || !IsPlayerAlive(client)) return;

    if(!
CheckCommandAccess(client"weapon_tagrenade_teleport"ADMFLAG_RESERVATION)) return;


    
// Player eye angle ?
    //float ang[3];
    //GetClientEyeAngles(client, ang);

    
float pos[3];
    
pos[0] = event.GetFloat("x");
    
pos[1] = event.GetFloat("y");
    
pos[2] = event.GetFloat("z");
    
    
TeleportEntity(clientposNULL_VECTORNULL_VECTOR);




old
__________________
Do not Private Message @me

Last edited by Bacardi; 04-24-2020 at 07:30.
Bacardi 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 17:25.


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