Timer for pickup
#1

Hello!

I have made 4 pickups spawn type 14 with functions, this one can only be picked up when in a vehicle and then it disappear after pickup.

So i need a timer to create these pickups every 5 sec, i tried to make just one pickup with that timer from wiki, but didnt get it to work.

Anyone who can help me?

pawn Код:
new newplayer;
new airwolves;
new bluefoxes;
new thunderbirds;

public OnGameModeInit()
{
    newplayer = CreatePickup(3096,14,405.8782,2460.9792,17.2118,-1);
    airwolves = CreatePickup(3096,14,1619.4607,1337.4252,10.8095,-1);
    bluefoxes = CreatePickup(3096,14,1874.7584,-2288.3972,14.2586,-1);
    thunderbirds = CreatePickup(3096,14,-1372.7068,-214.9956,14.1484,-1);
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == newplayer)
    {
        SendClientMessage(playerid, 0x33AA33AA, "Your vehicle has been repaired!");
        RepairVehicle(GetPlayerVehicleID(playerid));
    }
    if(pickupid == airwolves)
    {
        SendClientMessage(playerid, 0x33AA33AA, "Your vehicle has been repaired!");
        RepairVehicle(GetPlayerVehicleID(playerid));
    }
    if(pickupid == bluefoxes)
    {
        SendClientMessage(playerid, 0x33AA33AA, "Your vehicle has been repaired!");
        RepairVehicle(GetPlayerVehicleID(playerid));
    }
    if(pickupid == thunderbirds)
    {
        SendClientMessage(playerid, 0x33AA33AA, "Your vehicle has been repaired!");
        RepairVehicle(GetPlayerVehicleID(playerid));
    }
    return 1;
}
Reply
#2

pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == newplayer)
    {
        SendClientMessage(playerid, 0x33AA33AA, "Your vehicle has been repaired!");
        RepairVehicle(GetPlayerVehicleID(playerid));
        DestroyPickup(newplayer);
        SetTimer("Pickup", 5000,false);
    }
    if(pickupid == airwolves)
    {
        SendClientMessage(playerid, 0x33AA33AA, "Your vehicle has been repaired!");
        RepairVehicle(GetPlayerVehicleID(playerid));
        DestroyPickup(airwolves);
        SetTimer("Pickup",5000,false);
    }
    if(pickupid == bluefoxes)
    {
        SendClientMessage(playerid, 0x33AA33AA, "Your vehicle has been repaired!");
        RepairVehicle(GetPlayerVehicleID(playerid));
        DestroyPickup(bluefoxes);
        SetTimer("Pickup",5000,false);
    }
    if(pickupid == thunderbirds)
    {
        SendClientMessage(playerid, 0x33AA33AA, "Your vehicle has been repaired!");
        RepairVehicle(GetPlayerVehicleID(playerid));
        DestroyPickup(thunderbirds);
        SetTimer("Pickup",5000,false);
    }
    return 1;
}

forward Pickup();
public Pickup()
{
    newplayer = CreatePickup(3096,14,405.8782,2460.9792,17.2118,-1);
    airwolves = CreatePickup(3096,14,1619.4607,1337.4252,10.8095,-1);
    bluefoxes = CreatePickup(3096,14,1874.7584,-2288.3972,14.2586,-1);
    thunderbirds = CreatePickup(3096,14,-1372.7068,-214.9956,14.1484,-1);
    return 1;
}
Reply
#3

Quote:
Originally Posted by willsuckformoney
Посмотреть сообщение
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == newplayer)
    {
        SendClientMessage(playerid, 0x33AA33AA, "Your vehicle has been repaired!");
        RepairVehicle(GetPlayerVehicleID(playerid));
        DestroyPickup(newplayer);
        SetTimer("Pickup", 5000,false);
    }
    if(pickupid == airwolves)
    {
        SendClientMessage(playerid, 0x33AA33AA, "Your vehicle has been repaired!");
        RepairVehicle(GetPlayerVehicleID(playerid));
        DestroyPickup(airwolves);
        SetTimer("Pickup",5000,false);
    }
    if(pickupid == bluefoxes)
    {
        SendClientMessage(playerid, 0x33AA33AA, "Your vehicle has been repaired!");
        RepairVehicle(GetPlayerVehicleID(playerid));
        DestroyPickup(bluefoxes);
        SetTimer("Pickup",5000,false);
    }
    if(pickupid == thunderbirds)
    {
        SendClientMessage(playerid, 0x33AA33AA, "Your vehicle has been repaired!");
        RepairVehicle(GetPlayerVehicleID(playerid));
        DestroyPickup(thunderbirds);
        SetTimer("Pickup",5000,false);
    }
    return 1;
}

forward Pickup();
public Pickup()
{
    newplayer = CreatePickup(3096,14,405.8782,2460.9792,17.2118,-1);
    airwolves = CreatePickup(3096,14,1619.4607,1337.4252,10.8095,-1);
    bluefoxes = CreatePickup(3096,14,1874.7584,-2288.3972,14.2586,-1);
    thunderbirds = CreatePickup(3096,14,-1372.7068,-214.9956,14.1484,-1);
    return 1;
}
Thanks!
but it seams no pickup being created :/

EDIT: i solved it this way
pawn Код:
forward pickup();
new newplayer;
new airwolves;
new bluefoxes;
new thunderbirds;

public OnGameModeInit()
{   SetTimer("pickup",5000,true);
    return 1;
}

public pickup()
{
    newplayer = CreatePickup(3096,14,405.8782,2460.9792,17.2118,-1);
    airwolves = CreatePickup(3096,14,1619.4607,1337.4252,10.8095,-1);
    bluefoxes = CreatePickup(3096,14,1874.7584,-2288.3972,14.2586,-1);
    thunderbirds = CreatePickup(3096,14,-1372.7068,-214.9956,14.1484,-1);
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == newplayer)
    {
        SendClientMessage(playerid, 0x33AA33AA, "Your vehicle has been repaired!");
        RepairVehicle(GetPlayerVehicleID(playerid));
    }
    if(pickupid == airwolves)
    {
        SendClientMessage(playerid, 0x33AA33AA, "Your vehicle has been repaired!");
        RepairVehicle(GetPlayerVehicleID(playerid));
    }
    if(pickupid == bluefoxes)
    {
        SendClientMessage(playerid, 0x33AA33AA, "Your vehicle has been repaired!");
        RepairVehicle(GetPlayerVehicleID(playerid));
    }
    if(pickupid == thunderbirds)
    {
        SendClientMessage(playerid, 0x33AA33AA, "Your vehicle has been repaired!");
        RepairVehicle(GetPlayerVehicleID(playerid));
    }
    return 1;
}
thanks for helping!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)