#1

How can I put these objects in a loop? I need to farmer job, just go to the last object.

PHP код:
new FloatXFloatYFloatZ;
GetPlayerPosiXY);
object CreateObject872XYZ-10.000000.000000.00000 );
w Float:x1Float:y1Float:z1;
GetObjectPos(objectx1y1z1);
if( 
PlayerToPoint 5.0ix1y1z1 ) )
{
DestroyObject( object );
 new 
FloatXFloatYFloatZ;
GetPlayerPosiXY);
altobject CreateObject2901XYZ0.000000.000000.00000 );

Reply
#2

Your goal is very unclear. I have no idea what you are asking for.
Reply
#3

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.
Reply
#4

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.
Reply
#5

Does anyone know?
Reply
#6

I guess you mean timers?

https://sampwiki.blast.hk/wiki/SetTimerEx
https://sampwiki.blast.hk/wiki/SetTimer
Reply
#7

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)
Reply
#8

The only thing you're looping in your code are the player ids. Post the complete code.
Reply
#9

timers are made.

PHP код:
forward Farmer( );
public 
Farmer( )
{
    for(new 
0MAX_PLAYERSi++)
    {
            new 
playerVehicle GetPlayerVehicleID);
            if( 
playerVehicle == FarmerJob] || playerVehicle == FarmerJob] || playerVehicle == FarmerJob] || playerVehicle == FarmerJob] || playerVehicle == FarmerJob] || playerVehicle == FarmerJob] || playerVehicle == FarmerJob] )
            {
                new 
FloatXFloatYFloatZ;
                
GetPlayerPosiXY);
                   
object CreateObject872XYZ-10.000000.000000.00000 );
               }
    }
    return 
1;
}

forward Farmer1 ( );
public 
Farmer1 ( )
{
    for(new 
0MAX_PLAYERSi++)
    {
        new 
playerVehicle GetPlayerVehicleID);
        if( 
playerVehicle == FarmerJob] || playerVehicle == FarmerJob] || playerVehicle == FarmerJob] || playerVehicle == FarmerJob] )
        {
               new 
Float:x1Float:y1Float:z1;
            
GetObjectPos(objectx1y1z1);
            if( 
PlayerToPoint 10.0ix1y1z1 ) )
            {
                
DestroyObject( object );
                   new 
FloatXFloatYFloatZ;
                
GetPlayerPosiXY);
                
altobject CreateObject2901XYZ0.000000.000000.00000 );
            }
        }
    }
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)