This topic was marked solved by its starter, on May 27th, 2015, 05:53 PM

Fjose

  • Jr. Member
  • Programmer
  • Posts: 90
Pickups cannot be picked
« on May 25th, 2015, 04:40 PM »
I can't take the weapons from the pickups, I'm not seeing any problems on the script.

Code: [Select]
        CreatePickup( 280, Vector( -1744.31, -299.216, 14.8683 ) ); // m4 group
CreatePickup( 274, Vector( -1741.35, -294.67, 14.8683 ) ); // col group
CreatePickup( 274, Vector( -1691.8, -177.954, 14.8683 ) );
CreatePickup( 289, Vector( -1663.16, -129.052, 14.8683 ) ); // m6 group


function onPickupPickedUp( player, pickup )
{
local model = pickup.Model, id = player.ID, p = pinfo[id];
switch( model )
{
case 274:
return player.SetWeapon( 274, 50 );
break;
case 280:
return player.SetWeapon( 280, 60 );
break;
case 289:
return player.SetWeapon( 289, 40 );
break;
case 408:
return gMessage( id, mGreen, "Your Financial Status - Cash: $" + Bytes( p.Cash ) + ", Bank: $" + Bytes( p.Bank ) );
default:
break;
}
pickup.RespawnTime = 5;
}

.

  • VC:MP Beta Tester
  • .
  • Posts: 1,808
Re: Pickups cannot be picked
« Reply #1, on May 25th, 2015, 04:47 PM »
I think you need the function that decides whether a pickup can be picked by a player or not.

Code: [Select]
function onPickupClaimPicked(player, pickup)
{
return true; // true: Allow to pick-up. false: deny pick-up.
}
.

Fjose

  • Jr. Member
  • Programmer
  • Posts: 90
Re: Pickups cannot be picked
« Reply #2, on May 25th, 2015, 05:14 PM »
Quote from S.L.C on May 25th, 2015, 04:47 PM
I think you need the function that decides whether a pickup can be picked by a player or not.

Code: [Select]
function onPickupClaimPicked(player, pickup)
{
return true; // true: Allow to pick-up. false: deny pick-up.
}
nothing happens

jayant

  • Full Member
  • #MOMO-CS
  • Posts: 163
Re: Pickups cannot be picked
« Reply #3, on May 25th, 2015, 05:36 PM »Last edited on May 26th, 2015, 07:03 AM
Code: [Select]
function onPickupPickedUp( player, pickup )
{
  pickup.RespawnTime = 5;
  local model = pickup.Model, id = player.ID, p = pinfo[id];
   if( model ==  274 )  player.SetWeapon( 274, 50 );
   else if ( model == 280 )  player.SetWeapon( 280, 60 );
   else if ( model ==  289 )   player.SetWeapon( 289, 40 );
   else if ( model ==  408 )  gMessage( id, mGreen, "Your Financial Status - Cash: $" + Bytes( p.Cash ) + ", Bank: $" + Bytes( p.Bank ) );
 }

A small mistake of else if..ty @Beztone

MacTavish

  • Hero Member
  • Nicks( Kusanagi, Beztone, RATHORE )
  • Posts: 811
Re: Pickups cannot be picked
« Reply #4, on May 25th, 2015, 07:39 PM »Last edited on May 25th, 2015, 07:46 PM
Quote from jayant on May 25th, 2015, 05:36 PM
Code: [Select]
function onPickupPickedUp( player, pickup )
{
  pickup.RespawnTime = 5;
  local model = pickup.Model, id = player.ID, p = pinfo[id];
   if( model ==  274 )  player.SetWeapon( 274, 50 );
   if ( model == 280 )  player.SetWeapon( 280, 60 );
   if ( model ==  289 )   player.SetWeapon( 289, 40 );
   if ( model ==  408 )  gMessage( id, mGreen, "Your Financial Status - Cash: $" + Bytes( p.Cash ) + ", Bank: $" + Bytes( p.Bank ) );
 }
