Raised This Month: $32 Target: $400
 8% 

[Help] Resetting func_vehicle


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
marcelowzd
Senior Member
Join Date: Feb 2011
Location: São Paulo, Brazil
Old 12-10-2017 , 00:03   [Help] Resetting func_vehicle
Reply With Quote #1

Hello guys,

I'm trying to make the boats go back to where they spawn by typing /reset in nb_noobgame4 or whatever map that has func_vehicle listed

Currently i have the following code

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <engine>
#include <fakemeta>

new Float:g_fPositions32 ][ ];
new 
Float:g_fAngles32 ][ ];
new 
g_iVehicles32 ];
new 
g_iCount;

public 
plugin_init()
{
    
register_plugin("FVR""1""Test");

    
register_clcmd("say /reset""ClCmdReset");
}

public 
plugin_cfg()
{
    new 
iEnt = -1;

    while( ( 
iEnt find_ent_by_classiEnt,"func_vehicle" ) ) != )
    {
        if( 
is_valid_entiEnt ) )
        {
            
g_iVehicles[g_iCount] = iEnt;

            
pev(iEntpev_origing_fPositions[g_iCount]);
            
pev(iEntpev_anglesg_fAngles[g_iCount]);

            
g_iCount++;
        }
    }
}

public 
ClCmdReset(iClient)
{
    if( 
get_user_flagsiClient ) & ADMIN_RESERVATION )
    {
        for(new 
0g_iCounti++)
        {
            
set_pev(g_iVehicles[i], pev_origing_fPositions[i]);
            
set_pev(g_iVehicles[i], pev_anglesg_fAngles[i]);
            
set_pev(g_iVehicles[i], pev_fixangle1);

            
//dllfunc(DLLFunc_Spawn, i); // Did not work
        
}
    }

    return 
PLUGIN_HANDLED;

It works fine to find the entities and store them, but when i try to reset only the model goes
back to where it spawned and i can't use the vehicle anymore (some of them work, some of them don't), so what could be done here?
marcelowzd is offline
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 12-10-2017 , 06:14   Re: [Help] Resetting func_vehicle
Reply With Quote #2

try Ham_CS_Restart instead of set_pevs
__________________
retired chump
DjSoftero is offline
marcelowzd
Senior Member
Join Date: Feb 2011
Location: São Paulo, Brazil
Old 12-10-2017 , 08:34   Re: [Help] Resetting func_vehicle
Reply With Quote #3

Quote:
Originally Posted by DjSoftero View Post
try Ham_CS_Restart instead of set_pevs
This worked, thanks, but just to let people know that you still have to save its angles and set them even with Ham_CS_Restart

Last edited by marcelowzd; 12-10-2017 at 08:34.
marcelowzd is offline
silsfocs
Member
Join Date: Oct 2016
Location: Ocidental Praia Lusitana
Old 12-10-2017 , 11:24   Re: [Help] Resetting func_vehicle
Reply With Quote #4

hey, can you post the fixed code?
silsfocs 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 07:06.


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