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



Script help - Ciyber - 26.11.2014

Hi there!

i've scripted some "mini shop" soo i need your help to tell me how can script when the player has full hp (100) so he can't buy it.

epxplain:

Код:
if(GetPlayerMoney(playerid) < 1000)
    return SendClientMessage(playerid, 0x33FF00AA, "You don't have enough cash to buy this item.");
    GivePlayerMoney(playerid, -1000);
    SetPlayerHealth(playerid, 100); //heal
    SendClientMessage(playerid, 0x33FF00AA, "You have succesfully healed your self.");
So i'd like to add when the player has 100hp so he can't buy it.

Thank you.

my ingris skill


Re: Script help - AnthonyTimmers - 26.11.2014

Код:
new Float:health;
GetPlayerHealth(playerid, health);

if (health >= 100.0)
{
    // Player cannot buy it
}
else
{
    // Player can buy it
}



Re: Script help - Raweresh - 26.11.2014

Код:
new Float:Health;
GetPlayerHealth(playerid,Health);
if(Health >= 100.0)
{
	//Your code.
}



Re: Script help - AnthonyTimmers - 26.11.2014

Quote:
Originally Posted by Raweresh
Посмотреть сообщение
Код:
new Float:Health;
GetPlayerHealth(playerid,Health);
if(Health >= 100.0)
{

}
If you're gonna copy something, atleast check if it's right. Anyways, edited my post.


Re: Script help - Raweresh - 26.11.2014

Код:
new Float:Health;
GetPlayerHealth(playerid,Health);
if(Health >= 100.0)
{
	SendClientMessage(...); //Player can't buy it.
	return 1;
}
//Player can buy it.
I don't copy your code I write it in same time.