Liberty Unleashed

Scripting => Script Help => Topic started by: rwwpl on November 06, 2014, 09:19:32 pm

Title: .Respawn() doesn't work
Post by: rwwpl on November 06, 2014, 09:19:32 pm
I have problem with .Respawn();

Code: [Select]
else if (c == "respawnall")
{
for(local a = 0; a < GetVehicleCount(); a ++)
{
local vee = FindVehicle(a);
if(vee) vee.Respawn();
}
}

Error:

Code: [Select]
<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
Title: Re: .Respawn() doesn't work
Post by: Merk. on November 06, 2014, 10:48:24 pm
Code: [Select]
for(local a = 0; a < GetVehicleCount(); a ++)
to

Code: [Select]
for(local a = 0; a < ( GetVehicleCount() - 1 ); a ++)
Title: Re: .Respawn() doesn't work
Post by: rwwpl on November 07, 2014, 03:14:11 pm
Code: [Select]
for(local a = 0; a < GetVehicleCount(); a ++)
to

Code: [Select]
for(local a = 0; a < ( GetVehicleCount() - 1 ); a ++)

Doesn't work... the same error
Title: Re: .Respawn() doesn't work
Post by: Merk. on November 07, 2014, 06:57:51 pm
As Vortrex said...

Code: [Select]
Vehicles <- { };

function onServerStart ( ) {

local count = 0;
while ( count <= MAX_VEHICLES ) {

if ( FindVehicle ( count ) != null ) {

Vehicles [ count ] <- FindVehicle ( count );
}

count ++;
}
}

cmd:

Code: [Select]
if ( c == "respawnall" ) {

foreach ( ii, iv in Vehicles ) {

if ( FindVehicle ( ii ) == null ) continue; // jump

Vehicles [ ii ].Respawn ( );
}
}
Title: Re: .Respawn() doesn't work
Post by: rwwpl on November 07, 2014, 08:18:46 pm
I've forgotten about it...

Thanks ;)