24.04.2011, 07:24
What does this stock do?
Found in Useful Functions .inc
pawn Код:
stock TogglePlayerControllable2(playerid, controllable, freezeid=0) //By Gabriel "Larcius" Cordes
{
if(IsPlayerConnected(playerid))
{
new isplfreeze=IsPlayerFreeze(playerid);
if (controllable==0)
{
if(freezeid>=MAX_FREEZE_ALL || freezeid<0)
{
for(new i=0; i<MAX_FREEZE_ALL; i++)
{
Players[playerid][Freeze][i]=0;
}
Players[playerid][Freeze][0]=1;
}
else
{
Players[playerid][Freeze][freezeid]=1;
}
if(!isplfreeze)
{
TogglePlayerControllable(playerid, 0);
#if defined OnPlayerToggleControllable
OnPlayerToggleControllable(playerid, 0);
#endif
}
}
else
{
if(freezeid>=MAX_FREEZE_ALL || freezeid<0)
{
for(new i=0; i<MAX_FREEZE_ALL; i++)
{
Players[playerid][Freeze][i]=0;
}
}
else
{
Players[playerid][Freeze][freezeid]=0;
}
if(isplfreeze && !IsPlayerFreeze(playerid))
{
TogglePlayerControllable(playerid, 1);
#if defined OnPlayerToggleControllable
OnPlayerToggleControllable(playerid, 1);
#endif
}
}
return 1;
}
return 0;
}