It would be
Code: [Select]
function onPickupPickedUp( player, pickup )
{
  pickup.RespawnTime = 5;
  local model = pickup.Model, id = player.ID, p = pinfo[id];
   if( model ==  274 )  player.SetWeapon( 274, 50 );
   else if ( model == 280 )  player.SetWeapon( 280, 60 );
  else if ( model ==  289 )   player.SetWeapon( 289, 40 );
  else if ( model ==  408 )  gMessage( id, mGreen, "Your Financial Status - Cash: $" + Bytes( p.Cash ) + ", Bank: $" + Bytes( p.Bank ) );
 }

Also try

Code: [Select]
function onPickupPickedUp( player, pickup )
{
 local model = pickup.Model, id = player.ID, p = pinfo[id];
 switch( model )
 {
  case 274:
    player.SetWeapon( 274, 50 );
   break;
  case 280:
   player.SetWeapon( 280, 60 );
   break;
  case 289:
   player.SetWeapon( 289, 40 );
   break;
  case 408:
   gMessage( id, mGreen, "Your Financial Status - Cash: $" + Bytes( p.Cash ) + ", Bank: $" + Bytes( p.Bank ) );
   break;
return;
 }
 pickup.RespawnTime = 5;
}

Grand Hunting Project
Join #SLC, #KAKAN, #Doom, #GHP @LUnet

Retired VC:MP Player/Scripter :P

Fjose

  • Jr. Member
  • Programmer
  • Posts: 90

MacTavish

  • Hero Member
  • Nicks( Kusanagi, Beztone, RATHORE )
  • Posts: 811

Grand Hunting Project
Join #SLC, #KAKAN, #Doom, #GHP @LUnet

Retired VC:MP Player/Scripter :P

Thijn

  • VC:MP Beta Tester
  • Posts: 1,686

Stormeus

  • VC:MP Developer
  • oh god how did i get here im not good w computer
  • Posts: 1,128

Fjose

  • Jr. Member
  • Programmer
  • Posts: 90
Re: Pickups cannot be picked
« Reply #9, on May 27th, 2015, 04:32 PM »
ok, I have this.

Code: [Select]
        CreatePickup( 280, 1, 60, Vector( -1744.31, -299.216, 14.8683 ), 255, true ); // m4 group
CreatePickup( 274, 1, 50, Vector( -1741.35, -294.67, 14.8683 ), 255, true ); // col group
CreatePickup( 274, 1, 50, Vector( -1691.8, -177.954, 14.8683 ), 255, true );
CreatePickup( 289, 1, 40, Vector( -1663.16, -129.052, 14.8683 ), 255, true ); // m6 group

function onPickupPickedUp( player, pickup )
{
local model = pickup.Model, id = player.ID, p = pinfo[id];
switch( model )
{
case 274:
case 280:
case 289:
FindPickup( pickup.ID ).Remove();
FindPickup( pickup.ID ).RespawnTime( 5 );
return;
break;
case 408:
return gMessage( id, mGreen, "Your Financial Status - Cash: $" + Bytes( p.Cash ) + ", Bank: $" + Bytes( p.Bank ) );
break;
default:
break;
}
}

but there is an error using FindPickup( pickup.ID ).RespawnTime( 5 ); or FindPickup( pickup.ID ).RespawnTime = 5;

>> Error: Attempt to call an integer. <<

How use that function? I had no problems with that function on the 0.3


.

  • VC:MP Beta Tester
  • .
  • Posts: 1,808
Re: Pickups cannot be picked
« Reply #10, on May 27th, 2015, 04:41 PM »Last edited on May 27th, 2015, 04:47 PM
Quote from Fjose on May 27th, 2015, 04:32 PM
Code: [Select]
FindPickup( pickup.ID ).RespawnTime( 5 );
Look closer. You are using RespawnTime as if it were a function, which it isn't (it's a property). See if this looks familiar:
Code: [Select]
local var = 243;

var();
.

Fjose

  • Jr. Member
  • Programmer
  • Posts: 90
Re: Pickups cannot be picked
« Reply #11, on May 27th, 2015, 05:53 PM »
I've found another solution using pickup.Timer that does the same like pickup.RespawnTime ( I guess, this function doesn't work on 0.4)