02.02.2013, 19:36
hi if i /cuff someone it cuffed me.
Код:
command(cuff, playerid, params[]) { new ID; new string[200]; if(!IsCop(playerid)) return SendClientMessage(playerid, COLOR_ERROR, "Only Cops/Army can use this command"); if(GetPVarInt(playerid, "Spawned") == 0) return SendClientMessage(playerid, COLOR_ERROR, "You cannot use this command."); if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_ERROR, "You cannot use this command in a vehicle."); if(sscanf(params, "u", ID)) return SendClientMessage(playerid, COLOR_ERROR, "Usage: /cuff (ID)"); if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, COLOR_ERROR, "Invalid ID."); if(GetDistanceBetweenPlayers(playerid, ID) > 3) return SendClientMessage(playerid, COLOR_ERROR, "That player is too far away to hand cuff."); if(GetPVarInt(ID, "Cuffed") == 1) return SendClientMessage(playerid, COLOR_ERROR, "That player is already cuffed."); if(GetPVarInt(ID, "Jailed") == 1) return SendClientMessage(playerid, COLOR_ERROR, "You cannot cuff a prisoner."); if(IsPlayerInAnyVehicle(ID)) return SendClientMessage(playerid, COLOR_ERROR, "That player is in a vehicle. You cannot cuff him."); if(IsCop(ID)) return SendClientMessage(playerid, COLOR_ERROR, "You cannot cuff other Police Officers."); GameTextForPlayer(ID, "~b~HANDCUFFED!", 5000, 1); format(string, sizeof(string), "[POLICE] Officer %s has put hand cuffs on you. You cannot move.", PlayerInfo(playerid)); SendClientMessage(ID, COLOR_DODGERBLUE, string); format(string, 200, "[DISPATCH] Officer %s has cuffed player %s", PlayerInfo(playerid), PlayerInfo(ID)); SendCopMessage(string); SetPVarInt(ID, "Cuffed", 1); #pragma unused params SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CUFFED); SetPlayerAttachedObject(playerid, 0, 19418, 6, -0.011000, 0.028000, -0.022000, -15.600012, -33.699977, -81.700035, 0.891999, 1.000000, 1.168000); return 1; } command(uncuff, playerid, params[]) { new ID; new string[200]; if(!IsCop(playerid)) return SendClientMessage(playerid, COLOR_ERROR, "Only Cops/Army can use this command."); if(GetPVarInt(playerid, "Spawned") == 0) return SendClientMessage(playerid, COLOR_ERROR, "You cannot use this command."); if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_ERROR, "You cannot use this command in a vehicle."); if(sscanf(params, "u", ID)) return SendClientMessage(playerid, COLOR_ERROR, "Usage: /uncuff (ID)"); if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, COLOR_ERROR, "Invalid ID."); if(GetDistanceBetweenPlayers(playerid, ID) > 3) return SendClientMessage(playerid, COLOR_ERROR, "That player is too far away to uncuff."); if(GetPVarInt(ID, "Cuffed") == 0) return SendClientMessage(playerid, COLOR_ERROR, "That player ID isn't cuffed."); if(IsPlayerInAnyVehicle(ID)) return SendClientMessage(playerid, COLOR_ERROR, "That person is in a vehicle, you cannot uncuff them."); TogglePlayerControllable(ID, 1); format(string, 200, "[POLICE] %s has uncuffed you.", PlayerInfo(playerid)); SendClientMessage(ID, COLOR_DODGERBLUE, string); format(string, 200, "[DISPATCH] %s has uncuffed %s", PlayerInfo(playerid), PlayerInfo(ID)); SendCopMessage(string); SetPVarInt(ID, "Cuffed", 0); SetPVarInt(ID, "CuffTimer", 0); #pragma unused params for(new i=0; i<MAX_PLAYER_ATTACHED_OBJECTS; i++) { if(IsPlayerAttachedObjectSlotUsed(playerid, i)) RemovePlayerAttachedObject(playerid, i); SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE); } return 1; }