Pickup problem
#1

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.
Reply
#2

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);
    }
Reply
#3

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.
Reply
#4

Quote:
Originally Posted by Face9000
Посмотреть сообщение
Already done in that way, i can pickup it.
remove "="
use like
pawn Код:
if(pHealth < 85)
Reply
#5

Same.
Reply
#6

Quote:
Originally Posted by Face9000
Посмотреть сообщение
Same.
make sure you pickup type is pickabable
Reply
#7

It is
Reply
#8

Bump.
Reply
#9

Yo,is it you face9000 from minigames server?
Reply
#10

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)