[MAX_PLAYERS]; - 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: [MAX_PLAYERS]; (
/showthread.php?tid=85186)
[MAX_PLAYERS]; -
Abernethy - 06.07.2009
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.
Re: [MAX_PLAYERS]; -
-Sneaky- - 06.07.2009
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..
Re: [MAX_PLAYERS]; -
Abernethy - 06.07.2009
Thanks, I've got to go now.
I'll try this out when I get back, & give you some feedback.
Re: [MAX_PLAYERS]; -
Abernethy - 07.07.2009
How could you 'give' them the MedicKit?
pawn Код:
DoesPlayerHaveMedicKit[playerid] = 1; //?