health pickup - 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: health pickup (
/showthread.php?tid=649234)
health pickup -
ivndosos - 05.02.2018
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;
}
Re: health pickup -
KayJ - 05.02.2018
PHP код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == Health[playerid]) SetPlayerHealth(playerid, GetPlayerHealth(playerid) +10);, DestroyPickup(Health[playerid]);
return 1;
}
This should work
Re: health pickup -
GaByM - 05.02.2018
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;
}
Re: health pickup -
Mugala - 05.02.2018
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.