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

Return Vector


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mr. Zero
Veteran Member
Join Date: Jun 2009
Location: Denmark
Old 12-20-2009 , 20:52   Return Vector
Reply With Quote #1

How does one return a vector?

PHP Code:
//In Main Script
new Float:g_fMap_End_Point[3];

GetMapInfo()
{
    
g_fMap_End_Point GetMapEndOrigin();
}

//In Included Script
Float:GetMapEndOrigin()
{
    return 
MapInfo[MapId][End_Point];
}

InitializeMapInformation()
{
    
MapInfo[13][End_Point][0]         = 3993.458008;
    
MapInfo[13][End_Point][1]         = -1598.952271;
    
MapInfo[13][End_Point][2]         = 294.281250;

Mr. Zero is offline
Dragonshadow
BANNED
Join Date: Jun 2008
Old 12-20-2009 , 20:58   Re: Return Vector
Reply With Quote #2

Uhm, I think you need to return the mapinfo bit from the function that sets it. (initializemapinformation)
Dragonshadow is offline
Mr. Zero
Veteran Member
Join Date: Jun 2009
Location: Denmark
Old 12-20-2009 , 21:08   Re: Return Vector
Reply With Quote #3

Wont do. That initialize function will only run upon plugin start up as it sets a lot of variables (atleast 200), and lags the game enough to be noticeable. I need the map info every round.

Also I cant fit the GetMapInfo function into the initialize function. These functions are in two spectate scripts, hence they don't have the same pair of global variables.
Mr. Zero is offline
Kigen
BANNED
Join Date: Feb 2008
Old 12-20-2009 , 21:50   Re: Return Vector
Reply With Quote #4

PHP Code:
//In Main Script
new Float:g_fMap_End_Point[3];

GetMapInfo()
{
    
g_fMap_End_Point GetMapEndOrigin();
}

//In Included Script
GetMapEndOrigin(Float:output[3])
{
    
output MapInfo[MapId][End_Point];
}

InitializeMapInformation()
{
    
MapInfo[13][End_Point][0]         = 3993.458008;
    
MapInfo[13][End_Point][1]         = -1598.952271;
    
MapInfo[13][End_Point][2]         = 294.281250;

Have fun. Side note, you cannot return data arrays. You can only return a single point of data (a pointer basically).
Kigen 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:50.


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