SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 06/05/2020, 12:02 PM   #1
Saman22
Little Clucker
 
Join Date: May 2020
Posts: 1
Reputation: 0
Default Pickups.

Can anyone help me? How can I make 4 pickups health for the players and they can use them with money and if their money is less than $1200, the server will not allow them to use this pickup.
Saman22 is offline   Reply With Quote
Old 06/05/2020, 12:13 PM   #2
Mike861
Huge Clucker
 
Join Date: Feb 2018
Posts: 233
Reputation: 16
Default Re: Pickups.

https://wiki.sa-mp.com/wiki/CreatePickup
https://wiki.sa-mp.com/wiki/OnPlayerPickUpPickup

Under OnPlayerPickUpPickup where the pickupid is the one of the health ones:
Code:
new playermoney = GetPlayerMoney(playerid);
if(playermoney < 1200)
{
   //do what you want
   return 0;
}
Mike861 is offline   Reply With Quote
Old 06/05/2020, 06:58 PM   #3
beckzy
Beta Tester
 
Join Date: Dec 2006
Posts: 1,276
Reputation: 172
Default Re: Pickups.

Somewhere:
Code:
new healthpickups[4];
In OnGameModeInit (change the x, y, z):
Code:
healthpickups[0] = CreatePickup(1240, 1, x, y, z);
healthpickups[1] = CreatePickup(1240, 1, x, y, z);
healthpickups[2] = CreatePickup(1240, 1, x, y, z);
healthpickups[3] = CreatePickup(1240, 1, x, y, z);
}
In OnPlayerPickUpPickup:
Code:
for (new p = 0; p < sizeof(healthpickups); p++)
{
    if (healthpickups[p] != pickupid) continue;
    if (GetPlayerMoney(playerid) >= 1200)
    {
        new Float:health;
        GetPlayerHealth(playerid, health);
        if (health < 100.0)
        {
            GivePlayerMoney(playerid, -1200);
            SetPlayerHealth(playerid, 100.0);
        }
    }
    return 1;
}
__________________
beckzy is online now   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[FilterScript] [MySQL]Pickups Manager Module (Full Control on pickups) TitanX Filterscripts 5 13/03/2017 07:02 PM
Help with pickup FS (the pickup works for all pickups, even info pickups) jakejohnsonusa Scripting Help 4 19/12/2012 08:32 PM
Pickups acting as other pickups [HELP] ShawtyyMacJunior Scripting Help 2 12/08/2012 11:50 AM
Pickups/3DTexts don't show on house pickups - Help ! Edvin Scripting Help 1 21/06/2012 07:50 PM
[URGENT] I need a list of pickups with thier ids The new 0.3c pickups AMEENAMEEN Scripting Help 1 14/04/2012 05:12 PM


All times are GMT. The time now is 11:47 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.