if (strcmp("/goafk", cmdtext, true, 10) == 0)
{
currentvw = GetPlayerVirtualWorld(playerid);
currentcolor = GetPlayerColor(playerid);
SetPlayerColor(playerid, COLOR_GREY);
SetPlayerVirtualWorld(playerid, 5);
return 1;
}
if (strcmp("/back", cmdtext, true, 10) == 0)
{
SetPlayerColor(playerid, currentcolor);
SetPlayerVirtualWorld(playerid, currentvw);
return 1;
}
new currentvw;
new currentcolor;
if (strcmp("/goafk", cmdtext, true, 10) == 0) { currentvw = GetPlayerVirtualWorld(playerid); currentcolor = GetPlayerColor(playerid); SetPlayerColor(playerid, COLOR_GREY); SetPlayerVirtualWorld(playerid, 5); TogglePlayerControllable(playerid,1); return 1; } if (strcmp("/back", cmdtext, true, 10) == 0) { SetPlayerColor(playerid, currentcolor); SetPlayerVirtualWorld(playerid, currentvw); TogglePlayerControllable(playerid,0) return 1; }
Add TogglePlayerControllable to your script. It would be like this:
Код:
if (strcmp("/goafk", cmdtext, true, 10) == 0) { currentvw = GetPlayerVirtualWorld(playerid); currentcolor = GetPlayerColor(playerid); SetPlayerColor(playerid, COLOR_GREY); SetPlayerVirtualWorld(playerid, 5); TogglePlayerControllable(playerid,1); return 1; } if (strcmp("/back", cmdtext, true, 10) == 0) { SetPlayerColor(playerid, currentcolor); SetPlayerVirtualWorld(playerid, currentvw); TogglePlayerControllable(playerid,0) return 1; } |
TogglePlayerControllable(playerid, false); This will freeze the player so that his keys gets disabled. But he can chat.
TogglePlayerControllable(playerid, true); This will unfreeze the player so that his keys gets enabled. More info? TogglePlayerControllable |