SA-MP Forums Archive
OnPlayerPickUpPickup 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: OnPlayerPickUpPickup HELP (/showthread.php?tid=289893)



OnPlayerPickUpPickup HELP - MonkZemun - 13.10.2011

Hi,i wont to make when player enter pickup,put him into vehicle.
I do this but only one time put me in vehicle.I think you understand me because i don't know to speak perfect english.
PHP код:
new INFERNUS
PHP код:
INFERNUS AddStaticPickup(1240,2,2114.8801,-2426.1147,13.5469,0); 
PHP код:
    if(pickupid == INFERNUS)
    {
        
PutPlayerInVehicle(playeridINFERNUS0);
        
GetPlayerPos(playeridX,Y,Z);
        
INFERNUS CreateVehicle(411X,Y,Z0.00060000);
    } 



Re: OnPlayerPickUpPickup HELP - Jason_Thunde - 13.10.2011

Код:
new CustomPickup;
new Infernus;
Код:
CustomPickup = AddStaticPickup(1240,2,2114.8801,-2426.1147,13.5469,0);
Код:
if(pickupid == CustomPickup) 
    { 
        new Float:X, Float:Y, Float:Z);
        GetPlayerPos(playerid, X,Y,Z); 
        Infernus = CreateVehicle(411, X,Y,Z, 0.0, 0, 0, 60000); 
        PutPlayerInVehicle(playerid, Infernus, 0);
    }



Re: OnPlayerPickUpPickup HELP - llama - 13.10.2011

It's because you changed the "INFERNUS" variable from the pickup id to the vehicle id.

This should work:

pawn Код:
new Infernus_Pickup, Infernus;

Infernus_Pickup = AddStaticPickup(1240, 2, 2114.8801, -2426.1147, 13.5469, 0);

if(pickupid == Infernus_Pickup)
{
    if(GetVehicleModel(Infernus)) DestroyVehicle(Infernus);

    new Float:Pos[4];
    GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
    GetPlayerFacingAngle(playerid, Pos[3]);
    Infernus = CreateVehicle(411, Pos[0], Pos[1], Pos[2], Pos[3], -1, -1, 60000);
    PutPlayerInVehicle(playerid, Infernus, 0);
}
Edit: Ninja'd


Re: OnPlayerPickUpPickup HELP - MonkZemun - 13.10.2011

@Jason
It's work,but i made two pickups and when i enter in one he spawn me NRG and INFERNUS..i do this:

PHP код:
new NRGNRG1;
new 
INFERNUSINFERNUS1
PHP код:
NRG1 AddStaticPickup(1240,2,2118.9846,-2425.7520,13.5469,0);
INFERNUS1 AddStaticPickup(1240,2,2127.5208,-2430.4951,13.5469,0); 
PHP код:
public OnPlayerPickUpPickup(playeridpickupid)
{
    if(
pickupid == NRG1)
    {
        
GetPlayerPos(playeridX,Y,Z);
        
NRG CreateVehicle(522X,Y,Z0.00060000);
        
PutPlayerInVehicle(playeridNRG0);
    }
    if(
pickupid == INFERNUS1)
    {
        
GetPlayerPos(playeridX,Y,Z);
        
INFERNUS CreateVehicle(411X,Y,Z0.00060000);
        
PutPlayerInVehicle(playeridINFERNUS0);
    }
    return 
1;




Re: OnPlayerPickUpPickup HELP - Jason_Thunde - 13.10.2011

Its because you forgot new Float, Float:y, Float:z;

Wich wil be used for GetPlayerPos


Re: OnPlayerPickUpPickup HELP - MonkZemun - 13.10.2011

Again nothing..
PHP код:
public OnPlayerPickUpPickup(playeridpickupid)
{
    if(
pickupid == NRG1)
    {
        new 
Float:XFloat:YFloat:Z;
        
GetPlayerPos(playeridX,Y,Z);
        
NRG CreateVehicle(522X,Y,Z0.00060000);
        
PutPlayerInVehicle(playeridNRG0);
    }
    if(
pickupid == INFERNUS1)
    {
        new 
Float:XFloat:YFloat:Z;
        
GetPlayerPos(playeridX,Y,Z);
        
INFERNUS CreateVehicle(411X,Y,Z0.00060000);
        
PutPlayerInVehicle(playeridINFERNUS0);
    }
    return 
1;




Re: OnPlayerPickUpPickup HELP - Jason_Thunde - 13.10.2011

Here:

Код:
new InfernusPickup, NrgPickup, Nrg, Infernus;
Код:
NrgPickup = AddStaticPickup(1240,2,2118.9846,-2425.7520,13.5469,0);
InfernusPickup = AddStaticPickup(1240,2,2127.5208,-2430.4951,13.5469,0);
Код:
public OnPlayerPickUpPickup(playerid, pickupid) 
{ 
    if(pickupid == NrgPickup) 
    { 
        new Float:X, Float:Y, Float:Z);
        GetPlayerPos(playerid, X,Y,Z); 
        Nrg = CreateVehicle(522, X,Y,Z, 0.0, 0, 0, 60000); 
        PutPlayerInVehicle(playerid, Nrg, 0); 
    } 
    if(pickupid == InfernusPickup) 
    { 
        new Float:X, Float:Y, Float:Z);
        GetPlayerPos(playerid, X,Y,Z); 
        Infernus = CreateVehicle(411, X,Y,Z, 0.0, 0, 0, 60000); 
        PutPlayerInVehicle(playerid, Infernus, 0); 
    } 
    return 1; 
}



Re: OnPlayerPickUpPickup HELP - MonkZemun - 13.10.2011

damn! again the same..