Toggleplayercontrollable question?
#1

is there any function to detect if the player is freeze or not? coz i want to make a NOP check for toggleplayercontrollable.
Reply
#2

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

https://sampforum.blast.hk/showthread.php?tid=417175
Reply
#4

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

It has that function built in HL

#define IsPlayerFrozen(%0) PlayerIsFrozen[%0]
Reply
#6

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?
Reply
#7

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

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

PVars are bad practice and serve absolutely no purpose but to make ugly convoluted code.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)