How to make a system which will call function(s) only when player picks up any pickup?
No no no
I mean player can use commandtext only when he picks up a pickup
One thing you can do is keep track of players that picked up a pickup with an array. At the top of the script, you could use this:
[pawn]new playersPickedUp[50];[/pawn]
When a player joins, you would set their entry to 0 to indicate that they haven't picked up a pickup yet, so in OnPlayerConnect, you would have this:
[pawn]playersPickedUp[playerid] = 0;[/pawn]
The purpose of this being that if a player leaves, when a player joins with the same ID that they had, they still have to pick up a pickup.
When a player picks up a pickup (OnPickedUp), you would then have this line of code to indicate that they picked up a pickup:
[pawn]playersPickedUp[playerid] = 1;[/pawn]
With a value of 0 (false) indicating they have not yet, and 1 (true) indicating that they have.
Lastly, in OnPlayerCommandText (or whatever it is, I haven't touched Pawn in a long while), you want to check if they've picked up a pickup. If they haven't yet, let them know to do so.
[pawn]
if( playersPickedUp[playerid] == 0 )
{
// Message the player telling them to pick up a pickup
}
else if( strcmp( cmd, "command", true ) == 0 )
{
// ......
}
else if( strcmp( cmd, "command2", true ) == 0 )
{
// .......
}
[/pawn]
Because of the use of
else if statements, and because we check to see if they picked up a pickup
before we check any of the commands, the script will
not run any commands until they pick up a pickup.