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

[HELP] Teleport position


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
brhvitor6
Member
Join Date: Oct 2012
Old 11-11-2012 , 13:41   [HELP] Teleport position
Reply With Quote #1

Hey guys, i'm trying to make a function that the player can save his location and teleport to the same location after.... but when the player use the teleport funcion he is sent to a totaly different location.

here is my code:
PHP Code:

stock GetCollisionPoint
(clientFloat:pos[3])
{
    
decl Float:vOrigin[3], Float:vAngles[3];

    
GetClientEyePosition(clientvOrigin);
    
GetClientEyeAngles(clientvAngles);
   
    new 
Handle:trace TR_TraceRayFilterEx(vOriginvAnglesMASK_SHOTRayType_InfiniteTraceEntityFilterPlayerclient);
   
    if(
TR_DidHit(trace))
    {
        
TR_GetEndPosition(postrace);
        
CloseHandle(trace);
       
        return;
    }
   
    
CloseHandle(trace);
}


        
GetCollisionPoint(id,PlayerOrigin);
        
TeleportOrigin[0] = PlayerOrigin[0];
        
TeleportOrigin[1] = PlayerOrigin[1];
        
TeleportOrigin[2] = PlayerOrigin[2]; 
what i can do?
brhvitor6 is offline
brhvitor6
Member
Join Date: Oct 2012
Old 11-11-2012 , 18:19   Re: [HELP] Teleport position
Reply With Quote #2

guys, i discovered the real problem, it's with the StringExplode

decl String:buff[512][512];
ExplodeString(name, ":", buff, sizeof(buff),sizeof(buff[]));
PlayerTeleport[0] = buff[0][0];
PlayerTeleport[1] = buff[1][0];
PlayerTeleport[2] = buff[2][0];


the returned value is 0.. what can i do? and how i can fix the error that says the buff isn't "big" enough
brhvitor6 is offline
11530
Veteran Member
Join Date: Sep 2011
Location: Underworld
Old 11-12-2012 , 01:49   Re: [HELP] Teleport position
Reply With Quote #3

Try the following:

https://forums.alliedmods.net/showpo...71&postcount=7

According to that post, you're going to have to add an array for individual locations yourself, but wouldn't be too difficult.
__________________

Last edited by 11530; 11-12-2012 at 01:52.
11530 is offline
brhvitor6
Member
Join Date: Oct 2012
Old 11-12-2012 , 13:26   Re: [HELP] Teleport position
Reply With Quote #4

thx but.. the problem is with the StrigExplode...

Quote:
decl String:buff[512][512];
ExplodeString(name, ":", buff, sizeof(buff),sizeof(buff[]));
PlayerTeleport[0] = buff[0][0];
PlayerTeleport[1] = buff[1][0];
PlayerTeleport[2] = buff[2][0];


the returned value is 0.. what can i do? and how i can fix the error that says the buff isn't "big" enough
can you help me?
brhvitor6 is offline
GsiX
gee, six eggs
Join Date: Aug 2012
Location: Land Below The Wind
Old 11-12-2012 , 13:58   Re: [HELP] Teleport position
Reply With Quote #5

Your array isn't correct... why don't you post something we can discuss?
__________________
If i happen to insulted you unintentionally,
it was me and Google Translate who did it.
GsiX is offline
11530
Veteran Member
Join Date: Sep 2011
Location: Underworld
Old 11-12-2012 , 14:03   Re: [HELP] Teleport position
Reply With Quote #6

Well how about posting a typical example of what buff can contain, plus a description of what you actually want in the string buffers. Maybe then we can start to help. Providing this information in the first place would have helped you much more quickly.
__________________
11530 is offline
minimoney1
SourceMod Donor
Join Date: Dec 2010
Old 11-12-2012 , 16:20   Re: [HELP] Teleport position
Reply With Quote #7

Quote:
Originally Posted by brhvitor6 View Post
guys, i discovered the real problem, it's with the StringExplode

decl String:buff[512][512];
ExplodeString(name, ":", buff, sizeof(buff),sizeof(buff[]));
PlayerTeleport[0] = buff[0][0];
PlayerTeleport[1] = buff[1][0];
PlayerTeleport[2] = buff[2][0];


the returned value is 0.. what can i do? and how i can fix the error that says the buff isn't "big" enough
Are you serious?
I'm assuming PlayerTeleport is a vector; if so, then you need to use StringToFloat()
__________________
Need help? PM me or add me on Steam.
My Steam




Quote:
Originally Posted by Rp.KryptoNite View Post
For some reason his Plugin never worked for me ,
@credits were added
im not stealing any plugins dude its my THING
minimoney1 is offline
brhvitor6
Member
Join Date: Oct 2012
Old 11-12-2012 , 19:24   Re: [HELP] Teleport position
Reply With Quote #8

Quote:
decl String:buff[512][512];
SQL_FetchString(hndl, 2, name, sizeof(name));
ExplodeString(name, ":", buff, sizeof(buff),sizeof(buff[]));
PlayerTeleport[0] = StringToFloat(buff[0][0]);
PlayerTeleport[1] = StringToFloat(buff[1][0]);
PlayerTeleport[2] = StringToFloat(buff[2][0]);
like this? but still givin error in when i try to use it (no error during compilation)
brhvitor6 is offline
minimoney1
SourceMod Donor
Join Date: Dec 2010
Old 11-12-2012 , 21:24   Re: [HELP] Teleport position
Reply With Quote #9

No. Take off the [0] after buff[0], buff[1], and buff[2].
__________________
Need help? PM me or add me on Steam.
My Steam




Quote:
Originally Posted by Rp.KryptoNite View Post
For some reason his Plugin never worked for me ,
@credits were added
im not stealing any plugins dude its my THING
minimoney1 is offline
brhvitor6
Member
Join Date: Oct 2012
Old 11-13-2012 , 19:27   Re: [HELP] Teleport position
Reply With Quote #10

giving this error: [SM] Plugin encountered error 8: Not enough space on the stack
brhvitor6 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 05:28.


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