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_fPositions[ 32 ][ 3 ];
new Float:g_fAngles[ 32 ][ 3 ];
new g_iVehicles[ 32 ];
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_class( iEnt,"func_vehicle" ) ) != 0 )
{
if( is_valid_ent( iEnt ) )
{
g_iVehicles[g_iCount] = iEnt;
pev(iEnt, pev_origin, g_fPositions[g_iCount]);
pev(iEnt, pev_angles, g_fAngles[g_iCount]);
g_iCount++;
}
}
}
public ClCmdReset(iClient)
{
if( get_user_flags( iClient ) & ADMIN_RESERVATION )
{
for(new i = 0; i < g_iCount; i++)
{
set_pev(g_iVehicles[i], pev_origin, g_fPositions[i]);
set_pev(g_iVehicles[i], pev_angles, g_fAngles[i]);
set_pev(g_iVehicles[i], pev_fixangle, 1);
//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?