health pickup
#1

So me and my friend are working on a gamemode, so I told him to make a health pickup, but how do I change it that the player gets +10 hp?

Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == Health[playerid]) SetPlayerHealth(playerid,100), DestroyPickup(Health[playerid]);
    return 1;
}
Reply
#2

PHP код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(
pickupid == Health[playerid]) SetPlayerHealth(playerid, GetPlayerHealth(playerid) +10);, DestroyPickup(Health[playerid]);
    return 
1;
} 
This should work
Reply
#3

Quote:
Originally Posted by KayJ
Посмотреть сообщение
[PHP]
This should work
GetPlayerHealth doesn't return the player's health, instead you must pass a variable as a parameter.

PHP код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(
pickupid == Health[playerid])
    {
        new 
Float:h;
        
GetPlayerHealth(playerid, h);
        
SetPlayerHealth(playerid, h+10.0);
        
DestroyPickup(pickupid);
    }
    return 
1;
} 
Reply
#4

Quote:
Originally Posted by GaByM
Посмотреть сообщение
PHP код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(
pickupid == Health[playerid])
    {
        new 
Float:h;
        
GetPlayerHealth(playerid, h);
        
SetPlayerHealth(playerid, h+10.0);
        
DestroyPickup(pickupid);
    }
    return 
1;
} 
use this.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)