SA-MP Forums Archive
Pickup Script help Rep+ - 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: Pickup Script help Rep+ (/showthread.php?tid=315080)



Pickup Script help Rep+ - boyan96 - 01.02.2012

How i can make this in my server when you get healt or armour to get money


Re: Pickup Script help Rep+ - -CaRRoT - 01.02.2012

First of all , You have to Add at the Top ,
PHP код:
new health
, Then , Under ongamemodeinit , Add :
PHP код:
health CreateDynamicPickup(1240X,Y,Z,VW); // Replace the X Y Z VW with Your Cordinates and Virtural World 
- Now. under OnPlayerPickupPickup , Add :

PHP код:
    if(pickupid == health)
    {
            
SetPlayerHealth(playerid,100);
        
GivePlayerMoney(playerid,-1000);
        
SendClientMessage(playerid,COLOR,"You have Bought Health");
        return 
1;
    } 
And you are done


Re: Pickup Script help Rep+ - boyan96 - 01.02.2012

Thank you i give you Rep


Re: Pickup Script help Rep+ - KingHual - 01.02.2012

Quote:
Originally Posted by Breto
Посмотреть сообщение
First of all , You have to Add at the Top ,
PHP код:
new health
, Then , Under ongamemodeinit , Add :
PHP код:
health CreateDynamicPickup(1240X,Y,Z,VW); // Replace the X Y Z VW with Your Cordinates and Virtural World 
- Now. under OnPlayerPickupPickup , Add :

PHP код:
    if(pickupid == health)
    {
            
SetPlayerHealth(playerid,100);
        
GivePlayerMoney(playerid,-1000);
        
SendClientMessage(playerid,COLOR,"You have Bought Health");
        return 
1;
    } 
And you are done
Even though, it will work even if the player has - 120120210 money... You also need to check if the player's money is more than 1000.

pawn Код:
if(pickupid == health)
    {
            if (GetPlayerMoney(playerid) < 1000)
            {
                SetPlayerHealth(playerid,100);
                GivePlayerMoney(playerid,-1000);
                SendClientMessage(playerid,COLOR,"You have Bought Health");
            }
            return 1;
    }



Re: Pickup Script help Rep+ - boyan96 - 01.02.2012

Thank you king_hual Rep+