SA-MP Forums Archive
[Help] Best method to make repair pickup(?) - 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] Best method to make repair pickup(?) (/showthread.php?tid=503430)



[Help] Best method to make repair pickup(?) - Strain - 29.03.2014

Hey
I want to make script with repair pickups, but there is bug with the pickup ID 14 in SAMP through objects.
Well, I thought to make with timer:
SetTimer("RepairPickup", 50, true);
and by loop:
PHP код:
forward RepairPickups();
public 
RepairPickups()
{
    for(new 
0MAX_PLAYERSi++)
    {
        if(
IsPlayerConnected(i) && GetPlayerState(i) == 2)
        {
            for(new 
reprep 100rep++)
            {
                if(
IsPlayerInRangeOfPoint(i5RepairPickups[rep][Pos][0], RepairPickups[rep][Pos][1], RepairPickups[rep][Pos][2]))
                {
                    
RepairVehicle(GetPlayerVehicleID(i));
                }
            }
        }
    }

The question if that will make lags with 50+ players?
I did the timer to "50" because if someone driving to fast he can miss the pickup.


Re: [Help] Best method to make repair pickup(?) - Vince - 29.03.2014

I have no problem with pickup type 14. It works flawlessly. However, be aware that you need to use CreatePickup, not AddStaticPickup.

Though, if you're dynamically creating them, I recommend using the streamer functions.
pawn Код:
public OnPlayerPickUpDynamicPickup(playerid, pickupid)
{
    if(Streamer_GetIntData(STREAMER_TYPE_PICKUP, pickupid, E_STREAMER_MODEL_ID) == 3096)
    {
        RepairVehicle(GetPlayerVehicleID(playerid));
    }
    return 1;
}
This will repair the vehicle if the player drives through a pickup with model 3096, which is the repair pickup.


Re: [Help] Best method to make repair pickup(?) - ParadiseRP - 29.03.2014

Pickup type 14 is fine though , it works.


Re: [Help] Best method to make repair pickup(?) - Strain - 29.03.2014

Quote:
Originally Posted by Vince
Посмотреть сообщение
I have no problem with pickup type 14. It works flawlessly. However, be aware that you need to use CreatePickup, not AddStaticPickup.

Though, if you're dynamically creating them, I recommend using the streamer functions.
pawn Код:
public OnPlayerPickUpDynamicPickup(playerid, pickupid)
{
    if(Streamer_GetIntData(STREAMER_TYPE_PICKUP, pickupid, E_STREAMER_MODEL_ID) == 3096)
    {
        RepairVehicle(GetPlayerVehicleID(playerid));
    }
    return 1;
}
This will repair the vehicle if the player drives through a pickup with model 3096, which is the repair pickup.
That is working on objects/sea? because I can't see him... anyway I just need the effect of the pickup.
I did it:
CreateDynamicPickup(3096, 14, X, Y, Z, -1, -1, -1, 100.0);

and your code in OnPlayerPickupDynamicPickUp, but I can't see nothing/cant get the repair.


Re: [Help] Best method to make repair pickup(?) - Strain - 30.03.2014

Help?


Re: [Help] Best method to make repair pickup(?) - Vince - 30.03.2014

I tested this method with the pickup on an object and it works fine. I am not aware of any issues with maps on sea.


Re: [Help] Best method to make repair pickup(?) - newbienoob - 30.03.2014

The pickup is bugged.
https://sampforum.blast.hk/showthread.php?tid=331196
Anyways, you can use dynamic areas to replace pickups. Not sure if it works tho


Re: [Help] Best method to make repair pickup(?) - Strain - 30.03.2014

Not working properly if you are driving to fast... and I dont want to make big distance because if I'm near the pickup I can't pickup him again untill I go far from the pickup...


Re: [Help] Best method to make repair pickup(?) - Strain - 31.03.2014

Help...


Re: [Help] Best method to make repair pickup(?) - Strain - 01.04.2014

Up, anyone?