How do I spread this?
#1

public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == Sniper_Pickup)
{
GivePlayerWeapon(playerid, 34, 20);
}

if(pickupid == SD_Pickup)
{
GivePlayerWeapon(playerid, 23,100);
}

if(pickupid == Health_Pickup)
{
SetPlayerHealth(playerid, 100);
}

if(pickupid == Armor_Pickup)
{
SetPlayerArmour(playerid, 100);
}
}
I created some pickups but this script only works for 1 of each of these pickups, how do i make it work for all of them.
Reply
#2

help me plz
Reply
#3

Don't bump your topic in less than 24 hours since the last post.

O.T.: Elaborate. What exactly is the problem? You can only pick one of them up? You can only pick them up once?
Please put your code in between a pair of php tags in future posts: [PHP ] [/PHP]
Reply
#4

I have a code that when I pickup a pickup its suppose to do something like set my health to 100, but when I go ingame to test it, it only works on 1 of my pickups when I 3, so I created a health pickup and that when I get it it gives me 100 health, I have 3 of the health pickups but it only works on 1 of them
Reply
#5

Show the code where you defined and created the pickups.
Reply
#6

[PHP ]Health_Pickup = CreatePickup(1240, 19, -2744.5020,3911.6094,21.3751,-1);//Health
Health_Pickup = CreatePickup(1240, 19, -2912.6404,3862.3818,32.3423,-1);//Health
Health_Pickup = CreatePickup(1240, 19, -2913.2795,3626.6135,55.6418,-1);//Health
[/PHP]
[PHP ]
new Health_Pickup;[/PHP] this is it
Reply
#7

Type 19: Disappears after pickup, but doesn't respawn. Makes "cash pickup" sound if picked up.

Source: https://sampwiki.blast.hk/wiki/PickupTypes

EDIT: I was a bit too fast with clicking submit. You're reassigning the variable to a different ID with every line you have. This means that you're giving only one of the three pickups the pick up effect and that is the last pickup assigned to the variable.
Reply
#8

Thats not the problem, when I get the pickup it heals me but only one of the hearts heal me but the others don't, so i wanna know how do I spread it to all of them so when I pick any health hearts I get health from all of them instead of 1
Reply
#9

Read my post again. I clicked submit a bit too fast:
Quote:
Originally Posted by AndySedeyn
Посмотреть сообщение
EDIT: I was a bit too fast with clicking submit. You're reassigning the variable to a different ID with every line you have. This means that you're giving only one of the three pickups the pick up effect and that is the last pickup assigned to the variable.
Reply
#10

As AndySedeyn said, use other pickup-type such as type 1.
Quote:
Originally Posted by SA-MP Wiki
Exists always. Disables pickup scripts such as horseshoes and oysters to allow for scripted actions ONLY. Will trigger OnPlayerPickUpPickup every few seconds.
Код:
Health_Pickup = CreatePickup(1240, 1, -2744.5020,3911.6094,21.3751,-1);//Health
Health_Pickup = CreatePickup(1240, 1, -2912.6404,3862.3818,32.3423,-1);//Health
Health_Pickup = CreatePickup(1240, 1, -2913.2795,3626.6135,55.6418,-1);//Health
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)