Pickup problem - 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: Pickup problem (
/showthread.php?tid=430938)
Pickup problem -
Face9000 - 15.04.2013
Hello, someone can help me with this pickups? I don't wanna let players pickup this pickups if they have more than 85 hp/armour:
pawn Код:
if(pickupid == HealthPickup)
{
new Float:phealth;
GetPlayerHealth(playerid,phealth);
if(phealth >= 85)
{
SendClientMessage(playerid,red,"Your health is already full. You can't take this pickup.");
return 1;
}
else GivePlayerHealth(playerid,5);
}
if(pickupid == ArmourPickup)
{
new Float:parm;
GetPlayerArmour(playerid,parm);
if(parm >= 85)
{
SendClientMessage(playerid,red,"Your armour is already full. You can't take this pickup.");
return 1;
}
else GivePlayerArmour(playerid,5);
}
I got no errors while compiling, but ingame it allows me to pickup that pickups even if i have 90 hp..
I wanna set this pickups to be pickupable ONLY if u have < 85 score.
Re : Pickup problem -
DaTa[X] - 15.04.2013
pawn Код:
if(pickupid == HealthPickup)
{
new Float:phealth;
GetPlayerHealth(playerid,phealth);
if(phealth >= 85) return SendClientMessage(playerid,red,"Your health is already full. You can't take this pickup.");
GivePlayerHealth(playerid,5);
}
Re: Re : Pickup problem -
Face9000 - 15.04.2013
Quote:
Originally Posted by DaTa[X]
pawn Код:
if(pickupid == HealthPickup) { new Float:phealth; GetPlayerHealth(playerid,phealth); if(phealth >= 85) return SendClientMessage(playerid,red,"Your health is already full. You can't take this pickup."); GivePlayerHealth(playerid,5); }
|
Already done in that way, i can pickup it.
Re : Re: Re : Pickup problem -
DaTa[X] - 15.04.2013
Quote:
Originally Posted by Face9000
Already done in that way, i can pickup it.
|
remove "="
use like
Re: Pickup problem -
Face9000 - 15.04.2013
Same.
Re : Re: Pickup problem -
DaTa[X] - 15.04.2013
Quote:
Originally Posted by Face9000
Same.
|
make sure you pickup type is pickabable
Re: Pickup problem -
Face9000 - 15.04.2013
It is
Re: Pickup problem -
Face9000 - 16.04.2013
Bump.
Re: Pickup problem -
Giroud12 - 16.04.2013
Yo,is it you face9000 from minigames server?
Re: Pickup problem -
RajatPawar - 16.04.2013
It would be better if you checked under timers all players and then created pickups because here even if you destroy the pickup, it would appear as if they have picked it up. For example -
pawn Код:
SetTimer("do_something", 5000, 1, "d", playerid);
foreach(Player:i)
{
do_something( i );
}
forward public do_something( playerid );
public do_something( playerid )
{
new Float:health; GetPlayerHealth( playerid, health );
if( health > 85 ) return DestroyPickup( healthpickup );
else // do nothing, let it be displayed to them.
return 1;
}