09.08.2012, 06:45
So I want this to happen; after I cuff someone, that player should be free to move again after 20 seconds.
This is the code:
I want to make the TogglePlayerControllable(ID,1) after 20 seconds when someone get cuffed. How should I do this?
Please help, reputation will be given.
This is the code:
Код:
CMD:cuff(playerid, params[])
{
new ID; new pname[24]; new opname[24]; new string[200];
if(!IsPlayerACop(playerid)) return SendClientMessage(playerid, COLOR_RED,"You are not a law enforcement.");
if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "You cannot use this command in a vehicle.");
if(sscanf(params, "u", ID)) return SendClientMessage(playerid, COLOR_RED, "Usage: /cuff (ID)");
if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, COLOR_RED, "Invalid ID.");
GetPlayerName(ID, opname, 24); GetPlayerName(playerid, pname, 24);
if(GetDistanceBetweenPlayers(playerid, ID) > 3) return SendClientMessage(playerid, COLOR_RED, "That player is too far away to be cuffed.");
if(IsPlayerInAnyVehicle(ID)) return SendClientMessage(playerid, COLOR_RED, "That player is in a vehicle. You cannot cuff him.");
if(IsPlayerACop(playerid)) return SendClientMessage(playerid, COLOR_RED, "You cannot cuff other Law Enforcements.");
TogglePlayerControllable(ID, 0);
GameTextForPlayer(ID, "~b~HANDCUFFED!", 5000, 1);
format(string, sizeof(string), "[POLICE] Officer %s(%d) has put hand cuffs on you. You cannot move.", pname, playerid);
SendClientMessage(ID, COLOR_LIGHTBLUE, string);
format(string, 200, "[DISPATCH] Officer %s(%d) has cuffed player %s(%d)", pname, playerid, opname, ID);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "[POLICE] You have cuffed a suspect. You have 30 seconds before they get uncuffed.");
Please help, reputation will be given.


