Help -
Edw - 15.04.2015
How can I put these objects in a loop? I need to farmer job, just go to the last object.
PHP код:
new Float: X, Float: Y, Float: Z;
GetPlayerPos( i, X, Y, Z );
object = CreateObject( 872, X, Y, Z-1, 0.00000, 0.00000, 0.00000 );
w Float:x1, Float:y1, Float:z1;
GetObjectPos(object, x1, y1, z1);
if( PlayerToPoint ( 5.0, i, x1, y1, z1 ) )
{
DestroyObject( object );
new Float: X, Float: Y, Float: Z;
GetPlayerPos( i, X, Y, Z );
altobject = CreateObject( 2901, X, Y, Z, 0.00000, 0.00000, 0.00000 );
}
Re: Help -
Crayder - 15.04.2015
Your goal is very unclear. I have no idea what you are asking for.
Re: Help -
_GHT_MarK445 - 15.04.2015
I also do not clearly understand, what do you want, but if you want to loop through all players you can use simple loop:
Код:
for(new i = 0; i < MAX_PLAYERS; i++)
and do not forgot to check, if IsPlayerConnected when using it.
Re: Help -
Edw - 15.04.2015
I'll try to make you understand. So 5 seconds is a check if you are in the combine and if you're a plant is created, repeat every second. And I want that when you go to tractor and come in and destroy the plant to appear a small bag. So many objects will be created and this must be tucked somewhere, I guess.
Re: Help -
Edw - 16.04.2015
Does anyone know?
Re: Help -
SickAttack - 16.04.2015
I guess you mean timers?
https://sampwiki.blast.hk/wiki/SetTimerEx
https://sampwiki.blast.hk/wiki/SetTimer
Re: Help -
Edw - 16.04.2015
No, I timers. It is an object that is created each 5 seconds and this should be recorded in a loop because I need to destroy them again (when you're with tractor)
Re: Help -
SickAttack - 16.04.2015
The only thing you're looping in your code are the player ids. Post the complete code.
Re: Help -
Edw - 16.04.2015
timers are made.
PHP код:
forward Farmer( );
public Farmer( )
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
new playerVehicle = GetPlayerVehicleID( i );
if( playerVehicle == FarmerJob[ 4 ] || playerVehicle == FarmerJob[ 5 ] || playerVehicle == FarmerJob[ 6 ] || playerVehicle == FarmerJob[ 6 ] || playerVehicle == FarmerJob[ 7 ] || playerVehicle == FarmerJob[ 8 ] || playerVehicle == FarmerJob[ 9 ] )
{
new Float: X, Float: Y, Float: Z;
GetPlayerPos( i, X, Y, Z );
object = CreateObject( 872, X, Y, Z-1, 0.00000, 0.00000, 0.00000 );
}
}
return 1;
}
forward Farmer1 ( );
public Farmer1 ( )
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
new playerVehicle = GetPlayerVehicleID( i );
if( playerVehicle == FarmerJob[ 0 ] || playerVehicle == FarmerJob[ 1 ] || playerVehicle == FarmerJob[ 2 ] || playerVehicle == FarmerJob[ 3 ] )
{
new Float:x1, Float:y1, Float:z1;
GetObjectPos(object, x1, y1, z1);
if( PlayerToPoint ( 10.0, i, x1, y1, z1 ) )
{
DestroyObject( object );
new Float: X, Float: Y, Float: Z;
GetPlayerPos( i, X, Y, Z );
altobject = CreateObject( 2901, X, Y, Z, 0.00000, 0.00000, 0.00000 );
}
}
}
return 1;
}