View Single Post
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