sprunk machine - 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: sprunk machine (
/showthread.php?tid=593182)
sprunk machine -
rambalili2 - 02.11.2015
Hey so i made this code for sprunk machine and it doesnt work as i want to
when i press f it takes money but doesnt heal player
and when i spam f it just takes money without waiting
Код:
if(GetPlayerMoney(playerid) >= 1)
{
if(PRESSED(KEY_SECONDARY_ATTACK))
{
if(IsPlayerInRangeOfPoint(playerid, 1.0, 320.1455,1733.6205,997.6163))
{
new Float:HP;
if(HP >= 101)
SetPlayerHealth(playerid, HP+20);
GetPlayerHealth(playerid, HP);
GivePlayerMoney(playerid, -1);
ApplyAnimation(playerid,"VENDING","VEND_Use",1.4,0 ,1,1,0,2500,1);
}
}
}
hope any one can help me fix it thanks
Re: sprunk machine -
AbyssMorgan - 02.11.2015
PHP код:
if(PRESSED(KEY_SECONDARY_ATTACK)){
if(GetPlayerMoney(playerid) >= 1){
if(IsPlayerInRangeOfPoint(playerid, 1.0, 320.1455,1733.6205,997.6163)){
new Float:HP;
GetPlayerHealth(playerid, HP);
if(HP < 100.0){
HP += 20.0;
if(HP > 100.0) HP = 100.0;
SetPlayerHealth(playerid, HP);
GivePlayerMoney(playerid, -1);
ApplyAnimation(playerid,"VENDING","VEND_Use",1.4,0 ,1,1,0,2500,1);
}
}
}
}
Re: sprunk machine -
rambalili2 - 02.11.2015
it works but not as i wanet too
when I spam F it fills the hp fast I want the player to wait 3-2 seconds before he can use it again
Re: sprunk machine -
AbyssMorgan - 02.11.2015
PHP код:
new SprunkUse[MAX_PLAYERS];
if(PRESSED(KEY_SECONDARY_ATTACK)){
if(GetPlayerMoney(playerid) >= 1){
if(IsPlayerInRangeOfPoint(playerid, 1.0, 320.1455,1733.6205,997.6163)){
if(GetTickCount()-SprunkUse[playerid] >= 2*1000){
new Float:HP;
GetPlayerHealth(playerid, HP);
if(HP < 100.0){
HP += 20.0;
if(HP > 100.0) HP = 100.0;
SetPlayerHealth(playerid, HP);
GivePlayerMoney(playerid, -1);
ApplyAnimation(playerid,"VENDING","VEND_Use",1.4,0 ,1,1,0,2500,1);
SprunkUse[playerid] = GetTickCount();
}
}
}
}
}
Re: sprunk machine -
rambalili2 - 02.11.2015
thanks man works perfect dont really know how to rep but thanks
EDIT: u mind explaing what you have done because i didnt understand
with the if(GetTickCount()