Drive Thru - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Drive Thru (
/showthread.php?tid=271758)
Drive Thru -
Compton - 25.07.2011
Hello once again SAMP playing people!!!
I need some help. Well today I made a drive thru dialog and all is actually pretty good, I did it so that if someone buys some item from the menu he gets +50 hp but the problem is, if the players will buy like 5 random things their hp wont stop to grow and it will continue growing, so players might abuse, So im wondering how to make it so that when player got 100 % of his hp, other food that player will buy wont actually give him more hp.
Thank you.
Here is one item from the Dialog, so you will know how it looks now:
Код:
if(listitem == 1)// 'Chicken Burger'
{
GetPlayerHealth(playerid, health);
SetPlayerHealth(playerid, health +50.0);
GivePlayerMoney(playerid, - 10);
TogglePlayerControllable(playerid,1);
}
Re: Drive Thru -
dowster - 25.07.2011
pawn Код:
if(listitem == 1)// 'Chicken Burger'
{
GetPlayerHealth(playerid, health);
health = (health+50);
if(health > 100) SetPlayerHealth(playerid, 100);
else SetPlayerHealth(playerid, health );//Removed the +50 from this line since the health variable has already gotten 50 added to it, it was then adding a hundred, sorry
GivePlayerMoney(playerid, - 10);
TogglePlayerControllable(playerid,1);
}
this should work, i didnt test it just typed it in the reply box
Re: Drive Thru -
Compton - 25.07.2011
Yes, thank you that problem is solved but now there is another problem, every item I buy from the dialog sets your hp to 100 and not to 50 like I need, but atleast now the HP dosent go over 100.
Re: Drive Thru -
dowster - 25.07.2011
I edited my post, should work now
Re: Drive Thru -
geerdinho8 - 25.07.2011
Код:
if(listitem == 1)// 'Chicken Burger'
{
GetPlayerHealth(playerid, health);
health = (health+50);
if(health > 100) SetPlayerHealth(playerid, +50);
else SetPlayerHealth(playerid, health );//Removed the +50 from this line since the health variable has already gotten 50 added to it, it was then adding a hundred, sorry
GivePlayerMoney(playerid, - 10);
TogglePlayerControllable(playerid,1);
}
Re: Drive Thru -
dowster - 25.07.2011
Quote:
Originally Posted by geerdinho8
Код:
if(listitem == 1)// 'Chicken Burger'
{
GetPlayerHealth(playerid, health);
health = (health+50);
if(health > 100) SetPlayerHealth(playerid, +50);
else SetPlayerHealth(playerid, health );//Removed the +50 from this line since the health variable has already gotten 50 added to it, it was then adding a hundred, sorry
GivePlayerMoney(playerid, - 10);
TogglePlayerControllable(playerid,1);
}
|
really.. your gonna repost my post and not give me credit?
Re: Drive Thru -
iPLEOMAX - 25.07.2011
This will work correctly. Hopefully.
pawn Код:
if(listitem == 1)// 'Chicken Burger'
{
new Float:HP; GetPlayerHealth(playerid, HP);
if(HP >= 50.0) { SetPlayerHealth(playerid, 100.0); }
else { SetPlayerHealth(playerid, HP+50.0); }
GivePlayerMoney(playerid, -10);
TogglePlayerControllable(playerid, true);
}
Re: Drive Thru -
geerdinho8 - 25.07.2011
Quote:
Originally Posted by dowster
really.. your gonna repost my post and not give me credit?
|
credits?
because you added 2 new lines?
And btw, i changed it.
If his health was below 100, it would give him always 100 hp if he bought it.
So:
Player has 1 health.
Player Buys a meal.
Player has 100 health.
My code:
Player has 1 health.
Player Buys a meal.
Player has 51 health.
Re: Drive Thru -
dowster - 25.07.2011
Quote:
Originally Posted by geerdinho8
credits?
because you added 2 new lines?
And btw, i changed it.
If his health was below 100, it would give him always 100 hp if he bought it.
So:
Player has 1 health.
Player Buys a meal.
Player has 100 health.
My code:
Player has 1 health.
Player Buys a meal.
Player has 51 health.
|
1. You just happened to type the exact same comment where i typed mine?
2. if they had one health they would actually end up with 101 health due to the extra +50 i had.
3. You clearly copy and pasted straight from what i did, all you changed was you used [code] instead of [pawn]
Re: Drive Thru -
geerdinho8 - 25.07.2011
Quote:
Originally Posted by dowster
1. You just happened to type the exact same comment where i typed mine?
2. if they had one health they would actually end up with 101 health due to the extra +50 i had.
3. You clearly copy and pasted straight from what i did, all you changed was you used [code] instead of [pawn]
|
Then i guess we were same minded.