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

Teleport {E}


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
headmaster
Member
Join Date: Jun 2016
Old 06-13-2016 , 16:51   Teleport {E}
Reply With Quote #1

Hello there, if someone could make me a mini plugin.
When player press button "E", he will teleport where he is aiming, + teleport is avab. on four(4) seconds. If he try to press E before timer, it will show in chat, you need to wait (left seconds).
Thank you very much.
headmaster is offline
headmaster
Member
Join Date: Jun 2016
Old 06-14-2016 , 03:34   Re: Teleport {E}
Reply With Quote #2

Anyone?!
headmaster is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 06-14-2016 , 11:25   Re: Teleport {E}
Reply With Quote #3

Why you don't look to Warcraft teleport function and try to make it by yourself?

It's not needed much rocket science , just copy paste and some modifications..
siriusmd99 is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 06-14-2016 , 11:38   Re: Teleport {E}
Reply With Quote #4

Just edit below:

https://forums.alliedmods.net/showthread.php?p=821615
zmd94 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 06-14-2016 , 11:46   Re: Teleport {E}
Reply With Quote #5

Code:
#include <amxmodx> #include <fakemeta> #include <xs> new const neededSound[] = "common/wpn_denyselect.wav" new maxPlayers new Float:nextGameTime[33] public plugin_init() {     maxPlayers = get_maxplayers()     register_forward(FM_EmitSound, "pfnEmitSound") } public pfnEmitSound(id, channel, const sound[], Float:volume, Float:attenuation, flags, pitch) {     if(1 <= id <= maxPlayers)     {         if(equal(sound, neededSound) && (pev(id, pev_button) & IN_USE))         {             new Float:currentGameTime = get_gametime()             if(currentGameTime >= nextGameTime[id])             {                 teleportPlayer(id)                 nextGameTime[id] = currentGameTime + 4.0                 return FMRES_SUPERCEDE             }             else             {                 client_print(id, print_chat, "You have to wait %.1f seconds", nextGameTime[id] - currentGameTime)             }         }     }         return FMRES_IGNORED } teleportPlayer(id) {     new Float:playerOrigin[3], Float:playerViewOffset[3]     pev(id, pev_origin, playerOrigin)     pev(id, pev_view_ofs, playerViewOffset)     xs_vec_add(playerOrigin, playerViewOffset, playerOrigin)         new Float:playerViewAngle[3]     pev(id, pev_v_angle, playerViewAngle)     engfunc(EngFunc_MakeVectors, playerViewAngle)     global_get(glb_v_forward, playerViewAngle)         xs_vec_mul_scalar(playerViewAngle, 9999.0, playerViewAngle)     xs_vec_add(playerOrigin, playerViewAngle, playerViewAngle)     new handleTraceLine, Float:traceLineEndPos[3], Float:traceFraction     engfunc(EngFunc_TraceLine, playerOrigin, playerViewAngle, DONT_IGNORE_MONSTERS, id, handleTraceLine)     get_tr2(0, TR_vecEndPos, traceLineEndPos)         new startDistance = 5     if(validSpotFound(id, traceLineEndPos))     {         set_pev(id, pev_origin, traceLineEndPos)     }     else     {         new restrictMaxSearches = 150, i, Float:foundOrigin[3]         while(--restrictMaxSearches > 0)         {             for(i = 0; i < 3; i++)             {                 foundOrigin[i] = random_float(traceLineEndPos[i] - startDistance , traceLineEndPos[i] + startDistance)             }                         engfunc(EngFunc_TraceLine, playerOrigin, foundOrigin, DONT_IGNORE_MONSTERS, id, handleTraceLine)             get_tr2(handleTraceLine, TR_flFraction, traceFraction)             free_tr2(handleTraceLine)                         if(traceFraction == 1.0)             {                 if(validSpotFound(id, foundOrigin))                 {                     set_pev(id, pev_origin, foundOrigin)                     break                 }             }                         startDistance = startDistance + 1         }     } } bool:validSpotFound(id, Float:Origin[3]) {     new handleTraceHull     engfunc(EngFunc_TraceHull, Origin, Origin, DONT_IGNORE_MONSTERS, pev(id, pev_flags) & FL_DUCKING ? HULL_HEAD : HULL_HUMAN, id, handleTraceHull)        if(get_tr2(handleTraceHull, TR_InOpen) && !(get_tr2(handleTraceHull, TR_StartSolid) || get_tr2(handleTraceHull, TR_AllSolid)))     {         return true     }            return false }

Here it is.

Quote:
Originally Posted by zmd94 View Post
Quote:
Originally Posted by siriusmd99 View Post
Why you don't look to Warcraft teleport function and try to make it by yourself?

It's not needed much rocket science , just copy paste and some modifications..
:facepalm:


You forget that this section is for request, not scripting help. Most server admins can't change some defines inside source code. Just do what OP wants or ignore the post.
__________________

Last edited by HamletEagle; 06-14-2016 at 11:51.
HamletEagle is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 06-14-2016 , 11:55   Re: Teleport {E}
Reply With Quote #6

HamletEagle, will use your method for the teleport feature. ;)
zmd94 is offline
headmaster
Member
Join Date: Jun 2016
Old 06-14-2016 , 12:21   Re: Teleport {E}
Reply With Quote #7

HamletEagle, thank you very much for plugin, i really appreciacte your help man! .
headmaster 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:49.


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