Pickup Problem
#1

I'm having a problem with pickups. I'm trying to make it so when a person goes over a weapon pickup (Tec9 and Sawnoff) It gives them the amount of ammo I say.


It's not working though It doesn't give the amount i want it to.

pawn Код:
new FightClubHealth;
new FightClubArmour;
new FightClubTec9;
new FightClubSawnoff;

FightClubHealth = CreatePickup(1240, 2, -1038.4342,1025.6862,1343.2644, -1);
FightClubArmour = CreatePickup(1242, 2, -1067.6223,1088.3184,1346.5283, -1);
FightClubTec9 = CreatePickup(372, 2, -1018.3204,1063.2198,1343.0958, -1);
FightClubSawnoff = CreatePickup(350, 2, -1044.2113,1094.0320,1346.4677, -1);

public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == FightClubHealth){
    SetPlayerHealth(playerid,100.0);
    return 1;
    }
    if(pickupid == FightClubArmour){
    SetPlayerArmour(playerid,100.0);
    return 1;
    }
    if(pickupid == FightClubTec9){
    GivePlayerWeapon(playerid,32, 960);
    return 1;
    }
    if(pickupid == FightClubSawnoff){
    GivePlayerWeapon(playerid,26, 202);
    return 1;
}
return 1;
}
Reply
#2

It has been reported in older versions of samp that OnPlayerPickUpPickup was bugged and you needed to check the pickup id with else-if-else. So try that way
Reply
#3

I'm using Sa-mp 0.3


Also, How can I do that can you please show me an example.


Thanks for the response.
Reply
#4

i guess put an "else" right before the second, third and fourth "if"?
Reply
#5

pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == FightClubHealth){
        SetPlayerHealth(playerid,100.0);
    }
    if(pickupid == FightClubArmour){
        SetPlayerArmour(playerid,100.0);
    }
    if(pickupid == FightClubTec9){
        GivePlayerWeapon(playerid,32, 960);
    }
    if(pickupid == FightClubSawnoff){
        GivePlayerWeapon(playerid,26, 202);
    }
return 1;
}
Maybe so it works.
Reply
#6

no return 1.

look at my onplayerpickuppickup it works fine.

Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == adminhouseenter)
        {
    GameTextForPlayer(playerid, "~g~Welcome To The Admin House", 3000, 3);
    SetPlayerInterior(playerid,7);
    SetPlayerPos(playerid,225.630997,1022.479980,1084.069946);
        }
    if(pickupid == adminclubenter)
        {
    GameTextForPlayer(playerid, "~g~Welcome To The Admin Club", 3000, 3);
    SetPlayerInterior(playerid,3);
    SetPlayerPos(playerid,-2637.69,1404.24,906.46);
        }
    if(pickupid == adminhouseinsideexit)
        {
    GameTextForPlayer(playerid, "~g~Exiting The Admin House", 3000, 3);
    SetPlayerInterior(playerid,0);
	SetPlayerPos(playerid,925.2908,2465.9124,13.6105);
        }
 	if(pickupid == adminclubhouseexitinside)
        {
    GameTextForPlayer(playerid, "~g~Exiting The Admin Club", 3000, 3);
    SetPlayerInterior(playerid,0);
    SetPlayerPos(playerid,909.0367,2470.6970,10.8203);
        }
    if(pickupid == adminbaselshouseenter)
        {
    GameTextForPlayer(playerid, "~g~Welcome To The Admin House", 3000, 3);
    SetPlayerInterior(playerid,12);
    SetPlayerPos(playerid,2324.2312,-1146.8840,1050.7101);
        }
    if(pickupid == adminbaselshouseexit)
        {
    GameTextForPlayer(playerid, "~g~Exiting To The Admin House", 3000, 3);
    SetPlayerInterior(playerid,0);
    SetPlayerPos(playerid,259.9321,-1820.5751,5.0241);
        }
}
btw how did u post those stuff in pawn code?
Reply
#7

Quote:
Originally Posted by DJBluefader
Посмотреть сообщение
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == FightClubHealth){
        SetPlayerHealth(playerid,100.0);
    }
    if(pickupid == FightClubArmour){
        SetPlayerArmour(playerid,100.0);
    }
    if(pickupid == FightClubTec9){
        GivePlayerWeapon(playerid,32, 960);
    }
    if(pickupid == FightClubSawnoff){
        GivePlayerWeapon(playerid,26, 202);
    }
return 1;
}
Maybe so it works.
That didn't work, I will post back after trying the if else.
Reply
#8

Tried with 'else if'?
Reply
#9

I tried everything you guys suggested.

1. Made onplayerpickuppickup not return 1;

2. Made else if in the code.

3. Put 1, and 2 together


Didn't work!....
pawn Код:
new FightClubHealth;
new FightClubArmour;
new FightClubTec9;
new FightClubSawnoff;
pawn Код:
FightClubHealth = CreatePickup(1240, 2, -1038.4342,1025.6862,1343.2644, -1);
FightClubArmour = CreatePickup(1242, 2, -1067.6223,1088.3184,1346.5283, -1);
FightClubTec9 = CreatePickup(372, 2, -1018.3204,1063.2198,1343.0958, -1);
FightClubSawnoff = CreatePickup(350, 2, -1044.2113,1094.0320,1346.4677, -1);
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == FightClubHealth)
    {
        SetPlayerHealth(playerid,100.0);
    }
    else if(pickupid == FightClubArmour)
    {
        SetPlayerArmour(playerid,100.0);
    }
    else if(pickupid == FightClubTec9)
    {
        GivePlayerWeapon(playerid,32, 960);
    }
    else if(pickupid == FightClubSawnoff)
    {
        GivePlayerWeapon(playerid,26, 202);
    }
}

To put things in pawn just use pawn tags [pawn.][/pawn] Put your code in the middle of that. (Without the . beside the first pawn
Reply
#10

Quote:
Originally Posted by MWF2
Посмотреть сообщение
I tried everything you guys suggested.

1. Made onplayerpickuppickup not return 1;

2. Made else if in the code.

3. Put 1, and 2 together


To put things in pawn just use pawn tags [pawn.][/pawn] Put your code in the middle of that. (Without the . beside the first pawn
You can try that or you can
return with setting..


pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == FightClubHealth)
    {
        return SetPlayerHealth(playerid,100.0);
    }
    if(pickupid == FightClubArmour)
    {
        return SetPlayerArmour(playerid,100.0);
    }
    if(pickupid == FightClubTec9)
    {
        return GivePlayerWeapon(playerid,32, 960);
    }
    if(pickupid == FightClubSawnoff)
    {
        return GivePlayerWeapon(playerid,26, 202);
    }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)