SA-MP Forums Archive
Help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help (/showthread.php?tid=571058)



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 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 );




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 
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;