[MAX_PLAYERS];
#1

Hey guys.
I was wondering, I don't even know what it's called. (I'm tired). How to make things like (this is just an example)
pawn Код:
if (DoesPlayerHaveMedicKit(playerid) == 1)
{
     SetPlayerHealth(playerid, 100.0);
}
DoesPlayerHaveMedicKit(playerid) is the thing I want, I understand you've use say. new DoesPlayerHaveMedicKit[MAX_PLAYERS]; or something along those lines, anyways. Any help is good.
Reply
#2

On top you would do:

pawn Код:
new DoesPlayerHaveMedicKit[MAX_PLAYERS];
Then somewhere in a command, when they type /medkit or something you can do:

pawn Код:
DoesPlayerHaveMedicKit[playerid] = 1; // 1 would mean they have a medkit
DoesPlayerHaveMedicKit[playerid] = 0; // 0 would mean they have no medkit
Then to check if they got the medkit you could do the following things:

In a command, for example /checkmedkit:

pawn Код:
if(DoesPlayerHaveMedicKit[playerid] == 1)
{
  // player has medkit
}
else
{
  // player does not have medkit
}
Or make a function:

pawn Код:
forward CheckPlayerMedkit(playerid);
public CheckPlayerMedkit(playerid)
{
  if(DoesPlayerHaveMedicKit[playerid] == 1)
  {
    return 1;
  }
  return 0;
}
Then in a command for example /checkmedkit again:

pawn Код:
if(CheckPlayerMedkit(playerid))
{
   // player has a medkit
}

// Or:

if(!CheckPlayerMedkit(playerid))
{
   // player has a no medkit
}
Hope this helped..
Reply
#3

Thanks, I've got to go now.
I'll try this out when I get back, & give you some feedback.
Reply
#4

How could you 'give' them the MedicKit?
pawn Код:
DoesPlayerHaveMedicKit[playerid] = 1; //?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)