Toggleplayercontrollable question? -
burnuk - 28.05.2013
is there any function to detect if the player is freeze or not? coz i want to make a NOP check for toggleplayercontrollable.
AW: Toggleplayercontrollable question? -
HurtLocker - 28.05.2013
There is no such fuction but what you can do is this: As soon as you freeze them make a bool variable true or give to a simple variable the value 1. When unfreezing them make it false/0. Then you can make the check you want.
Re: Toggleplayercontrollable question? -
Pottus - 28.05.2013
https://sampforum.blast.hk/showthread.php?tid=417175
AW: Toggleplayercontrollable question? -
HurtLocker - 28.05.2013
Pottus this is not what he asks for. He wants to see if a player is freezed or not. Very good ex function for saving health and armour data though.
Re: Toggleplayercontrollable question? -
Pottus - 28.05.2013
It has that function built in HL
#define IsPlayerFrozen(%0) PlayerIsFrozen[%0]
AW: Toggleplayercontrollable question? -
HurtLocker - 28.05.2013
Oh you are right.
For knowledge reason:
I can understand the "new bool:PlayerIsFrozen[MAX_PLAYERS];" but sincerely the line you posted above makes me feel stupid... Can you explain it?
Re: Toggleplayercontrollable question? -
Pottus - 28.05.2013
Basically when you compile the preprocessor will replace PlayerIsFrozen(playerid); with PlayerIsFrozen[playerid]; the playerid can actually be anything such as "i" if your doing a loop it's kinda like hiding the fact it is an array but using it as a function.
Here is another example from my sub-streamer include.
This creates a macro function define which is very useful.
pawn Код:
#define OnCheckPoint:%1(%2,%3,%4) \
forward OnCP_%1(%2,%3,%4); \
public OnCP_%1(%2,%3,%4)
Now you can write in your script....
pawn Код:
OnCheckPoint:MyCheckPoint(playerid, cpid, cpindex)
{
}
This is would be called through a CallLocalFunction()
pawn Код:
CallLocalFunction(Fname, "iii", playerid, checkpointid, cpindex);
Re: Toggleplayercontrollable question? -
Konewka - 28.05.2013
Why not using PVars? Wherever you place TogglePlayerControllable function, use SetPVarInt to 1 and then make an if statement with GetPVarInt if you want to detect if the player is freezed. Remember to set your PVar to 0 when exit the server.
Re: Toggleplayercontrollable question? -
Pottus - 28.05.2013
PVars are bad practice and serve absolutely no purpose but to make ugly convoluted code.