Liberty Unleashed
Scripting => Script Help => Topic started by: rwwpl on November 06, 2014, 09:19:32 pm
-
I have problem with .Respawn();
else if (c == "respawnall")
{
for(local a = 0; a < GetVehicleCount(); a ++)
{
local vee = FindVehicle(a);
if(vee) vee.Respawn();
}
}
Error:
<06/11/2014 - 22:17:19>
AN ERROR HAS OCCURED [the index 'Respawn' does not exist]
<06/11/2014 - 22:17:19>
CALLSTACK
<06/11/2014 - 22:17:19> *FUNCTION [onPlayerCommand()] ... line [2917]
<06/11/2014 - 22:17:19>
LOCALS
<06/11/2014 - 22:17:19> [plrs] 1
<06/11/2014 - 22:17:19> [a] 1
<06/11/2014 - 22:17:19> [veh] NULL
<06/11/2014 - 22:17:19> [i] NULL
<06/11/2014 - 22:17:19> [plr] INSTANCE
<06/11/2014 - 22:17:19> [c] "respawnall"
<06/11/2014 - 22:17:19> [temp] NULL
<06/11/2014 - 22:17:19> [t] NULL
<06/11/2014 - 22:17:19> [c] "respawnall"
<06/11/2014 - 22:17:19> [p] INSTANCE
<06/11/2014 - 22:17:19> [this] TABLE
-
for(local a = 0; a < GetVehicleCount(); a ++)
to
for(local a = 0; a < ( GetVehicleCount() - 1 ); a ++)
-
for(local a = 0; a < GetVehicleCount(); a ++)
to
for(local a = 0; a < ( GetVehicleCount() - 1 ); a ++)
Doesn't work... the same error
-
As Vortrex said...
Vehicles <- { };
function onServerStart ( ) {
local count = 0;
while ( count <= MAX_VEHICLES ) {
if ( FindVehicle ( count ) != null ) {
Vehicles [ count ] <- FindVehicle ( count );
}
count ++;
}
}
cmd:
if ( c == "respawnall" ) {
foreach ( ii, iv in Vehicles ) {
if ( FindVehicle ( ii ) == null ) continue; // jump
Vehicles [ ii ].Respawn ( );
}
}
-
I've forgotten about it...
Thanks ;)