[Help] Best method to make repair pickup(?)
#1

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

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

Pickup type 14 is fine though , it works.
Reply
#4

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

Help?
Reply
#6

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

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

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

Help...
Reply
#10

Up, anyone?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)